# Cook skill — final design ## Context User wants a personal store for recipes and tea notes (origins, brewing parameters, tasting). Wiki/note rejected as too heavy. Agreed design: `cook/` data dir + thin `skills/cook/` skill manifest + a small safety script. This plan finalizes the design agreed question-by-question in chat (2026-09-08) and supersedes the quick-draft SKILL.md already written. ## Decisions (locked with user) 1. **Script, not raw file tools** — `cook.py` guards against accidental overwrite/delete; frontmatter always machine-generated (no drift). Keep it **minimal — shortest working code, no speculative features**. 2. **Frontmatter** (free-form values, only `type` is fixed): `type: recept|caj`, `category`, `cuisine` (recepts only), `origin` (caj only), `tags` (user hashtags, no `#`), `added` (auto date). Can be lightened later. 3. **Hashtags live in frontmatter `tags`**, not in body. 4. **Search via script**: frontmatter filtering + fulltext body grep. Start simple; enrich later. 5. **Slug collision**: `add` on existing slug → error; agent shows the existing item, user decides edit vs. new slug. No auto `-2` suffixes. 6. **Assets**: `cook/assets//` when documents/photos ever arrive; not created upfront. ## Steps 1. Rewrite `skills/cook/SKILL.md` to the final design: - layout (`cook/recepty/`, `cook/caj/`, `cook/assets/` — created on demand) - all file mutations via `cook.py` subcommands; agent never `write_file`s into `cook/` directly except body edits via `edit_file`/`apply_patch` after `add` creates the skeleton - capture inline (same turn), commit after each change (`git add cook/ && git commit -m "cook: ..."`; never `git add -A`) - search/answer flow: `list`/`search` to narrow, then read files, answer from files only, no confabulation - edit/delete: two-turn confirm flow (show exact text → user confirms → apply → commit) - slug conventions: kebab-case; collision handling per decision 5 2. Write `skills/cook/scripts/cook.py` — minimal (~150 lines), stdlib only: - `add --type recept|caj [--category C] [--cuisine C] [--origin O] [--tags a,b] [--body-file F]` → creates file with frontmatter; **exit 1 if slug exists**; reads body from stdin or `--body-file` - `edit ` → prints file path; **exit 1 if missing** (no silent create); actual text edits done by agent with `edit_file` on the path - `list [--type T] [--category C] [--tag X]` → one line per item: `slug type category added title` - `show ` → full file content - `search ` → fulltext grep across bodies, prints matching lines with slug context - `rename ` → moves file (+ its assets dir if present); exit 1 if target exists - `delete ` → removes file (and empty assets dir); only run after user confirmation per SKILL.md flow - `validate` → checks every file has parseable frontmatter and `type` - Frontmatter: minimal hand-rolled parse (no external deps). 3. Test drive: `add` a sample recipe + sample tea, verify frontmatter, `list`, `search`, collision error, `validate`, then delete samples and commit the real state. ## Verification - `cook.py add` twice on same slug → second exits 1 - `edit`/`show`/`rename`/`delete` on missing slug → exit 1 - `list --tag chata` filters on frontmatter tags - `search ` finds body text - `validate` passes on script-created files, fails on a hand-mangled one - SKILL.md contains no leftover pipeline cruft (inbox/compile/lock)