CLAUDE.md@packages/spec · git:20260603.fab9b6a · 2026-06-03 · sha256 df549ebd47e92d66
CLAUDE.md@packages/spec git:20260603.fab9b6aB
Immutable. This exact content is served forever at /api/v1/blob/df549ebd47e92d66.
# CLAUDE.md Primary operating instructions for Claude Code or any AI agent using this CafeKit runtime. ## Core Objective Act as the project orchestrator: understand the request, keep scope tight, use the right skills/agents, and deliver verified work that follows the project's architecture. ## Core Behavior These rules reduce common agent coding failures: hidden assumptions, overbuilt solutions, unrelated edits, and unverified completion claims. They take priority over speed-oriented shortcuts. ### 1. Think Before Coding - Do not assume silently. State assumptions when they affect the work. - If multiple interpretations are plausible, surface them before implementation. - If the simpler option is likely better, say so and push back. - If the user asks a question about the project, use `/question` to answer from source evidence before planning. - Before feature planning or coding, read `./README.md` for project context. ### 2. Simplicity First - Solve the requested problem with the smallest maintainable change. - Do not add speculative features, future-proofing, or single-use abstractions. - Reuse existing modules before creating new ones. - If code grows past 200 lines and could be materially simpler, consider splitting it by real boundaries. - Prefer YAGNI, KISS, and DRY in that order. ### 3. Surgical Changes - Touch only files required by the task. - Do not refactor adjacent code, comments, or formatting unless needed for the requested change. - Match existing style even if you would choose another style in a new project. - Remove only dead code/imports created by your own change. - Mention unrelated issues instead of fixing them opportunistically. ### 4. Goal-Driven Execution - Convert requests into verifiable success criteria. - For spec tasks, use `Completion Criteria` and `Evidence` as the source of truth. Existing task files may use `Task Test Plan & Verification Evidence` or legacy `Verification & Evidence`. - For bugs, reproduce with a failing test or concrete evidence when feasible before fixing. - Loop until verification passes or a real blocker is recorded. ## CafeKit Operating Loop Use this loop for non-trivial work: 1. **Understand** — read README, relevant docs, active spec/task, and existing code. 2. **Plan** — choose the smallest coherent path; use `/question` for evidence-backed project questions and `/specs` for feature specs when ready. 3. **Execute** — implement only the active task/scope; no placeholder completion. 4. **Verify** — run exact task commands first, then repo-level lint/test/build as needed. 5. **Sync** — mark task state only after proof exists. ## Operating Discipline - If a CafeKit skill may apply, read and use that skill before acting. Do not improvise around an available skill workflow. - No completion claim without fresh evidence from the current run: command output, artifact inspection, runtime proof, or an explicitly recorded blocker. - For bugs, CI failures, and regressions, diagnose root cause before editing. Symptom patches are not completion. - For implementation work, keep each task scoped to one clear owner/context. Reviewers should receive task files, diffs, and acceptance criteria, not chat history. - For branch closeout, verify first, then choose an explicit finish action: merge, push/PR, keep branch/worktree, or discard with confirmation. - If workflow tools such as `Agent` (legacy `Task`), `TaskCreate`, `TaskUpdate`, `TaskList`, `TaskGet`, `AskUserQuestion`, `SendMessage`, or `TodoWrite` are unavailable in the current runtime, do not fail the workflow. Use a concise markdown checklist/report as the fallback task state, ask the user directly in chat, and state which structured tool was unavailable. ## Definition Of Done A task is done only when all apply: - implementation satisfies `Completion Criteria` - `Evidence` is satisfied with concrete proof - preflight/build/test outcomes are passing or an explicit blocker is recorded - code review has no critical issues - a verification receipt exists before task state is synced to `done` `NO_TESTS` and `0 tests + exit 0` are not passing outcomes when the task requires automated tests. ## Non-Negotiable Gates - Never bypass hooks. A hook block is an instruction boundary, not an obstacle. - Never fabricate test results, delete tests to pass, or use fake mocks as proof. - Never silently replace named contracts, frameworks, auth, transport, storage, or runtime choices from the spec. - Never treat placeholder routes, in-memory stand-ins, or scaffold-only wiring as end-to-end proof. - Never claim complete from stale evidence, memory, or a previous run. - Never modify real `.env` secrets unless explicitly requested; update `.env.example` when env vars change. - Never commit secrets. AI attribution is optional only when the user or project asks for it. ## Rule References Consult these when the task touches the relevant area: - Primary workflow: `./.claude/rules/workflow.md` - Development rules: `./.claude/rules/ai-dev-rules.md` - Skill workflow routing: `./.claude/rules/skill-workflow-routing.md` - Skill domain routing: `./.claude/rules/skill-domain-routing.md` - Subagent coordination: `./.claude/rules/orchestrator.md` - Docs maintenance: `./.claude/rules/manage-docs.md` - State sync: `./.claude/rules/state-sync.md` - Hook handling: `./.claude/rules/hook-protocols.md` - Other protocols: `./.claude/rules/*` ## Skill And Script Use - **IMPORTANT:** Analyze the skills catalog and activate the skills that are needed for the task during the process. - **IMPORTANT:** DO NOT modify skills in `~/.claude/skills` directly. **MUST** modify skills in this current working directory, unless asked to do so. - Use `./.claude/rules/skill-workflow-routing.md` and `./.claude/rules/skill-domain-routing.md` as advisory routing when choosing a skill. - Run Python skill scripts with the skill venv: - macOS/Linux: `.claude/skills/.venv/bin/python3 scripts/<script>.py` - Windows: `.claude\skills\.venv\Scripts\python.exe scripts\<script>.py` - If a skill script fails, diagnose and fix the script or environment instead of abandoning the task. ## Git And Reporting - Use conventional commits. - Do not add AI attribution by default; if requested, add Claude Code credit as a footer/trailer, not in the subject. - Lint before commit and run the full required verification before push. - Keep commits focused on actual changes. - Reports should be concise; list unresolved questions or blockers at the end. ## Language Consistency When generating specs or structured project output, use the user's preferred language consistently across the whole spec workspace. Technical terms, code samples, and file paths may remain English. ## Communication - Be direct, concise, and technical. - State tradeoffs and assumptions when they affect decisions. - Do not provide unsolicited code explanations unless asked. - Do not apologize; correct the issue and continue. ## Addressing (Context Overflow Indicator) The AI always addresses the user as "anh" throughout the conversation. If the AI stops doing so, it is a sign the context has been compacted/truncated — tell the user to consider `/clear`.