This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
A Code Review Plugin for Claude Code that enables generalist software engineers to extend their review capability across Architecture, Security, Site Reliability Engineering (SRE), and Data Engineering disciplines. The plugin provides slash commands (donkey-review:all, donkey-review:sre, donkey-review:security, donkey-review:architecture, donkey-review:data) that perform domain-specific code reviews with progressive level reporting.
- Use British English.
- One sentence per line.
- One line per sentence.
- Headings have blank line under them
- Ordered and unordered lists have a blank line before and after them
All non-trivial work is organised in three levels:
Milestone → The deliverable (what stakeholders care about)
└── Issue → A phase of work producing a reviewable, mergeable unit (1 Issue = 1 PR)
└── Task → An atomic unit a stateless agent can complete in one turn
Example:
Milestone: "Donkey-Review Plugin v1"
├── Issue #1: Create SRE code review → PR: feat/sre-domain → closes #1
│ ├── TASK-01: Create SRE base prompt
│ ├── TASK-02: Create SRE Response agent
│ └── ...
├── Issue #2: Create Security code review → PR: feat/security-domain → closes #2
├── Issue #3: Create Architecture code review
├── Issue #4: Create Data code review
└── Issue #5: Create comprehensive review → PR: feat/donkey-review-all → closes #5
plan/{milestone-name}/
├── BRIEF.md ← Milestone-level brief: the what and why (transient)
└── tasks/
├── 01-{issue-name}.tasks.md ← Task list for Issue #1
├── 02-{issue-name}.tasks.md ← Task list for Issue #2
└── ... ← One file per Issue
Each task file maps to exactly one GitHub Issue and one PR. The execution loop runs against one task file at a time.
Work follows three phases with hard gates between them. You MUST NOT skip phases or combine them.
Trigger: User asks you to plan, design, or implement a feature. Constraint: Do NOT write implementation code. Do NOT create feature branches. Only produce planning artifacts.
- Follow the Socratic elicitation process in
PLAN.prompt.mdStep 2 — ask clarifying questions until requirements are clear - Create a GitHub Milestone for the work
- Write
plan/{milestone-name}/BRIEF.md— the what and why for the whole milestone (transient planning brief, not a permanent spec) - Write one task file per issue in
plan/{milestone-name}/tasks/{NN}-{issue-name}.tasks.md - Create GitHub Issues (one per task file), linked to the Milestone
- STOP. Tell the user: "Planning complete. Review the milestone, issues, and task files. When ready, use EXECUTE.prompt.md to begin implementation."
What planning produces:
plan/{milestone-name}/BRIEF.md— milestone-level planning briefplan/{milestone-name}/tasks/*.tasks.md— one task file per issue- GitHub Milestone with linked Issues
- NO code, NO feature branches, NO file changes outside
plan/
Trigger: User invokes the execution prompt (see EXECUTE.prompt.md) for a specific task file.
Constraint: Only work on the next unchecked task in the specified task file. Do NOT skip ahead. Do NOT work across issues.
- Read the specified task file (e.g.,
plan/{milestone}/tasks/01-sre.tasks.md) - Find the next unchecked
- [ ]task - Read the task's brief references
- Execute the task (create branch from base branch if first task in this issue, write code, verify)
- Mark the task
- [x]in the task file - STOP. Report what was done. The next invocation picks up the next task.
Trigger: All tasks in a task file are [x].
Action: Create a stacked PR targeting the base branch (the preceding issue's branch, or main for the first issue), referencing the GitHub Issue.
The user then moves to the next task file (next issue) or reviews the PR first. When the base PR merges, GitHub automatically retargets the stacked PR.
Trigger: All issues in the milestone are closed and all PRs merged. Action: Close out the milestone — update specs, clean up plan artifacts, close the GitHub Milestone.
- Verify all milestone issues are closed and PRs merged
- Update
spec/to capture what was learned:- New patterns — implementation patterns not yet in any spec
- Decision rationale — why key design choices were made (trade-offs, alternatives considered, constraints)
- Divergences — where implementation intentionally departed from the original spec (update spec to match reality)
- New vocabulary — terms coined during implementation, added to relevant glossary
- No speculation — only document what was actually built
- Update
spec/README.md— ensure every spec file has an entry with title and one-line description - Commit, push, and create a final PR
scripts/execute-milestone.shhandles the remaining cleanup automatically after all close-out tasks complete:- Delete
plan/{milestone-name}/directory — the close-out task file lives inside it, so the agent cannot delete it during execution - Close the GitHub Milestone via the
ghCLI
- Delete
- Context windows are finite. Plans held only in memory are lost on compaction. Plans in files survive.
- Stateless agents. Each execution reads state from files, not from conversation history.
- Reviewable. The user can review, edit, and reorder tasks before execution begins.
- Right-sized PRs. One PR per issue is reviewable. One PR per milestone is not.
- Reproducible. Given the same BRIEF.md and task files, the work can be re-executed.
- Plans are transient, specs are permanent. Plans drive execution; specs capture the lasting knowledge. After a milestone completes, learnings migrate to
spec/and the plan directory is deleted.
- Always use relative paths from the repo root when running scripts or referencing project files in Bash commands (e.g.
./scripts/compile.sh, not/Users/foo/project/scripts/compile.sh). Absolute paths break portability across machines, worktrees, and containers. Bash permissions in.claude/settings.jsonare defined with relative path patterns — absolute paths will be denied. - Never use
cdbefore running a script — Bash permissions match the command prefix, socd foo && ./bar.shis denied even if./foo/bar.shis allowed. Instead ofcd plugins/donkey-review && ./scripts/compile.sh, use./plugins/donkey-review/scripts/compile.sh. This is critical indontAskpermission mode where denials are silent.
- Never commit directly to
main— pre-commit and pre-push hooks enforce this - Create feature branches:
git checkout -b feat/<description> - Push feature branches and create PRs against
main. Prefergit checkout -b <branch> <base>to carry uncommitted work to a new branch; avoid usinggit stashif possible. - Branch naming convention:
feat/,fix/,chore/prefixes - One branch per issue. Each task file declares its branch name. All tasks within an issue are committed to the same branch.
When planning work:
- Create GitHub Milestones for large pieces of work e.g. "Comprehensive Code Review Claude Plugin", "Threat Modelling Plugin", "Resilience Modelling Plugin" etc.
- Create GitHub Issues to define specific outcomes related to a Milestone
- If the work is not large enough for its own Milestone, ask which milestone it should belong to, or create a "v next" milestone
- Once planning is complete, the plan lives in
plan/{milestone-name}/— NOT in conversation memory - Use
PLAN.prompt.mdto guide the Socratic elicitation and artifact generation process
IMPORTANT: Before implementing any feature, consult the specifications in spec/README.md.
- Assume NOT implemented. Many specs describe planned features that may not yet exist in the codebase.
- Check the codebase first. Before concluding something is or isn't implemented, search the actual code. Specs describe intent; code describes reality.
- Use specs as guidance. When implementing a feature, follow the design patterns, types, and architecture defined in the relevant spec.
- Spec index:
spec/README.mdlists all specifications organized by category.