<!-- SYNC:understand-code-first -->[IMPORTANT] Use
TaskCreateto break ALL work into small tasks BEFORE starting — including tasks for each file read. This prevents context loss from long files. For simple tasks, AI MUST ATTENTION ask user whether to skip.
<!-- /SYNC:understand-code-first -->Understand Code First — HARD-GATE: Do NOT write, plan, or fix until you READ existing code.
- Search 3+ similar patterns (
grep/glob) — citefile:lineevidence- Read existing files in target area — understand structure, base classes, conventions
- Run
python .claude/scripts/code_graph trace <file> --direction both --jsonwhen.code-graph/graph.dbexists- Map dependencies via
connectionsorcallers_of— know what depends on your target- Write investigation to
.ai/workspace/analysis/for non-trivial tasks (3+ files)- Re-read analysis file before implementing — never work from memory alone
- NEVER invent new patterns when existing ones work — match exactly or document deviation
BLOCKED until:
- [ ]Read target files- [ ]Grep 3+ patterns- [ ]Graph trace (if graph.db exists)- [ ]Assumptions verified with evidence
docs/project-reference/domain-entities-reference.md— Domain entity catalog, relationships, cross-service sync (read when task involves business entities/models) (content auto-injected by hook — check for [Injected: ...] header before reading)docs/test-specs/— Test specifications by module (read existing TCs; generate/update test specs via/tdd-specafter implementation)
<!-- /SYNC:plan-quality -->Plan Quality — Every plan phase MUST ATTENTION include test specifications.
- Add
## Test Specificationssection with TC-{FEAT}-{NNN} IDs to every phase file- Map every functional requirement to ≥1 TC (or explicit
TBDwith rationale)- TC IDs follow
TC-{FEATURE}-{NNN}format — reference by ID, never embed full content- Before any new workflow step: call
TaskListand re-read the phase file- On context compaction: call
TaskListFIRST — never create duplicate tasks- Verify TC satisfaction per phase before marking complete (evidence must be
file:line, not TBD)Mode: TDD-first → reference existing TCs with
Evidence: TBD. Implement-first → use TBD →/tdd-specfills after.
<!-- SYNC:rationalization-prevention -->Evidence Gate: MANDATORY IMPORTANT MUST ATTENTION — every claim, finding, and recommendation requires
file:lineproof or traced evidence with confidence percentage (>80% to act, <80% must verify first).
<!-- /SYNC:rationalization-prevention -->Rationalization Prevention — AI skips steps via these evasions. Recognize and reject:
| Evasion | Rebuttal | | ---------------------------- | ------------------------------------------------------------- | | "Too simple for a plan" | Simple + wrong assumptions = wasted time. Plan anyway. | | "I'll test after" | RED before GREEN. Write/verify test first. | | "Already searched" | Show grep evidence with
file:line. No proof = no search. | | "Just do it" | Still need TaskCreate. Skip depth, never skip tracking. | | "Just a small fix" | Small fix in wrong location cascades. Verify file:line first. | | "Code is self-explanatory" | Future readers need evidence trail. Document anyway. | | "Combine steps to save time" | Combined steps dilute focus. Each step has distinct purpose. |
External Memory: For complex or lengthy work (research, analysis, scan, review), write intermediate findings and final results to a report file in
plans/reports/— prevents context loss and serves as deliverable.
Quick Summary
Goal: Implement a feature step-by-step with research, planning, execution, and verification.
Workflow:
- Question — Clarify requirements via AskUserQuestion; challenge assumptions
- Research — Use researcher subagents in parallel; scout codebase for patterns
- Plan — Create implementation plan, get user approval
- Implement — Execute with skill activation, code-simplifier, review-changes
Key Rules:
- Parent skill for all cook-* variants (cook-auto, cook-fast, cook-hard, cook-parallel)
- Write research findings to
.ai/workspace/analysis/for context preservation - Always activate relevant skills from catalog during implementation
- Break work into small todo tasks; add final review task
Frontend/UI Context (if applicable)
<!-- SYNC:ui-system-context -->When this task involves frontend or UI changes,
<!-- /SYNC:ui-system-context -->UI System Context — For ANY task touching
.ts,.html,.scss, or.cssfiles:MUST ATTENTION READ before implementing:
docs/project-reference/frontend-patterns-reference.md— component base classes, stores, formsdocs/project-reference/scss-styling-guide.md— BEM methodology, SCSS variables, mixins, responsivedocs/project-reference/design-system/README.md— design tokens, component inventory, iconsReference
docs/project-config.jsonfor project-specific paths.
- Component patterns:
docs/project-reference/frontend-patterns-reference.md - Styling/BEM guide:
docs/project-reference/scss-styling-guide.md - Design system tokens:
docs/project-reference/design-system/README.md
Pre-Implementation Granularity Gate (MANDATORY)
<HARD-GATE> <!-- SYNC:plan-granularity --><!-- /SYNC:plan-granularity -->Plan Granularity — Every phase must pass 5-point check before implementation:
- Lists exact file paths to modify (not generic "implement X")
- No planning verbs (research, investigate, analyze, determine, figure out)
- Steps ≤30min each, phase total ≤3h
- ≤5 files per phase
- No open decisions or TBDs in approach
Failing phases → create sub-plan. Repeat until ALL leaf phases pass (max depth: 3). Self-question: "Can I start coding RIGHT NOW? If any step needs 'figuring out' → sub-plan it."
If ANY check fails → STOP. Ask user: "Phase needs more detail before implementation. Refine with /plan? [Y/n]" DO NOT implement a phase that contains planning verbs, unnamed files, or unresolved decisions. </HARD-GATE>
Per-Phase Quality Cycle (MANDATORY)
<HARD-GATE> <!-- SYNC:iterative-phase-quality --><!-- /SYNC:iterative-phase-quality -->Iterative Phase Quality — Score complexity BEFORE planning.
Complexity signals: >5 files +2, cross-service +3, new pattern +2, DB migration +2 Score >=6 → MUST ATTENTION decompose into phases. Each phase:
- ≤5 files modified
- ≤3h effort
- Follows cycle: plan → implement → review → fix → verify
- Do NOT start Phase N+1 until Phase N passes VERIFY
Phase success = all TCs pass + code-reviewer agent approves + no CRITICAL findings.
Each plan phase = one quality cycle (plan→implement→review→fix→verify). DO NOT start next phase until current phase passes VERIFY. After each phase: re-assess remaining phases for scope changes. </HARD-GATE>
TC Satisfaction Verification (Per Phase)
After implementing each phase, before marking it complete:
- Read the phase's
## Test Specificationssection - For each mapped TC: verify evidence exists (file:line, not TBD), grep-verify the file
- If any TC lacks evidence → phase is NOT complete
- Update phase file's TC table with actual evidence references
Greenfield Mode
Auto-detected when no code directories (
src/,app/,lib/,packages/) or manifests (package.json/*.sln/go.mod) exist.
- Approved plan exists in
plans/→ scaffold from plan - No plan → redirect: "Run /plan first to create a greenfield project plan."
- Generate folder layout, starter files, build config, CI skeleton, CLAUDE.md
- Skip codebase pattern search. After scaffolding, run
/project-config.
Variant Decision Guide
| If implementation needs... | Use | Why |
| --------------------------- | --------------------- | --------------------------------------- |
| Quick, straightforward | /cook-fast | Skip deep research, minimal planning |
| Complex, multi-layer | /cook-hard | Maximum verification, subagent research |
| Backend + frontend parallel | /cook-parallel | Parallel fullstack-developer agents |
| Full autonomous execution | /cook-auto | Minimal user interaction |
| Fast autonomous | /cook-auto-fast | Auto + skip deep research |
| Parallel autonomous | /cook-auto-parallel | Auto + parallel agents |
| General/interactive | /cook (this skill) | Step-by-step with user collaboration |
Think harder to plan & start working on these tasks: <tasks>$ARGUMENTS</tasks>
Your Approach
- MUST ATTENTION use
AskUserQuestionto clarify — NEVER assume requirements - MUST ATTENTION be brutally honest — flag unrealistic/over-engineered approaches directly
- MUST ATTENTION present 2-3 alternatives with pros/cons for non-trivial decisions
- MUST ATTENTION challenge initial approach — the best solution often differs from first instinct
Workflow
IMPORTANT: Analyze the skills catalog at .claude/skills/* and activate needed skills during the process.
Research
- Parallel
researchersubagents. Reports <=150 lines with citations. /scout-ext(preferred) or/scout(fallback) for codebase search.- MUST ATTENTION write findings to
.ai/workspace/analysis/{task-name}.analysis.md. Re-read ENTIRE file before planning.
Plan
plannersubagent with progressive disclosure:plan.md(<=80 lines) +phase-XX-name.mdper phase.- Each phase: Context, Overview, Requirements, Architecture, Related Files, Steps, TCs, Success Criteria, Risks, Next Steps.
Implementation
/codeto implement step by step./interface-designfor product UIs./frontend-designfor marketing/creative UIs.ui-ux-designersubagent for frontend per./docs/design-guidelines.md.- MUST ATTENTION run type checking and compile after each change.
Subagent Discipline: Paste full task text (NEVER make subagent read plan file). Require "ask questions before starting". Require self-review before reporting.
Batch Checkpoint (Large Plans)
For plans with 10+ tasks, execute in batches with human review:
- Execute batch — Complete next 3 tasks (or user-specified batch size)
- Report — Show what was implemented, verification output, any concerns
- Wait — Say "Ready for feedback" and STOP. Do NOT continue automatically.
- Apply feedback — Incorporate changes, then execute next batch
- Repeat until all tasks complete
Testing
- Real tests: happy path, edge cases, error cases. NEVER fake data/mocks just to pass build.
testersubagent → failures →debuggersubagent → fix → repeat until green.
Code Review
<!-- SYNC:two-stage-task-review --><!-- /SYNC:two-stage-task-review -->Two-Stage Task Review — Both stages MUST ATTENTION complete before marking task done.
Stage 1: Self-review — Immediately after implementation:
- Requirements met? No regressions? Code quality acceptable?
Stage 2: Cross-review — Via
code-reviewersubagent:
- Catches blind spots, convention drift, missed edge cases
NEVER skip Stage 2. Self-review alone misses 40%+ of issues.
(1) spec-compliance-reviewer first, (2) code-reviewer after spec passes.
- Critical issues → fix → re-run
tester. Report summary to user for approval.
PM, Docs & Final Report
- Approved: Parallel
project-manager+docs-managersubagents. Rejected: Ask issues, fix, repeat. - Final: summary of changes + next steps. Ask about commit/push via
git-manager.
Red Flags — STOP
| Evasion thought | Correct action | | ----------------------------------- | ------------------------------------------------------ | | "Too simple for a plan" | Plan anyway. Hidden complexity. | | "I already know how" | Check codebase patterns first. NEVER assume. | | "Code first, test later" | Write test first. Or verify after EACH change. | | "Plan is close enough" | Follow exactly or raise concerns. Drift compounds. | | "Commit after everything" | Commit after each task. Frequent commits prevent loss. | | "This refactor will improve things" | Only refactor what's in scope. YAGNI. | | "Review is obvious, skip it" | NEVER skip. Reviews catch what authors miss. |
<!-- SYNC:graph-assisted-investigation --><!-- /SYNC:graph-assisted-investigation -->Graph-Assisted Investigation — MANDATORY when
.code-graph/graph.dbexists.HARD-GATE: MUST ATTENTION run at least ONE graph command on key files before concluding any investigation.
Pattern: Grep finds files →
trace --direction bothreveals full system flow → Grep verifies details| Task | Minimum Graph Action | | ------------------- | -------------------------------------------- | | Investigation/Scout |
trace --direction bothon 2-3 entry files | | Fix/Debug |callers_ofon buggy function +tests_for| | Feature/Enhancement |connectionson files to be modified | | Code Review |tests_foron changed functions | | Blast Radius |trace --direction downstream|CLI:
python .claude/scripts/code_graph {command} --json. Use--node-mode filefirst (10-30x less noise), then--node-mode functionfor detail.
After implementing, run
python .claude/scripts/code_graph connections <file> --jsonon modified files to verify no related files need updates.
Graph-Trace Before Implementation
MUST ATTENTION run BEFORE writing code when graph.db exists:
python .claude/scripts/code_graph trace <file-to-modify> --direction both --json— callers + triggerspython .claude/scripts/code_graph trace <file-to-modify> --direction downstream --json— all downstream consumers- Prevents breaking implicit dependencies (bus consumers, event handlers) invisible in the file itself.
Workflow Recommendation
MANDATORY IMPORTANT MUST ATTENTION — NO EXCEPTIONS: If you are NOT already in a workflow, you MUST ATTENTION use
AskUserQuestionto ask the user. Do NOT judge task complexity or decide this is "simple enough to skip" — the user decides whether to use a workflow, not you:
- Activate
featureworkflow (Recommended) — scout → investigate → plan → cook → review → sre-review → test → docs- Execute
/cookdirectly — run this skill standalone
Next Steps (Standalone: MUST ATTENTION ask user via AskUserQuestion. Skip if inside workflow.)
MANDATORY IMPORTANT MUST ATTENTION — NO EXCEPTIONS after completing this skill, you MUST ATTENTION use AskUserQuestion to present these options. Do NOT skip because the task seems "simple" or "obvious" — the user decides:
- "Proceed with full workflow (Recommended)" — I'll detect the best workflow to continue from here (feature implemented). This ensures review, testing, and docs steps aren't skipped.
- "/code-simplifier" — Simplify and clean up implementation
- "/workflow-review-changes" — Review changes before commit
- "Skip, continue manually" — user decides
Standalone Review Gate (Non-Workflow Only)
MANDATORY IMPORTANT MUST ATTENTION: If this skill is called outside a workflow (standalone
/cook), you MUST ATTENTION create aTaskCreatetodo task for/review-changesas the last task in your task list. This ensures all changes are reviewed before commit even without a workflow enforcing it.If already running inside a workflow (e.g.,
feature,bugfix), skip this — the workflow sequence handles/review-changesat the appropriate step.
Closing Reminders
MANDATORY IMPORTANT MUST ATTENTION break work into small todo tasks using TaskCreate BEFORE starting.
MANDATORY IMPORTANT MUST ATTENTION validate decisions with user via AskUserQuestion — never auto-decide.
MANDATORY IMPORTANT MUST ATTENTION add a final review todo task to verify work quality.
MANDATORY IMPORTANT MUST ATTENTION READ the following files before starting:
-
MANDATORY IMPORTANT MUST ATTENTION verify all phases pass 5-point granularity check. Failing phases → sub-plan. "Can I start coding RIGHT NOW?" <!-- /SYNC:plan-granularity:reminder -->
<!-- SYNC:understand-code-first:reminder --> -
MANDATORY IMPORTANT MUST ATTENTION search 3+ existing patterns and read code BEFORE any modification. Run graph trace when graph.db exists.
<!-- /SYNC:understand-code-first:reminder --> <!-- SYNC:plan-quality:reminder --> -
MANDATORY IMPORTANT MUST ATTENTION include
<!-- /SYNC:plan-quality:reminder --> <!-- SYNC:rationalization-prevention:reminder -->## Test Specificationswith TC IDs per phase. CallTaskListbefore creating new tasks. -
MANDATORY IMPORTANT MUST ATTENTION follow ALL steps regardless of perceived simplicity. "Too simple to plan" is an evasion, not a reason.
<!-- /SYNC:rationalization-prevention:reminder --> <!-- SYNC:ui-system-context:reminder --> -
MANDATORY IMPORTANT MUST ATTENTION read frontend-patterns-reference, scss-styling-guide, design-system/README before any UI change.
<!-- /SYNC:ui-system-context:reminder --> <!-- SYNC:iterative-phase-quality:reminder --> -
MANDATORY IMPORTANT MUST ATTENTION score complexity first. Score >=6 → decompose. Each phase: plan → implement → review → fix → verify. No skipping.
<!-- /SYNC:iterative-phase-quality:reminder --> <!-- SYNC:graph-assisted-investigation:reminder --> -
MANDATORY IMPORTANT MUST ATTENTION run at least ONE graph command on key files when graph.db exists. Pattern: grep → graph trace → grep verify.
<!-- /SYNC:graph-assisted-investigation:reminder -->