3.5 KiB
3.5 KiB
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)
- Script, not raw file tools —
cook.pyguards against accidental overwrite/delete; frontmatter always machine-generated (no drift). Keep it minimal — shortest working code, no speculative features. - Frontmatter (free-form values, only
typeis fixed):type: recept|caj,category,cuisine(recepts only),origin(caj only),tags(user hashtags, no#),added(auto date). Can be lightened later. - Hashtags live in frontmatter
tags, not in body. - Search via script: frontmatter filtering + fulltext body grep. Start simple; enrich later.
- Slug collision:
addon existing slug → error; agent shows the existing item, user decides edit vs. new slug. No auto-2suffixes. - Assets:
cook/assets/<slug>/when documents/photos ever arrive; not created upfront.
Steps
- Rewrite
skills/cook/SKILL.mdto the final design:- layout (
cook/recepty/,cook/caj/,cook/assets/— created on demand) - all file mutations via
cook.pysubcommands; agent neverwrite_files intocook/directly except body edits viaedit_file/apply_patchafteraddcreates the skeleton - capture inline (same turn), commit after each change
(
git add cook/ && git commit -m "cook: ..."; nevergit add -A) - search/answer flow:
list/searchto 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
- layout (
- Write
skills/cook/scripts/cook.py— minimal (~150 lines), stdlib only:add <slug> --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-fileedit <slug>→ prints file path; exit 1 if missing (no silent create); actual text edits done by agent withedit_fileon the pathlist [--type T] [--category C] [--tag X]→ one line per item:slug type category added titleshow <slug>→ full file contentsearch <text>→ fulltext grep across bodies, prints matching lines with slug contextrename <old> <new>→ moves file (+ its assets dir if present); exit 1 if target existsdelete <slug>→ removes file (and empty assets dir); only run after user confirmation per SKILL.md flowvalidate→ checks every file has parseable frontmatter andtype- Frontmatter: minimal hand-rolled parse (no external deps).
- Test drive:
adda sample recipe + sample tea, verify frontmatter,list,search, collision error,validate, then delete samples and commit the real state.
Verification
cook.py addtwice on same slug → second exits 1edit/show/rename/deleteon missing slug → exit 1list --tag chatafilters on frontmatter tagssearch <word>finds body textvalidatepasses on script-created files, fails on a hand-mangled one- SKILL.md contains no leftover pipeline cruft (inbox/compile/lock)