Detailed development workflow for this repository. Referenced from CLAUDE.md.
After auto-compact or session continuation, ALWAYS read the relevant documentation files before continuing work:
- Read
docs/IMPLEMENTATION_PLAN.mdfor current progress - Read
docs/CHANGELOG.mdfor recent changes - Read
docs/DECISIONS.mdfor prior feature requests and user decisions - Read any package-specific documentation relevant to the task
This ensures continuity and prevents duplicated or missed work.
Scope (Q/S/P) is auto-detected by /done based on branch, diff size, and plan state. Do not classify manually upfront.
| Scope | When detected | Examples |
|---|---|---|
| Q (Quick) | On main/master, <=3 files, <100 lines | Typo fix, config tweak, one-liner bug fix |
| S (Standard) | On feature branch, no active plan phases | New feature, multi-file refactor, bug requiring investigation |
| P (Project) | IMPLEMENTATION_PLAN.md has unchecked phases | Multi-phase feature, architectural change, large migration |
Run /sync before starting any work. It fetches remote refs, reports branch state, dirty files, ahead/behind counts, and recent commits.
- Fix it -- make the change
- Validate -- run
uv run ruff check . && uv run ruff format --check . && uv run pytest - Commit and push -- push directly to the base branch (
main/master) - Verify CI -- run
gh run watchto confirm the triggered run passes
If branch protection is enabled: after step 2, push to a short-lived branch, run gh pr create --fill && gh pr checks --watch, merge, and delete the branch.
If the fix fails twice, reveals unexpected complexity, or CI fails, promote to S.
S.1 Explore -- Read relevant code and tests. Identify patterns/utilities to reuse. Understand scope.
S.2 Plan -- Read docs/DECISIONS.md. Check for conflicts with prior decisions; if a conflict is found, present the contradiction to the user before proceeding. Design approach. Identify files to modify. Log the feature request and any user decisions.
S.3 Setup -- Create feature branch from the base branch (fix/..., feat/..., refactor/...).
S.4 Build (TDD cycle)
- Create code structure (interfaces, types)
- Write tests
- Write implementation
- Write docstrings for public APIs; record non-trivial decisions in
docs/IMPLEMENTATION_PLAN.md - Iterate (back to step 2 if needed)
S.5 Validate -- run both in parallel via agents:
| Agent | File | What it does |
|---|---|---|
| Code Quality | .claude/agents/code-quality-validator.md |
Lint, format, type check (auto-fixes) |
| Test Coverage | .claude/agents/test-coverage-validator.md |
Run tests, check coverage |
Pre-commit hygiene (before agents): no leftover TODO/FIXME/HACK, no debug prints, no hardcoded secrets.
All agents use subagent_type: "general-purpose". Do NOT use feature-dev:code-reviewer.
S.6 Ship
- Commit and push
- Create PR (use
.claude/agents/pr-writer.mdagent to generate description) - Verify CI with
gh pr checks - Wait for automated reviewer (e.g., CodeRabbit). When comments arrive, use
.claude/agents/review-responder.mdto triage and fix. Push fixes before proceeding. - Code review: use
.claude/agents/code-reviewer.mdagent. Fix Critical issues before merge. - Update the PR test plan -- check off completed items, add results for any manual verification steps. Do this after every push to the PR branch, not just at the end.
S.7 Document -- Update docs/CHANGELOG.md with user-facing changes and docs/DECISIONS.md with decisions made. Use .claude/agents/docs-updater.md to verify.
On failure: fix the issue, amend or re-commit, re-run from the failed step. If multiple steps fail repeatedly, reassess scope.
| Failure | Action |
|---|---|
| Validation (S.5) fails on current code | Fix, amend commit, re-run from S.5 |
| CI (S.6.3) fails on current code | Fix, push, re-run from S.6.3 |
| CI fails on pre-existing issue | Document separately, do not block current work |
| Code review flags architectural concern | Pause. Evaluate rework (back to S.4) vs. follow-up issue |
| Acceptance criteria (P.3.2) reveals previous phase regression | File as separate issue. Fix in current phase only if it's a direct regression |
| Multiple steps fail repeatedly | Stop. Reassess scope -- may need to split into smaller increments |
Run /landed after a PR is merged. It verifies merge CI, optionally checks
deployments (via .claude/deploy.json), cleans up branches, and identifies the
next phase for P-scope work.
P.1 Analyze
- Explore codebase architecture and boundaries
- Read
docs/IMPLEMENTATION_PLAN.md,docs/CHANGELOG.md, anddocs/DECISIONS.mdfor prior decisions - Consistency check: scan
docs/DECISIONS.mdfor conflicts or obsolete entries. Prune stale decisions. If conflicts found, present the contradiction to the user before proceeding.
P.2 Plan
- Design approach and write implementation plan in
docs/IMPLEMENTATION_PLAN.md - Define phases with acceptance criteria
P.3 Execute (repeat per phase)
- Run Standard Path (S.1 through S.7) for the phase
- Verify acceptance criteria (use
.claude/agents/acceptance-criteria-validator.md) - Update
docs/IMPLEMENTATION_PLAN.md(use.claude/agents/implementation-tracker.mdor built-inPlanagent) - Write phase handoff note (2-5 sentences: what completed, deviations, risks, dependencies, intentional debt)
P.4 Finalize -- Merge. Version bump and changelog consolidation if applicable.
All custom agents are in .claude/agents/ and use subagent_type: "general-purpose".
| Step | Agent File | Purpose |
|---|---|---|
| S.5 | code-quality-validator.md |
Lint, format, type check |
| S.5 | test-coverage-validator.md |
Tests and coverage |
| S.6.2 | pr-writer.md |
Generate PR description |
| S.6.4 | review-responder.md |
Handle automated reviewer comments |
| S.6.5 | code-reviewer.md |
Independent code review |
| S.7 | docs-updater.md |
Verify and update documentation |
| P.3.2 | acceptance-criteria-validator.md |
Verify acceptance criteria |
| P.3.3 | implementation-tracker.md |
Verify plan matches reality |
| -- | agent-auditor.md |
Audit agent definitions against best practices |
| -- | security-auditor.md |
OWASP-based security analysis (read-only) |
| -- | refactoring-specialist.md |
SOLID/code smell analysis (read-only) |
| -- | output-evaluator.md |
LLM-as-Judge quality scoring |
5 hook scripts in .claude/hooks/ run automatically via settings.json:
| Hook | Event | Matcher | Behavior |
|---|---|---|---|
dangerous-actions-blocker.sh |
PreToolUse | Bash | Blocks rm -rf, sudo, DROP DATABASE, git push --force, secrets in args. Exit 2 = block. |
unicode-injection-scanner.sh |
PreToolUse | Edit|Write | Blocks zero-width chars, RTL overrides, ANSI escapes, null bytes, tag chars. Exit 2 = block. |
output-secrets-scanner.sh |
PostToolUse | Bash | Scans output for AWS/Anthropic/OpenAI/GitHub keys, JWTs, private keys, DB URLs. Warns via systemMessage. |
auto-format.sh |
PostToolUse | Edit|Write | Runs uv run ruff format and uv run ruff check --fix on edited .py files. Synchronous. |
test-on-change.sh |
PostToolUse | Edit|Write | Discovers and runs associated test file. Informational (systemMessage on failure). |
All hooks require jq for JSON parsing and degrade gracefully if jq is missing.
3 slash commands in .claude/commands/:
| Command | Purpose |
|---|---|
/cove |
Chain-of-Verification (CoVe) for high-stakes accuracy. 4-step process: generate baseline, plan verifications, verify from source, produce corrected response. |
/cove-isolated |
Isolated CoVe variant. Verification step runs in a separate agent that cannot see the baseline response, preventing confirmation bias. |
/security-audit |
6-phase Python security scan (deps, secrets, code patterns, input validation, config, scoring). Outputs A-F grade. |
5 skills in .claude/skills/:
| Skill | Purpose |
|---|---|
/sync |
Pre-flight workspace sync. Fetches remote, reports branch state, dirty files, ahead/behind, recent commits. |
/design |
Crystallize brainstorming into a structured plan. Reads DECISIONS.md for conflicts, auto-classifies scope, outputs actionable plan. |
/done |
Universal completion. Auto-detects scope (Q/S/P), validates (3-tier checklist), ships/lands/delivers, updates docs. Absorbs former /ship. |
/landed |
Post-merge lifecycle. Verifies merge CI, optional deployment checks, cleans up branches, prepares next phase. |
/edit-permissions |
Manage Claude Code permission rules in settings.json. Pattern syntax reference and safety guardrails. |
4 review rules in .claude/rules/ auto-loaded as project context:
| Rule | Focus |
|---|---|
architecture-review.md |
System design, dependencies, data flow, security boundaries |
code-quality-review.md |
DRY, error handling, type annotations, complexity |
performance-review.md |
N+1 queries, memory, caching, algorithmic complexity |
test-review.md |
Coverage gaps, test quality, edge cases, assertion quality |
These cover what linters cannot: architecture, design, and logic-level concerns.
Use Keep a Changelog format. Sections: Added, Changed, Deprecated, Removed, Fixed, Migration.
Entries must describe user impact, not just name the change:
- Good: "Users can now filter results by date range using
--sinceand--untilflags" - Bad: "Added date filter"
Update changelog for every MINOR or MAJOR version bump. Patch updates are optional.
When the user says "PCC" or "PCC now", run /done (which executes Validate, Ship/Land/Deliver, and Document).