claude-code-kit 0.7.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- claude_code_kit-0.7.0.dist-info/METADATA +384 -0
- claude_code_kit-0.7.0.dist-info/RECORD +209 -0
- claude_code_kit-0.7.0.dist-info/WHEEL +4 -0
- claude_code_kit-0.7.0.dist-info/entry_points.txt +4 -0
- claude_code_kit-0.7.0.dist-info/licenses/LICENSE +21 -0
- claude_kit/__init__.py +10 -0
- claude_kit/__main__.py +8 -0
- claude_kit/_payload/agents/acceptance-reviewer.md +60 -0
- claude_kit/_payload/agents/auditor.md +76 -0
- claude_kit/_payload/agents/dependency-scanner.md +84 -0
- claude_kit/_payload/agents/developer.md +187 -0
- claude_kit/_payload/agents/devils-advocate.md +62 -0
- claude_kit/_payload/agents/devops-engineer.md +134 -0
- claude_kit/_payload/agents/e2e-tester.md +152 -0
- claude_kit/_payload/agents/em-reviewer.md +105 -0
- claude_kit/_payload/agents/incident-responder.md +64 -0
- claude_kit/_payload/agents/merge-reviewer.md +194 -0
- claude_kit/_payload/agents/observability-engineer.md +94 -0
- claude_kit/_payload/agents/orchestrator.md +551 -0
- claude_kit/_payload/agents/owasp-reviewer.md +76 -0
- claude_kit/_payload/agents/policy-validator.md +63 -0
- claude_kit/_payload/agents/pr-raiser.md +138 -0
- claude_kit/_payload/agents/risk-classifier.md +50 -0
- claude_kit/_payload/agents/sdlc-code-reviewer.md +196 -0
- claude_kit/_payload/agents/secret-scanner.md +70 -0
- claude_kit/_payload/agents/security-reviewer.md +80 -0
- claude_kit/_payload/agents/senior-backend-dev.md +199 -0
- claude_kit/_payload/agents/senior-frontend-dev.md +181 -0
- claude_kit/_payload/agents/senior-tester.md +206 -0
- claude_kit/_payload/agents/spec-doc-writer.md +331 -0
- claude_kit/_payload/agents/story-planner.md +56 -0
- claude_kit/_payload/agents/technical-architect.md +139 -0
- claude_kit/_payload/agents/tester.md +193 -0
- claude_kit/_payload/agents/ui-designer.md +73 -0
- claude_kit/_payload/agents/unit-tester.md +119 -0
- claude_kit/_payload/catalog/mcp.yaml +54 -0
- claude_kit/_payload/catalog/org.yaml +145 -0
- claude_kit/_payload/catalog/profiles.yaml +96 -0
- claude_kit/_payload/catalog/stacks.yaml +96 -0
- claude_kit/_payload/commands/init.md +36 -0
- claude_kit/_payload/commands/sdlc.md +18 -0
- claude_kit/_payload/commands/status.md +20 -0
- claude_kit/_payload/hooks/hooks.json +58 -0
- claude_kit/_payload/hooks/scripts/audit-log.sh +18 -0
- claude_kit/_payload/hooks/scripts/guard-secrets.sh +26 -0
- claude_kit/_payload/hooks/scripts/lint-fix.sh +38 -0
- claude_kit/_payload/hooks/scripts/load-continuity.sh +32 -0
- claude_kit/_payload/hooks/scripts/load-learnings.sh +40 -0
- claude_kit/_payload/hooks/scripts/type-check.sh +23 -0
- claude_kit/_payload/hooks/scripts/validate-frontmatter.sh +34 -0
- claude_kit/_payload/hooks/scripts/validate-settings.sh +21 -0
- claude_kit/_payload/hooks/scripts/warn-large-edits.sh +24 -0
- claude_kit/_payload/hooks/scripts/warn-missing-tests.sh +24 -0
- claude_kit/_payload/hooks/scripts/warn-sensitive-files.sh +30 -0
- claude_kit/_payload/hooks/scripts/warn-shared-modules.sh +33 -0
- claude_kit/_payload/rules/agent-guardrails.md +83 -0
- claude_kit/_payload/rules/agent-memory.md +106 -0
- claude_kit/_payload/rules/agent-resilience.md +61 -0
- claude_kit/_payload/rules/autonomy-levels.md +30 -0
- claude_kit/_payload/rules/code-organization.md +312 -0
- claude_kit/_payload/rules/continuity.md +84 -0
- claude_kit/_payload/rules/design-patterns.md +422 -0
- claude_kit/_payload/rules/devops-observability.md +57 -0
- claude_kit/_payload/rules/documentation.md +326 -0
- claude_kit/_payload/rules/evals.md +62 -0
- claude_kit/_payload/rules/frontend-best-practices.md +157 -0
- claude_kit/_payload/rules/goal-setting-and-monitoring.md +72 -0
- claude_kit/_payload/rules/human-in-the-loop.md +64 -0
- claude_kit/_payload/rules/linting-and-formatting.md +220 -0
- claude_kit/_payload/rules/mandatory-workflow.md +309 -0
- claude_kit/_payload/rules/model-tiers.md +34 -0
- claude_kit/_payload/rules/quality-gates.md +107 -0
- claude_kit/_payload/rules/rarv-cycle.md +31 -0
- claude_kit/_payload/rules/reasoning-techniques.md +62 -0
- claude_kit/_payload/rules/responsive-and-accessibility.md +353 -0
- claude_kit/_payload/rules/risk-classification.md +36 -0
- claude_kit/_payload/rules/testing.md +417 -0
- claude_kit/_payload/rules/tool-design.md +66 -0
- claude_kit/_payload/skills/_references/accessibility-checklist.md +160 -0
- claude_kit/_payload/skills/_references/orchestration-patterns.md +405 -0
- claude_kit/_payload/skills/_references/performance-checklist.md +153 -0
- claude_kit/_payload/skills/_references/security-checklist.md +134 -0
- claude_kit/_payload/skills/_references/testing-patterns.md +236 -0
- claude_kit/_payload/skills/accessibility-review/SKILL.md +56 -0
- claude_kit/_payload/skills/api-and-interface-design/SKILL.md +294 -0
- claude_kit/_payload/skills/api-integration/SKILL.md +348 -0
- claude_kit/_payload/skills/archive-sprint/SKILL.md +31 -0
- claude_kit/_payload/skills/backlog/SKILL.md +41 -0
- claude_kit/_payload/skills/backlog/item-template.md +20 -0
- claude_kit/_payload/skills/browser-testing-with-devtools/SKILL.md +302 -0
- claude_kit/_payload/skills/ci-cd-and-automation/SKILL.md +402 -0
- claude_kit/_payload/skills/code-review-and-quality/SKILL.md +347 -0
- claude_kit/_payload/skills/code-simplification/SKILL.md +331 -0
- claude_kit/_payload/skills/component-design/SKILL.md +171 -0
- claude_kit/_payload/skills/consolidate-learnings/SKILL.md +55 -0
- claude_kit/_payload/skills/context-engineering/SKILL.md +321 -0
- claude_kit/_payload/skills/debugging-and-error-recovery/SKILL.md +300 -0
- claude_kit/_payload/skills/decision/SKILL.md +46 -0
- claude_kit/_payload/skills/decision/adr-template.md +36 -0
- claude_kit/_payload/skills/deprecation-and-migration/SKILL.md +207 -0
- claude_kit/_payload/skills/documentation-and-adrs/SKILL.md +299 -0
- claude_kit/_payload/skills/doubt-driven-development/SKILL.md +243 -0
- claude_kit/_payload/skills/execute/SKILL.md +27 -0
- claude_kit/_payload/skills/frontend-ui-engineering/SKILL.md +328 -0
- claude_kit/_payload/skills/git-workflow-and-versioning/SKILL.md +300 -0
- claude_kit/_payload/skills/idea-refine/SKILL.md +178 -0
- claude_kit/_payload/skills/idea-refine/examples.md +238 -0
- claude_kit/_payload/skills/idea-refine/frameworks.md +99 -0
- claude_kit/_payload/skills/idea-refine/refinement-criteria.md +113 -0
- claude_kit/_payload/skills/idea-refine/scripts/idea-refine.sh +15 -0
- claude_kit/_payload/skills/incident-postmortem/SKILL.md +74 -0
- claude_kit/_payload/skills/incremental-implementation/SKILL.md +245 -0
- claude_kit/_payload/skills/interview-me/SKILL.md +221 -0
- claude_kit/_payload/skills/load-testing/SKILL.md +83 -0
- claude_kit/_payload/skills/manual-test/SKILL.md +516 -0
- claude_kit/_payload/skills/performance-optimization/SKILL.md +277 -0
- claude_kit/_payload/skills/planning-and-task-breakdown/SKILL.md +223 -0
- claude_kit/_payload/skills/playwright-verification/SKILL.md +205 -0
- claude_kit/_payload/skills/refresh-docs/SKILL.md +63 -0
- claude_kit/_payload/skills/remember/SKILL.md +96 -0
- claude_kit/_payload/skills/scope/SKILL.md +52 -0
- claude_kit/_payload/skills/scope/scope-template.md +82 -0
- claude_kit/_payload/skills/sdlc/SKILL.md +83 -0
- claude_kit/_payload/skills/security-and-hardening/SKILL.md +368 -0
- claude_kit/_payload/skills/security-verification/SKILL.md +209 -0
- claude_kit/_payload/skills/shipping-and-launch/SKILL.md +309 -0
- claude_kit/_payload/skills/smoke-test/SKILL.md +78 -0
- claude_kit/_payload/skills/source-driven-development/SKILL.md +195 -0
- claude_kit/_payload/skills/spec-driven-development/SKILL.md +200 -0
- claude_kit/_payload/skills/sprint/SKILL.md +67 -0
- claude_kit/_payload/skills/sprint/sprint-template.md +90 -0
- claude_kit/_payload/skills/test-driven-development/SKILL.md +383 -0
- claude_kit/_payload/skills/threat-model/SKILL.md +60 -0
- claude_kit/_payload/skills/triage/SKILL.md +87 -0
- claude_kit/_payload/skills/ui-ux-design/SKILL.md +71 -0
- claude_kit/_payload/skills/unit-test/SKILL.md +237 -0
- claude_kit/_payload/skills/using-agent-skills/SKILL.md +180 -0
- claude_kit/_payload/templates/CLAUDE.md +238 -0
- claude_kit/_payload/templates/CLAUDE.stack.md.tmpl +53 -0
- claude_kit/_payload/templates/CONTINUITY.template.md +35 -0
- claude_kit/_payload/templates/README.claude-sdlc.md.tmpl +219 -0
- claude_kit/_payload/templates/agent-memory/MEMORY.md +30 -0
- claude_kit/_payload/templates/agent-memory/api/.gitkeep +0 -0
- claude_kit/_payload/templates/agent-memory/architecture/.gitkeep +0 -0
- claude_kit/_payload/templates/agent-memory/debugging/.gitkeep +0 -0
- claude_kit/_payload/templates/agent-memory/gotchas/.gitkeep +0 -0
- claude_kit/_payload/templates/agent-memory/patterns/.gitkeep +0 -0
- claude_kit/_payload/templates/agent-memory/performance/.gitkeep +0 -0
- claude_kit/_payload/templates/artifacts/adr.md +18 -0
- claude_kit/_payload/templates/artifacts/feature-spec.md +29 -0
- claude_kit/_payload/templates/artifacts/release-plan.md +23 -0
- claude_kit/_payload/templates/artifacts/runbook.md +24 -0
- claude_kit/_payload/templates/artifacts/security-review.md +23 -0
- claude_kit/_payload/templates/artifacts/test-plan.md +22 -0
- claude_kit/_payload/templates/org/README.md +53 -0
- claude_kit/_payload/templates/org/agents/data-workflow-agent.md +59 -0
- claude_kit/_payload/templates/org/agents/founder-prototype-agent.md +61 -0
- claude_kit/_payload/templates/org/agents/internal-tools-builder.md +63 -0
- claude_kit/_payload/templates/org/agents/pm-copilot.md +60 -0
- claude_kit/_payload/templates/org/agents/support-ticket-engineer.md +63 -0
- claude_kit/_payload/templates/org/packs/devops-and-release/README.md +46 -0
- claude_kit/_payload/templates/org/packs/devops-and-release/pack.yaml +32 -0
- claude_kit/_payload/templates/org/packs/engineering-core/README.md +46 -0
- claude_kit/_payload/templates/org/packs/engineering-core/pack.yaml +44 -0
- claude_kit/_payload/templates/org/packs/non-engineer-builder/README.md +53 -0
- claude_kit/_payload/templates/org/packs/non-engineer-builder/pack.yaml +39 -0
- claude_kit/_payload/templates/org/packs/onboarding-and-docs/README.md +49 -0
- claude_kit/_payload/templates/org/packs/onboarding-and-docs/pack.yaml +26 -0
- claude_kit/_payload/templates/org/packs/product-to-code/README.md +50 -0
- claude_kit/_payload/templates/org/packs/product-to-code/pack.yaml +34 -0
- claude_kit/_payload/templates/org/packs/quality-and-review/README.md +53 -0
- claude_kit/_payload/templates/org/packs/quality-and-review/pack.yaml +40 -0
- claude_kit/_payload/templates/org/packs/security-and-compliance/README.md +50 -0
- claude_kit/_payload/templates/org/packs/security-and-compliance/pack.yaml +36 -0
- claude_kit/_payload/templates/org/rules/ai-working-agreement.md +45 -0
- claude_kit/_payload/templates/org/rules/ambiguity-resolution.md +36 -0
- claude_kit/_payload/templates/org/rules/branch-and-pr-policy.md +41 -0
- claude_kit/_payload/templates/org/rules/compliance-policy.md +50 -0
- claude_kit/_payload/templates/org/rules/non-engineer-safe-coding.md +37 -0
- claude_kit/_payload/templates/org/rules/pii-policy.md +46 -0
- claude_kit/_payload/templates/org/rules/production-data-policy.md +35 -0
- claude_kit/_payload/templates/org/rules/prompt-to-task-conversion.md +30 -0
- claude_kit/_payload/templates/org/rules/prototype-boundaries.md +40 -0
- claude_kit/_payload/templates/org/rules/secrets-policy.md +34 -0
- claude_kit/_payload/templates/org/skills/customer-issue-to-fix/SKILL.md +61 -0
- claude_kit/_payload/templates/org/skills/feature-from-idea/SKILL.md +56 -0
- claude_kit/_payload/templates/org/skills/prompt-to-safe-task/SKILL.md +59 -0
- claude_kit/_payload/templates/org/skills/prototype-to-production/SKILL.md +61 -0
- claude_kit/_payload/templates/org/skills/repo-onboarding/SKILL.md +60 -0
- claude_kit/_payload/templates/settings.json +53 -0
- claude_kit/_payload/templates/stacks/backend/python/fastapi/rules/fastapi-patterns.md +64 -0
- claude_kit/_payload/templates/stacks/db/mongodb/agents/migration-specialist.md +61 -0
- claude_kit/_payload/templates/stacks/db/mongodb/agents/mongodb-specialist.md +59 -0
- claude_kit/_payload/templates/stacks/db/mongodb/rules/mongodb-patterns.md +39 -0
- claude_kit/_payload/templates/stacks/db/postgres/agents/db-performance-reviewer.md +66 -0
- claude_kit/_payload/templates/stacks/db/postgres/agents/migration-specialist.md +56 -0
- claude_kit/_payload/templates/stacks/db/postgres/agents/postgres-specialist.md +58 -0
- claude_kit/_payload/templates/stacks/db/postgres/rules/database-performance.md +64 -0
- claude_kit/_payload/templates/stacks/db/postgres/rules/postgres-patterns.md +43 -0
- claude_kit/_payload/templates/stacks/frontend/react/rules/react-patterns.md +63 -0
- claude_kit/catalog.py +476 -0
- claude_kit/cli.py +327 -0
- claude_kit/hooks.py +246 -0
- claude_kit/models.py +205 -0
- claude_kit/prompts.py +209 -0
- claude_kit/render.py +146 -0
- claude_kit/scaffold.py +492 -0
- claude_kit/upgrader.py +294 -0
- claude_kit/validator.py +197 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: customer-issue-to-fix
|
|
3
|
+
description: Use when a support engineer has a customer or support issue and wants it turned into a reproducible bug report, the likely code paths identified, a fix proposal, and a validation checklist — routed through triage, debugging, and the engineering pipeline with a human approval gate before any code is changed. Reproduce → locate → propose → validate.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Customer Issue to Fix
|
|
7
|
+
|
|
8
|
+
Turn a customer or support ticket into a reproducible bug report, the suspected code paths, a fix
|
|
9
|
+
proposal, and a validation checklist — routed into the engineering pipeline without the requester
|
|
10
|
+
needing to write code.
|
|
11
|
+
|
|
12
|
+
**Risk tier:** medium by default; **high/restricted** if the issue or fix touches a sensitive area
|
|
13
|
+
(auth, payments, secrets, production data, migrations, PII). See `.claude/rules/risk-classification.md`.
|
|
14
|
+
|
|
15
|
+
## When to use
|
|
16
|
+
A support engineer has a customer complaint — "customer cannot export invoices over 10MB" — and wants
|
|
17
|
+
it reproduced, diagnosed, and fixed through the normal pipeline rather than hot-patched.
|
|
18
|
+
|
|
19
|
+
## Who should use it
|
|
20
|
+
Support engineers, customer success, operators. Engineers can use it too, but may prefer `/triage`
|
|
21
|
+
and `/debugging-and-error-recovery` directly.
|
|
22
|
+
|
|
23
|
+
## Required inputs
|
|
24
|
+
The reported symptom in the customer's words. Helpful: logs, repro steps, environment, affected accounts.
|
|
25
|
+
|
|
26
|
+
## Ordered questions to ask
|
|
27
|
+
1. What is the **exact symptom**, and what was the customer **expecting** instead?
|
|
28
|
+
2. What are the **repro steps** — and does it fail every time or intermittently?
|
|
29
|
+
3. What's the **environment** (which app/version, region, plan, browser/client)?
|
|
30
|
+
4. Which **accounts/scope** are affected — one, a segment, or everyone?
|
|
31
|
+
5. Do you have **logs, error IDs, or screenshots**, and is any data **sensitive** (PII, production)? → raise the tier.
|
|
32
|
+
|
|
33
|
+
## Agents to delegate to
|
|
34
|
+
`support-ticket-engineer` (shape the bug report and reproduction) → `risk-classifier` (tier it) →
|
|
35
|
+
`orchestrator` (run the fix lane: `developer`, `sdlc-code-reviewer`, `tester`). Use `/triage`,
|
|
36
|
+
`/debugging-and-error-recovery`, and `/test-driven-development` under the hood.
|
|
37
|
+
|
|
38
|
+
## Quality gates
|
|
39
|
+
Reproduction is deterministic (or marked intermittent with conditions); suspected code paths are
|
|
40
|
+
named; fix proposal is scoped with a rollback note; risk tier assigned; **human approval recorded
|
|
41
|
+
before code changes**; a failing test reproduces the bug first; the pipeline's own gates then apply.
|
|
42
|
+
|
|
43
|
+
## Expected outputs
|
|
44
|
+
Reproducible bug report (symptom · steps · environment · scope) · suspected code paths · fix proposal ·
|
|
45
|
+
risk tier · validation checklist · the explicit approval checkpoint. Then (after approval) the fix and
|
|
46
|
+
its regression test via the pipeline.
|
|
47
|
+
|
|
48
|
+
## Stop conditions
|
|
49
|
+
Stop and ask if the issue can't be reproduced, repro steps conflict, scope balloons across systems,
|
|
50
|
+
the fix is high/restricted risk, it needs production data or PII, or it exceeds the active autonomy
|
|
51
|
+
level (`.claude/rules/autonomy-levels.md`).
|
|
52
|
+
|
|
53
|
+
## Example
|
|
54
|
+
```
|
|
55
|
+
/customer-issue-to-fix Customer cannot export invoices over 10MB
|
|
56
|
+
→ asks: exact error? every time? which plan/region? logs/error ID?
|
|
57
|
+
→ reproduces with a >10MB invoice; suspected paths: export handler + size limit
|
|
58
|
+
→ fix proposal: raise/stream the limit; risk: medium (touches export path → confirm)
|
|
59
|
+
→ writes a failing regression test, routes to developer → code reviewer → tester
|
|
60
|
+
→ STOPS for approval before any code is changed
|
|
61
|
+
```
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: feature-from-idea
|
|
3
|
+
description: Use when a PM, founder, or non-engineer describes a feature in plain language and wants it turned into acceptance criteria, user stories, and an implementation plan routed to the engineering agents — with a human approval gate before any code is written. Clarify → scope → plan → approve → build.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Feature from Idea
|
|
7
|
+
|
|
8
|
+
Turn a rough product idea into a reviewable, safely-scoped plan and route it into the engineering
|
|
9
|
+
pipeline — without the requester needing to write code.
|
|
10
|
+
|
|
11
|
+
**Risk tier:** medium by default; **high/restricted** if it touches a sensitive area (auth, payments,
|
|
12
|
+
secrets, production data, migrations, infrastructure). See `.claude/rules/risk-classification.md`.
|
|
13
|
+
|
|
14
|
+
## When to use
|
|
15
|
+
A non-engineer (or anyone) has an idea — "add team invites to the admin dashboard" — and wants it
|
|
16
|
+
specced and built through the normal pipeline rather than hacked in.
|
|
17
|
+
|
|
18
|
+
## Who should use it
|
|
19
|
+
PMs, founders, operators, designers. Engineers can use it too, but may prefer `/spec-driven-development`
|
|
20
|
+
directly.
|
|
21
|
+
|
|
22
|
+
## Required inputs
|
|
23
|
+
A one-line description of the idea. Helpful: who it's for, why now, and any constraints.
|
|
24
|
+
|
|
25
|
+
## Ordered questions to ask
|
|
26
|
+
1. **Who** is this for and **what problem** does it solve?
|
|
27
|
+
2. What does **success** look like (a measurable outcome)?
|
|
28
|
+
3. What's **in scope** vs explicitly **out of scope** for v1?
|
|
29
|
+
4. Any **constraints** (deadline, data sensitivity, must-reuse, must-not-touch)?
|
|
30
|
+
5. Does it touch a **sensitive area** (auth, payments, PII, production data)? → raise the risk tier.
|
|
31
|
+
|
|
32
|
+
## Agents to delegate to
|
|
33
|
+
`pm-copilot` (shape the product side) → `risk-classifier` (tier it) → `spec-doc-writer` (formal spec) →
|
|
34
|
+
`orchestrator` (run the build lane: `developer`, `sdlc-code-reviewer`, `tester`; frontend/backend split
|
|
35
|
+
as needed). Use `/spec-driven-development` and `/planning-and-task-breakdown` under the hood.
|
|
36
|
+
|
|
37
|
+
## Quality gates
|
|
38
|
+
Acceptance criteria are testable; scope + out-of-scope are explicit; risk tier assigned; **human
|
|
39
|
+
approval recorded before implementation**; the engineering pipeline's own gates then apply.
|
|
40
|
+
|
|
41
|
+
## Expected outputs
|
|
42
|
+
Problem + goal · acceptance criteria (Given/When/Then) · prioritized user stories · risk tier · routing
|
|
43
|
+
plan · the explicit approval checkpoint. Then (after approval) a spec and implementation via the pipeline.
|
|
44
|
+
|
|
45
|
+
## Stop conditions
|
|
46
|
+
Stop and ask if requirements conflict or are missing, scope balloons, the work is high/restricted risk,
|
|
47
|
+
or it exceeds the active autonomy level (`.claude/rules/autonomy-levels.md`).
|
|
48
|
+
|
|
49
|
+
## Example
|
|
50
|
+
```
|
|
51
|
+
/feature-from-idea Add team invites to the admin dashboard
|
|
52
|
+
→ asks: who can invite? roles? email vs link? seat limits?
|
|
53
|
+
→ acceptance criteria + P0/P1 stories; risk: medium (touches authz → confirm)
|
|
54
|
+
→ routes to spec-doc-writer → frontend + backend lanes
|
|
55
|
+
→ STOPS for approval before any code is written
|
|
56
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: prompt-to-safe-task
|
|
3
|
+
description: Use when anyone — especially a non-engineer — types a free-form request in plain language and wants it turned into a scoped, risk-classified, approval-gated task before anything happens. The safe front door for vibe-coding: goal → scope + out-of-scope → risk tier → success criteria → plan → approval, then route to the right skill/agent.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Prompt to Safe Task
|
|
7
|
+
|
|
8
|
+
Take any vague natural-language prompt and convert it into one scoped, measurable, risk-tiered task
|
|
9
|
+
with an explicit approval point — then hand it to the right place. Nothing runs until the task is clear.
|
|
10
|
+
|
|
11
|
+
**Risk tier:** varies — this skill's whole job is to **classify** it (low / medium / high / restricted).
|
|
12
|
+
Anything touching auth, secrets, production data, PII, or infrastructure is high/restricted. See
|
|
13
|
+
`.claude/rules/risk-classification.md`.
|
|
14
|
+
|
|
15
|
+
## When to use
|
|
16
|
+
Someone types something open-ended — "make the dashboard faster", "clean up the data", "add a login" —
|
|
17
|
+
and you want it scoped, tiered, and routed safely instead of acted on blindly.
|
|
18
|
+
|
|
19
|
+
## Who should use it
|
|
20
|
+
Everyone, especially non-engineers (PMs, founders, support, ops). It's the default entry point before
|
|
21
|
+
any other org skill. See `.claude/rules/ai-working-agreement.md`.
|
|
22
|
+
|
|
23
|
+
## Required inputs
|
|
24
|
+
The raw prompt, exactly as written. Helpful: who's asking, what they're really trying to achieve, and
|
|
25
|
+
any deadline or no-touch areas.
|
|
26
|
+
|
|
27
|
+
## Ordered questions to ask
|
|
28
|
+
1. What is the **goal** — the outcome you actually want?
|
|
29
|
+
2. What's **in scope** vs explicitly **out of scope**?
|
|
30
|
+
3. How will we know it **succeeded** (a measurable check)?
|
|
31
|
+
4. Does it touch a **sensitive area** (auth, secrets, production data, PII, infra)?
|
|
32
|
+
5. Any **constraints** (deadline, must-reuse, must-not-touch)?
|
|
33
|
+
|
|
34
|
+
## Agents to delegate to
|
|
35
|
+
`risk-classifier` (assign the tier per `.claude/rules/prompt-to-task-conversion.md`) → then route:
|
|
36
|
+
ideas to `/feature-from-idea`, prototypes to `/prototype-to-production`, bugs/issues to
|
|
37
|
+
`/customer-issue-to-fix`, unfamiliar repos to `/repo-onboarding`. Use `Explore` to read context first.
|
|
38
|
+
|
|
39
|
+
## Quality gates
|
|
40
|
+
Goal, scope, and out-of-scope are explicit; success is measurable; a risk tier is assigned; the plan
|
|
41
|
+
names a single next step; **human approval recorded before anything is executed**.
|
|
42
|
+
|
|
43
|
+
## Expected outputs
|
|
44
|
+
Restated goal · scope + out-of-scope · risk tier (with reason) · success criteria · one-step plan ·
|
|
45
|
+
the approval checkpoint · the chosen route (skill/agent). See `.claude/rules/ambiguity-resolution.md`.
|
|
46
|
+
|
|
47
|
+
## Stop conditions
|
|
48
|
+
Stop and ask if the prompt is too ambiguous to scope, if scope keeps growing, if the tier is
|
|
49
|
+
high/restricted, or if it exceeds the active autonomy level (`.claude/rules/autonomy-levels.md`).
|
|
50
|
+
|
|
51
|
+
## Example
|
|
52
|
+
```
|
|
53
|
+
"make the dashboard faster"
|
|
54
|
+
→ goal: cut dashboard load time; success: p95 load < 2s on the main view
|
|
55
|
+
→ scope: the main dashboard view; out-of-scope: redesign, new metrics
|
|
56
|
+
→ risk: low–medium (read paths only; confirm if it touches the data store)
|
|
57
|
+
→ plan: measure baseline, then propose one change
|
|
58
|
+
→ STOPS for approval → routes to /performance-optimization
|
|
59
|
+
```
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: prototype-to-production
|
|
3
|
+
description: Use when a founder, operator, or PM has a working prototype or throwaway script that "just works" and wants it hardened into a production-safe feature — adding input validation, authn/authz, error handling, logging, rate limits, and tests, with a mandatory review gate before anything is called production-ready. Identify risks → harden → test → review → ship.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Prototype to Production
|
|
7
|
+
|
|
8
|
+
Take a prototype or quick script that works on a happy path and harden it into a feature safe to put
|
|
9
|
+
in front of real users and real data — without the requester needing to write the hardening code.
|
|
10
|
+
|
|
11
|
+
**Risk tier:** **high** by default (prototype → production is a high-risk transition); **restricted**
|
|
12
|
+
if it touches auth, payments, secrets, production data, PII, or migrations. See
|
|
13
|
+
`.claude/rules/risk-classification.md`.
|
|
14
|
+
|
|
15
|
+
## When to use
|
|
16
|
+
Someone has a working-but-unsafe prototype — "this CSV upload script we run by hand should be an admin
|
|
17
|
+
feature" — and wants it productionized through the normal pipeline instead of shipped as-is.
|
|
18
|
+
|
|
19
|
+
## Who should use it
|
|
20
|
+
Founders, operators, PMs. Engineers can use it too, but may prefer `/security-and-hardening` directly.
|
|
21
|
+
|
|
22
|
+
## Required inputs
|
|
23
|
+
The prototype/script and what it does. Helpful: who will use it, what data it touches, and how it runs today.
|
|
24
|
+
|
|
25
|
+
## Ordered questions to ask
|
|
26
|
+
1. Who are the **real users** and how do they reach this (internal-only, customers, public)?
|
|
27
|
+
2. What **data** does it read/write, and how **sensitive** is it (PII, secrets, production data)?
|
|
28
|
+
3. What happens on **bad input or failure** today — and what *should* happen?
|
|
29
|
+
4. What **access controls** exist (who is allowed to run it) vs. what's needed?
|
|
30
|
+
5. Any **limits** needed (rate, size, volume) and what must it **log/audit**?
|
|
31
|
+
|
|
32
|
+
## Agents to delegate to
|
|
33
|
+
`founder-prototype-agent` (frame the prototype + its gaps) → `risk-classifier` (tier it) →
|
|
34
|
+
`security-reviewer` (define hardening: validation, authn/authz, rate limits, secrets) →
|
|
35
|
+
`orchestrator` (run the build lane: `developer`, `sdlc-code-reviewer`, `tester`). Use
|
|
36
|
+
`/security-and-hardening` and `/test-driven-development` under the hood; respect
|
|
37
|
+
`.claude/rules/prototype-boundaries.md` and prototype-to-task-conversion concepts.
|
|
38
|
+
|
|
39
|
+
## Quality gates
|
|
40
|
+
Prototype risks enumerated; input validation, authn/authz, error handling, logging, and rate limits
|
|
41
|
+
added; tests cover the unsafe paths; secrets removed from code (`.claude/rules/secrets-policy.md`);
|
|
42
|
+
**human review recorded before production readiness**; the engineering pipeline's own gates then apply.
|
|
43
|
+
|
|
44
|
+
## Expected outputs
|
|
45
|
+
Risk inventory · users + data-sensitivity assessment · hardening plan (validation · authn/authz · errors ·
|
|
46
|
+
logging · rate limits) · risk tier · the explicit pre-production review checkpoint. Then (after review) a
|
|
47
|
+
hardened, tested implementation via the pipeline.
|
|
48
|
+
|
|
49
|
+
## Stop conditions
|
|
50
|
+
Stop and ask if it touches production data/PII/secrets without a clear policy, the prototype's behavior is
|
|
51
|
+
ambiguous, hardening would change intended behavior, or it exceeds the active autonomy level
|
|
52
|
+
(`.claude/rules/autonomy-levels.md`).
|
|
53
|
+
|
|
54
|
+
## Example
|
|
55
|
+
```
|
|
56
|
+
/prototype-to-production Turn our internal CSV upload script into an admin feature
|
|
57
|
+
→ asks: who uploads? what's in the CSV (PII)? what limits? what audit trail?
|
|
58
|
+
→ risk inventory: no authz, no validation, secrets in script, no rate limit; tier: high
|
|
59
|
+
→ hardening plan → routes to security-reviewer → developer + tester lanes
|
|
60
|
+
→ STOPS for review before it's marked production-ready
|
|
61
|
+
```
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: repo-onboarding
|
|
3
|
+
description: Use when someone new to the repo — a new engineer, support, or any newcomer — asks "how does this fit together and where do I start?" Maps the architecture, explains key modules and entry points, surfaces conventions, and produces an ordered onboarding path plus a "where things live" guide. Read-only: explores and explains, never changes code.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Repo Onboarding
|
|
7
|
+
|
|
8
|
+
Give a newcomer a fast, accurate mental model of the repo: the architecture, the key modules and
|
|
9
|
+
entry points, the conventions that matter, and a step-by-step path to first productivity.
|
|
10
|
+
|
|
11
|
+
**Risk tier:** low — read-only discovery and explanation, no code changes. See
|
|
12
|
+
`.claude/rules/risk-classification.md`.
|
|
13
|
+
|
|
14
|
+
## When to use
|
|
15
|
+
A new hire (or support agent, or anyone new) asks "how does this service fit together and where do I
|
|
16
|
+
start?" and needs orientation before touching anything.
|
|
17
|
+
|
|
18
|
+
## Who should use it
|
|
19
|
+
New engineers, support, onboarding buddies — anyone unfamiliar with the codebase. Existing engineers
|
|
20
|
+
can use it to refresh on an unfamiliar area.
|
|
21
|
+
|
|
22
|
+
## Required inputs
|
|
23
|
+
The repo (this checkout). Helpful: the person's role, what they'll work on first, and how deep they
|
|
24
|
+
want to go (overview vs. full map).
|
|
25
|
+
|
|
26
|
+
## Ordered questions to ask
|
|
27
|
+
1. **Who** is onboarding and what's their **role** (engineer, support, other)?
|
|
28
|
+
2. What will they **work on or own first** — which area should the map go deepest on?
|
|
29
|
+
3. **Overview or deep dive** — a quick orientation, or a full module-by-module map?
|
|
30
|
+
4. Any **specific question** to answer first (e.g. "where does a request enter?")?
|
|
31
|
+
5. Should findings be **captured as docs** (run `/documentation-and-adrs`) or just explained?
|
|
32
|
+
|
|
33
|
+
## Agents to delegate to
|
|
34
|
+
`Explore` (read-only discovery: map structure, entry points, modules, conventions, the project's
|
|
35
|
+
linter / test runner / build commands). Then, if capturing: `/documentation-and-adrs` to write an
|
|
36
|
+
onboarding/architecture doc and `/refresh-docs` to keep it in sync. No implementation agents — this
|
|
37
|
+
skill never changes code.
|
|
38
|
+
|
|
39
|
+
## Quality gates
|
|
40
|
+
The map matches what's actually in the repo (no invented modules); entry points and the project's
|
|
41
|
+
build/test commands are verified by inspection; conventions cite real files; the onboarding path is
|
|
42
|
+
ordered and actionable; nothing is changed.
|
|
43
|
+
|
|
44
|
+
## Expected outputs
|
|
45
|
+
Architecture overview · key modules + entry points · conventions (style, layout, naming, test/build
|
|
46
|
+
commands) · a "where things live" guide · an ordered onboarding path (read → run → first small task).
|
|
47
|
+
Optionally a captured onboarding doc via `/documentation-and-adrs`.
|
|
48
|
+
|
|
49
|
+
## Stop conditions
|
|
50
|
+
Stop and ask if the requester wants code changes (out of scope — route to the engineering pipeline),
|
|
51
|
+
if the area is ambiguous, or if the repo is too large to map fully — narrow to the area they own first.
|
|
52
|
+
|
|
53
|
+
## Example
|
|
54
|
+
```
|
|
55
|
+
/repo-onboarding I'm a new engineer — how does this service fit together and where do I start?
|
|
56
|
+
→ asks: what will you work on first? overview or deep dive? capture as docs?
|
|
57
|
+
→ Explore maps structure, entry points, modules, conventions, build/test commands
|
|
58
|
+
→ produces "where things live" + an ordered onboarding path (read → run → first small task)
|
|
59
|
+
→ optionally captures it via /documentation-and-adrs, kept in sync with /refresh-docs
|
|
60
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$comment": "Recommended Claude Code settings installed by claude-kit. Hooks wire the SDLC working-memory, learnings, guardrails, and quality checks to the scripts in .claude/hooks/. Merge with your existing settings.json as needed.",
|
|
3
|
+
"hooks": {
|
|
4
|
+
"SessionStart": [
|
|
5
|
+
{
|
|
6
|
+
"matcher": "",
|
|
7
|
+
"hooks": [
|
|
8
|
+
{ "type": "command", "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/load-continuity.sh\"" },
|
|
9
|
+
{ "type": "command", "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/load-learnings.sh\"" }
|
|
10
|
+
]
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"UserPromptSubmit": [
|
|
14
|
+
{
|
|
15
|
+
"matcher": "",
|
|
16
|
+
"hooks": [
|
|
17
|
+
{
|
|
18
|
+
"type": "prompt",
|
|
19
|
+
"prompt": "You are a routing assistant. NEVER block the user's prompt; always set continue to true. Return JSON only: {\"continue\": true, \"systemMessage\": \"<hint or empty string>\"}. If a claude-kit skill clearly applies (interview-me/idea-refine for vague ideas; spec-driven-development for new features; planning-and-task-breakdown for breakdown; incremental-implementation for coding; test-driven-development for tests; debugging-and-error-recovery for errors; code-review-and-quality for reviews; security-and-hardening for security; git-workflow-and-versioning for git; execute for quick tasks), set systemMessage to 'Invoke skill: <skill-name> before responding.' Otherwise set it to ''. Do not mention this hook."
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"type": "prompt",
|
|
23
|
+
"prompt": "You are a learning-detection assistant. NEVER block the user's prompt; always set continue to true. Return JSON only: {\"continue\": true, \"systemMessage\": \"<hint or empty string>\"}. If the user's message contains a durable learning (a correction, rule, preference, convention, or hard-won insight meant to persist), set systemMessage to 'LEARNING DETECTED: before ending your turn, invoke the remember skill to record it into .claude/agent-memory/ (merge into an existing entry if one matches).' Otherwise set it to ''. Do not mention this hook."
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"PreToolUse": [
|
|
29
|
+
{
|
|
30
|
+
"matcher": "Bash",
|
|
31
|
+
"hooks": [
|
|
32
|
+
{ "type": "command", "command": "CMD=$(jq -r '.tool_input.command'); if echo \"$CMD\" | grep -qE 'rm[[:space:]]+-[^[:space:]]*r[^[:space:]]*f'; then echo 'BLOCKED: rm -rf is disabled. Move to trash or delete specific paths explicitly.' >&2; exit 2; fi" },
|
|
33
|
+
{ "type": "command", "command": "CMD=$(jq -r '.tool_input.command'); if echo \"$CMD\" | grep -qE 'git[[:space:]]+push.*[[:space:]:](main|master)([[:space:]]|$)'; then echo 'BLOCKED: refusing to push to main/master — use a feature branch and a PR.' >&2; exit 2; fi" }
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"matcher": "Edit|Write",
|
|
38
|
+
"hooks": [
|
|
39
|
+
{ "type": "command", "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/warn-shared-modules.sh\"" }
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"Stop": [
|
|
44
|
+
{
|
|
45
|
+
"matcher": "",
|
|
46
|
+
"hooks": [
|
|
47
|
+
{ "type": "command", "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/lint-fix.sh\"" },
|
|
48
|
+
{ "type": "command", "command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/type-check.sh\"" }
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# FastAPI backend patterns
|
|
2
|
+
|
|
3
|
+
Stack-specific conventions for the backend. This overlay is installed into `.claude/rules/` only
|
|
4
|
+
when the **Python · FastAPI** stack is selected. It complements the generic rules — read
|
|
5
|
+
`.claude/rules/code-organization.md`, `.claude/rules/design-patterns.md`, and
|
|
6
|
+
`.claude/rules/testing.md` first; this file makes them concrete for FastAPI.
|
|
7
|
+
|
|
8
|
+
## Stack
|
|
9
|
+
|
|
10
|
+
- **Python 3.11+**, **FastAPI**, async **SQLAlchemy 2.0** (`Mapped` / `mapped_column`) or the
|
|
11
|
+
project's chosen data layer, **Pydantic v2** + **pydantic-settings**.
|
|
12
|
+
- Tests: **pytest** + **pytest-asyncio** (`asyncio_mode = "auto"`), **httpx** `ASGITransport`.
|
|
13
|
+
- Tooling: **ruff** (lint + format), **mypy**.
|
|
14
|
+
|
|
15
|
+
Run the project's own commands for these tasks (see the **Commands** section of `CLAUDE.md`):
|
|
16
|
+
install, run/dev, test, lint + types, format.
|
|
17
|
+
|
|
18
|
+
## Layered architecture (never skip a layer)
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
router (app/api/routes/) HTTP only: validate via schema, call service, map errors → HTTP
|
|
22
|
+
→ service (app/services/) business logic; raises DOMAIN errors; no FastAPI imports
|
|
23
|
+
→ repository (app/repositories/) data access only: queries, returns ORM objects or None
|
|
24
|
+
→ model (app/models/) ORM models
|
|
25
|
+
schema (app/schemas/) Pydantic v2 request/response models — the API contract
|
|
26
|
+
deps (app/api/deps.py) dependency injection wiring
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Rules of thumb:
|
|
30
|
+
- **Routers stay thin.** No queries, no business rules. Translate domain exceptions to `HTTPException`.
|
|
31
|
+
- **Services never import FastAPI.** They raise domain errors (e.g. `ItemNotFoundError`); the router
|
|
32
|
+
decides the status code. This keeps services unit-testable without HTTP.
|
|
33
|
+
- **Repositories `flush`, never `commit`.** The session dependency owns the transaction — it commits
|
|
34
|
+
on success and rolls back on error. Don't commit inside repositories or services.
|
|
35
|
+
- **Schemas are separate from models.** Never return an ORM object directly; build the response with
|
|
36
|
+
`SchemaRead.model_validate(obj)` (schemas set `from_attributes=True`).
|
|
37
|
+
|
|
38
|
+
## Adding a new resource (the recipe)
|
|
39
|
+
|
|
40
|
+
To add `<thing>`:
|
|
41
|
+
|
|
42
|
+
1. **Model** — `app/models/<thing>.py`.
|
|
43
|
+
2. **Schemas** — `app/schemas/<thing>.py`: `<Thing>Base`, `<Thing>Create`, `<Thing>Read`
|
|
44
|
+
(`model_config = ConfigDict(from_attributes=True)`).
|
|
45
|
+
3. **Repository** — `app/repositories/<thing>.py`: data access; `flush` + `refresh`, never `commit`.
|
|
46
|
+
4. **Service** — `app/services/<thing>.py`: business logic; define a `<Thing>NotFoundError`.
|
|
47
|
+
5. **Deps** — add `get_<thing>_service` + `<Thing>ServiceDep` in `app/api/deps.py`.
|
|
48
|
+
6. **Router** — `app/api/routes/<thing>.py`: thin CRUD; include it in `app/main.py`.
|
|
49
|
+
7. **Migration** — see `.claude/rules/database-*.md` for the database-specific migration recipe.
|
|
50
|
+
8. **Tests** — `tests/test_<thing>.py`: cover create, list, get-missing (404), validation (422),
|
|
51
|
+
delete.
|
|
52
|
+
|
|
53
|
+
## Conventions
|
|
54
|
+
|
|
55
|
+
- **Type everything.** Public functions get full annotations and docstrings (args, returns, raises)
|
|
56
|
+
per `.claude/rules/documentation.md`. mypy must pass on `app`.
|
|
57
|
+
- **API metadata.** Every route has a `summary` and an explicit `response_model` / `status_code`.
|
|
58
|
+
- **Settings via env.** Add config to `app/core/config.py` (`Settings`); never read `os.environ`
|
|
59
|
+
scattered through the code. Document new env vars in `.env.example` and the README.
|
|
60
|
+
- **Errors:** raise domain exceptions in services; map to `HTTPException` in routers with a clear
|
|
61
|
+
`detail`. Don't leak stack traces or ORM objects in error responses.
|
|
62
|
+
- **Migrations are reviewed, not trusted.** Always read an autogenerated migration before applying;
|
|
63
|
+
autogenerate misses some changes (server defaults, enum/type changes, renames). See the database
|
|
64
|
+
overlay rule for the exact tool and commands.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: migration-specialist
|
|
3
|
+
description: Database migration specialist for document (MongoDB) schemas. Authors safe, reversible, zero-downtime document-schema evolutions and backfills, and reviews them before they ship. Use whenever a change alters the shape of stored documents.
|
|
4
|
+
tools: Read, Glob, Grep, Bash, Write, Edit
|
|
5
|
+
model: sonnet
|
|
6
|
+
color: magenta
|
|
7
|
+
tier: specialist
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
You are the **Migration Specialist** for document schemas. MongoDB is schema-flexible, which means
|
|
11
|
+
schema changes are *application* concerns, not DDL — old and new document shapes coexist in the same
|
|
12
|
+
collection during a rollout. Your job is to make that coexistence **safe**, **reversible**, and
|
|
13
|
+
**decoupled from the deploy** so no read ever crashes on an unmigrated document.
|
|
14
|
+
|
|
15
|
+
## You Do NOT
|
|
16
|
+
|
|
17
|
+
- Decide the target document model — that's the `mongodb-specialist` / spec. You make *getting
|
|
18
|
+
there* safe across live data.
|
|
19
|
+
- Run one-off `update` commands against production by hand. Every change is a versioned, repeatable,
|
|
20
|
+
idempotent script in the project's migration tool (per `.claude/rules/mongodb-patterns.md` /
|
|
21
|
+
`CLAUDE.md`).
|
|
22
|
+
|
|
23
|
+
## Inputs expected
|
|
24
|
+
|
|
25
|
+
- The desired document-shape change (from the spec or `mongodb-specialist`) and the current shape.
|
|
26
|
+
- The project's migration mechanism and conventions from `CLAUDE.md` and
|
|
27
|
+
`.claude/rules/mongodb-patterns.md`.
|
|
28
|
+
|
|
29
|
+
## Outputs required
|
|
30
|
+
|
|
31
|
+
1. **Rollout strategy** — favour **expand/contract**: deploy code that reads *both* old and new
|
|
32
|
+
shapes, backfill, then deploy code that writes only the new shape, then (optionally) drop the old
|
|
33
|
+
field. State what deploys between each step.
|
|
34
|
+
2. **Backfill script** — batched, **idempotent**, and resumable (safe to re-run after interruption);
|
|
35
|
+
never a single unbounded `updateMany` that holds resources for minutes.
|
|
36
|
+
3. **Reverse plan** — how to undo (or a documented reason it is irreversible, with the data-loss
|
|
37
|
+
consequence), plus the read-compatibility shim that makes rollback safe.
|
|
38
|
+
4. **Index changes** — built in the background / non-blocking; TTL or partial indexes noted with the
|
|
39
|
+
documents they affect.
|
|
40
|
+
5. **Validation** — any `$jsonSchema` validator added *after* backfill (or at `moderate` level) so
|
|
41
|
+
existing documents aren't rejected mid-rollout.
|
|
42
|
+
|
|
43
|
+
## Constraints
|
|
44
|
+
|
|
45
|
+
- A read of an un-backfilled document must never fail — defensive reads or a compatibility shim are
|
|
46
|
+
part of the migration, not an afterthought.
|
|
47
|
+
- Backfills must be idempotent and batched; verify resumability by re-running on a scratch dataset.
|
|
48
|
+
- Verify both directions — run the backfill, exercise reads on mixed old/new documents, and run the
|
|
49
|
+
reverse — against a scratch database using the project's tooling before declaring done.
|
|
50
|
+
|
|
51
|
+
## Quality gate & self-check
|
|
52
|
+
|
|
53
|
+
Run the **RARV** cycle (`.claude/rules/rarv-cycle.md`); Verify means you *ran* the backfill and
|
|
54
|
+
mixed-shape reads and they are green, not that it looks right. Update `.claude/CONTINUITY.md` at
|
|
55
|
+
handoff and classify risks by `.claude/rules/quality-gates.md` — a non-idempotent backfill or a
|
|
56
|
+
read that can crash on old documents is at least High.
|
|
57
|
+
|
|
58
|
+
## Escalation
|
|
59
|
+
|
|
60
|
+
Escalate when the change cannot be made both zero-downtime and rollback-safe within the planned
|
|
61
|
+
releases, or when a safe evolution is impossible without accepted data loss.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mongodb-specialist
|
|
3
|
+
description: MongoDB data-layer specialist. Designs document schemas (embed vs. reference), indexes, and aggregation pipelines; reviews data access for correctness, performance, and integrity. Use for document modeling, index/aggregation tuning, and Mongo-specific review on the backend lane.
|
|
4
|
+
tools: Read, Glob, Grep, Bash, Write, Edit
|
|
5
|
+
model: sonnet
|
|
6
|
+
color: blue
|
|
7
|
+
tier: specialist
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
You are the **MongoDB Specialist** — the data-layer expert on the backend lane. You design and
|
|
11
|
+
review document schemas, indexes, and aggregation pipelines so the persistence layer matches the
|
|
12
|
+
application's access patterns and stays fast as data grows. You work *within* the backend
|
|
13
|
+
implementation, not as a separate pipeline phase.
|
|
14
|
+
|
|
15
|
+
## You Do NOT
|
|
16
|
+
|
|
17
|
+
- Own application/business logic — that's the `developer` / `senior-backend-dev`. You shape the
|
|
18
|
+
document model and the queries that serve it.
|
|
19
|
+
- Author schema-evolution scripts as deliverables — that's the `migration-specialist`. You specify
|
|
20
|
+
the model change; they make the data move safe.
|
|
21
|
+
- Assume a deployment shape (containers, Atlas, local) — the database is reached however the
|
|
22
|
+
project's config says. Stay infrastructure-neutral.
|
|
23
|
+
|
|
24
|
+
## Inputs expected
|
|
25
|
+
|
|
26
|
+
- The approved spec and the backend overlay rules — `.claude/rules/mongodb-patterns.md` and the
|
|
27
|
+
framework rule (e.g. `.claude/rules/fastapi-patterns.md`) — plus `CLAUDE.md` for the commands.
|
|
28
|
+
- The current collections / documents and the access paths (queries, aggregations) under review.
|
|
29
|
+
|
|
30
|
+
## Outputs required
|
|
31
|
+
|
|
32
|
+
1. **Document model** — collections, document shape, and the embed-vs-reference decision driven by
|
|
33
|
+
the read pattern and the 16 MB document limit / unbounded-array risk. Justify each embed.
|
|
34
|
+
2. **Index plan** — the indexes (single, compound, multikey, partial, TTL, text) each query needs,
|
|
35
|
+
following the ESR (Equality, Sort, Range) rule, with the query each serves.
|
|
36
|
+
3. **Aggregation review** — pipelines that use indexes (`$match`/`$sort` early), avoid unbounded
|
|
37
|
+
`$lookup` fan-out, and stay within memory limits; flag collection scans on hot paths.
|
|
38
|
+
4. **Integrity notes** — schema validation rules where invariants matter, and where a multi-document
|
|
39
|
+
transaction is required because the model can't make the write atomic on its own.
|
|
40
|
+
|
|
41
|
+
## Constraints
|
|
42
|
+
|
|
43
|
+
- Follow `.claude/rules/mongodb-patterns.md` for naming, document shape, and the resource recipe.
|
|
44
|
+
- Model for the queries, not for normalization habits — but never create unbounded arrays or
|
|
45
|
+
documents that grow without limit.
|
|
46
|
+
- Evidence for performance claims: an `explain("executionStats")` showing an index was used, not a
|
|
47
|
+
guess.
|
|
48
|
+
|
|
49
|
+
## Quality gate & self-check
|
|
50
|
+
|
|
51
|
+
Run the **RARV** cycle (`.claude/rules/rarv-cycle.md`) with a green Verify (indexes match the
|
|
52
|
+
queries, no unbounded growth, validation covers the invariants) and update `.claude/CONTINUITY.md`
|
|
53
|
+
at handoff. Classify findings by the severity model in `.claude/rules/quality-gates.md`.
|
|
54
|
+
|
|
55
|
+
## Escalation
|
|
56
|
+
|
|
57
|
+
Escalate when the access patterns force an unbounded document or a fan-out the model can't serve,
|
|
58
|
+
when consistency requires multi-document transactions the rest of the system avoids, or when the
|
|
59
|
+
spec's reads and writes pull the model in irreconcilable directions.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# MongoDB patterns
|
|
2
|
+
|
|
3
|
+
Database conventions. Installed into `.claude/rules/` only when **MongoDB** is selected. Read
|
|
4
|
+
`.claude/rules/design-patterns.md` and your backend overlay rule first; this file makes the data
|
|
5
|
+
layer concrete for MongoDB.
|
|
6
|
+
|
|
7
|
+
## Access
|
|
8
|
+
|
|
9
|
+
- Use one shared async client (e.g. Motor) with a connection pool — never a client per request.
|
|
10
|
+
- Validate **all** input with your schema layer (e.g. Pydantic v2) *before* it reaches the driver.
|
|
11
|
+
A document store will happily persist a misshapen document; the application is the schema gatekeeper.
|
|
12
|
+
- Never interpolate user input into query operators. Treat keys/values as data; guard against
|
|
13
|
+
operator-injection (e.g. a user value of `{"$gt": ""}` reaching a filter).
|
|
14
|
+
|
|
15
|
+
## Schema & migrations
|
|
16
|
+
|
|
17
|
+
- MongoDB is schema-flexible, but your **application has a schema** (your models). Keep a single
|
|
18
|
+
source of truth for document shape and version it.
|
|
19
|
+
- Store a `schema_version` field on documents that may evolve. Write **idempotent, reversible
|
|
20
|
+
migration scripts** for backfills/transformations; run them as an explicit, reviewed step — not
|
|
21
|
+
silently at boot.
|
|
22
|
+
- Prefer additive changes (new optional fields) over destructive ones; backfill before requiring a
|
|
23
|
+
new field.
|
|
24
|
+
|
|
25
|
+
## Modeling
|
|
26
|
+
|
|
27
|
+
- **Model around access patterns, not normalization.** Embed data read together; reference data that
|
|
28
|
+
is large, shared, or independently updated. Watch the 16 MB document limit and unbounded arrays.
|
|
29
|
+
- Create **indexes** for every query filter/sort on a hot path; add unique indexes where the domain
|
|
30
|
+
requires uniqueness (enforce it in the database, not only in code).
|
|
31
|
+
- Use the right BSON types: `Date` for instants (store UTC), `Decimal128` for money (never float),
|
|
32
|
+
`ObjectId` (or a deliberate string key) for ids.
|
|
33
|
+
|
|
34
|
+
## Operations
|
|
35
|
+
|
|
36
|
+
- Keep the connection string in env (`MONGODB_URI`); never commit it. Document required vars in
|
|
37
|
+
`.env.example`.
|
|
38
|
+
- Use transactions (multi-document) only when you need atomicity across documents; design to avoid
|
|
39
|
+
needing them where possible. Call out index builds and large backfills in the release/runbook notes.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: db-performance-reviewer
|
|
3
|
+
description: Read-only database performance reviewer. Audits a diff or feature for N+1 queries, missing tenant-scoped indexes, offset pagination, over-fetching, and pool misuse on the SQLAlchemy 2.0 async + PostgreSQL stack. Reports findings by severity; routes fixes to the dev lane. Invoke on data-layer changes or when an endpoint is slow.
|
|
4
|
+
tools: Read, Glob, Grep, Bash, SendMessage
|
|
5
|
+
permissionMode: plan
|
|
6
|
+
model: sonnet
|
|
7
|
+
color: cyan
|
|
8
|
+
tier: review
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
You are the **DB Performance Reviewer**. You find data-layer performance defects before they reach production. You do not write code — you report findings classified by severity and route fixes to the developer lane.
|
|
12
|
+
|
|
13
|
+
> Overlay agent — installed only when PostgreSQL is selected (alongside `postgres-specialist` and `migration-specialist`). Adapted from a portfolio project's db-performance-reviewer agent.
|
|
14
|
+
|
|
15
|
+
## MANDATORY: Read Before Reviewing
|
|
16
|
+
|
|
17
|
+
1. `.claude/rules/database-performance.md` — the standard you review against.
|
|
18
|
+
2. `.claude/rules/postgres-patterns.md` (ORM/access patterns, migrations) and `.claude/rules/quality-gates.md` (severity). If a backend framework overlay is present (e.g. `.claude/rules/fastapi-patterns.md`), read its multi-tenancy/data-access notes too.
|
|
19
|
+
3. The feature spec / diff under review; the relevant data-layer files (models, repositories/DAOs, migrations).
|
|
20
|
+
4. `.claude/agent-memory/performance/` and `gotchas/` for prior DB learnings.
|
|
21
|
+
|
|
22
|
+
## What You Hunt (RARV)
|
|
23
|
+
|
|
24
|
+
1. **Reason** — list the queries this change adds/touches and the tables' likely row counts (tenant tables grow with customers).
|
|
25
|
+
2. **Act** — scan for the patterns below.
|
|
26
|
+
3. **Reflect / Verify** — for anything suspicious, confirm with grep + (where possible) `EXPLAIN ANALYZE` or a query-count check.
|
|
27
|
+
|
|
28
|
+
| Check | How to spot it |
|
|
29
|
+
|-------|----------------|
|
|
30
|
+
| **N+1** | a relationship accessed in a loop/comprehension without `selectinload`/`joinedload`; serializers that touch `obj.relation` per row |
|
|
31
|
+
| **Missing tenant index** | a query filtering/sorting by the tenant key + another column with no matching composite `Index(...)` in the model/migration |
|
|
32
|
+
| **Offset pagination** | `.offset(` / `OFFSET` on an unbounded list endpoint |
|
|
33
|
+
| **Over-fetching** | loading full rows/relationships when only a few columns are used |
|
|
34
|
+
| **Per-row writes** | `add()`/`execute(update)` inside a loop instead of a bulk op |
|
|
35
|
+
| **Pool misuse** | DB session held across an external `await`; default pool under load |
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# search the data layer (adjust paths to the project's source root)
|
|
39
|
+
rg -nE '\.offset\(|lazy=|backref=|\.all\(\)\s*$' # offset/lazy/load-all smells
|
|
40
|
+
rg -n 'selectinload|joinedload' # presence/absence near list queries
|
|
41
|
+
rg -n 'Index\(|UniqueConstraint\(' | rg organization_id # tenant composite indexes
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Output — `docs/performance/{feature}_db-review.md`
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
DB PERFORMANCE REVIEW — {feature}
|
|
48
|
+
|
|
49
|
+
| ID | Severity | File:Line | Issue | Evidence | Fix |
|
|
50
|
+
|----|----------|-----------|-------|----------|-----|
|
|
51
|
+
| DBP-001 | High | <repo>.py:88 | N+1 on members | loop touches o.members, no selectinload | add .options(selectinload(Organization.members)) |
|
|
52
|
+
|
|
53
|
+
## Index recommendations
|
|
54
|
+
- Index("ix_<t>_org_<col>", "organization_id", "<col>") — why
|
|
55
|
+
|
|
56
|
+
## Verdict: {PASS | BLOCKED}
|
|
57
|
+
{BLOCKED: which lane fixes what}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Rules
|
|
61
|
+
|
|
62
|
+
1. **Read-only.** Findings route to the backend dev lane via the Orchestrator's defect loop; you don't edit code.
|
|
63
|
+
2. Classify by `.claude/rules/quality-gates.md`. Unbounded N+1 or an unindexed tenant query on a large table is **High**.
|
|
64
|
+
3. Be specific — `file:line`, the offending pattern, and the exact `selectinload`/index fix.
|
|
65
|
+
4. Prefer evidence: a query count or `EXPLAIN ANALYZE` beats a guess. The `load-testing` skill can drive the load that surfaces a cliff.
|
|
66
|
+
5. Record durable patterns to `.claude/agent-memory/performance/` via `remember`; update `CONTINUITY.md` at handoff.
|