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,96 @@
|
|
|
1
|
+
# claude-kit stack catalog — the single source of truth for selectable stacks.
|
|
2
|
+
#
|
|
3
|
+
# Adding a frontend framework, backend language/framework, or database is a DATA change here
|
|
4
|
+
# (plus a templates/stacks/<stack_dir>/ folder for its overlay rules/agents) — never a code change.
|
|
5
|
+
# Entries marked `status: planned` are offered by `list-options` as "coming soon" but cannot be
|
|
6
|
+
# selected yet (no overlay content shipped). React + Python/FastAPI + Postgres/Mongo are live.
|
|
7
|
+
#
|
|
8
|
+
# Each live entry may declare:
|
|
9
|
+
# label human name shown in prompts
|
|
10
|
+
# overlay_rules rule files copied into .claude/rules/ when selected (live under stack_dir/rules/)
|
|
11
|
+
# overlay_agents agent files copied into .claude/agents/ when selected (live under stack_dir/agents/)
|
|
12
|
+
# skills skills unioned into the install regardless of profile
|
|
13
|
+
# stack_dir path under templates/stacks/ holding this stack's overlay rules/agents
|
|
14
|
+
# commands canonical commands surfaced in CLAUDE.md (the source of truth for every agent)
|
|
15
|
+
# mcp_suggested an mcp.yaml server id suggested (not auto-enabled) for this choice
|
|
16
|
+
|
|
17
|
+
version: 1
|
|
18
|
+
|
|
19
|
+
frontend:
|
|
20
|
+
default: react
|
|
21
|
+
frameworks:
|
|
22
|
+
react:
|
|
23
|
+
label: "React"
|
|
24
|
+
languages:
|
|
25
|
+
default: typescript
|
|
26
|
+
options: [typescript, javascript]
|
|
27
|
+
overlay_rules: [react-patterns.md]
|
|
28
|
+
overlay_agents: []
|
|
29
|
+
skills: [frontend-ui-engineering, component-design, ui-ux-design, unit-test]
|
|
30
|
+
stack_dir: frontend/react
|
|
31
|
+
commands:
|
|
32
|
+
install: "npm install"
|
|
33
|
+
dev: "npm run dev"
|
|
34
|
+
test: "npm run test"
|
|
35
|
+
lint: "npm run lint"
|
|
36
|
+
typecheck: "npm run typecheck"
|
|
37
|
+
build: "npm run build"
|
|
38
|
+
vue:
|
|
39
|
+
label: "Vue"
|
|
40
|
+
status: planned
|
|
41
|
+
languages: { default: typescript, options: [typescript, javascript] }
|
|
42
|
+
stack_dir: frontend/vue
|
|
43
|
+
svelte:
|
|
44
|
+
label: "Svelte"
|
|
45
|
+
status: planned
|
|
46
|
+
languages: { default: typescript, options: [typescript] }
|
|
47
|
+
stack_dir: frontend/svelte
|
|
48
|
+
|
|
49
|
+
backend:
|
|
50
|
+
default: python
|
|
51
|
+
languages:
|
|
52
|
+
python:
|
|
53
|
+
label: "Python"
|
|
54
|
+
default_framework: fastapi
|
|
55
|
+
frameworks:
|
|
56
|
+
fastapi:
|
|
57
|
+
label: "FastAPI"
|
|
58
|
+
overlay_rules: [fastapi-patterns.md]
|
|
59
|
+
overlay_agents: []
|
|
60
|
+
skills: [api-and-interface-design, api-integration]
|
|
61
|
+
stack_dir: backend/python/fastapi
|
|
62
|
+
commands:
|
|
63
|
+
install: "pip install -e '.[dev]'"
|
|
64
|
+
dev: "uvicorn app.main:app --reload"
|
|
65
|
+
test: "pytest"
|
|
66
|
+
lint: "ruff check . && mypy app"
|
|
67
|
+
format: "ruff format ."
|
|
68
|
+
django:
|
|
69
|
+
label: "Django"
|
|
70
|
+
status: planned
|
|
71
|
+
stack_dir: backend/python/django
|
|
72
|
+
node:
|
|
73
|
+
label: "Node.js"
|
|
74
|
+
status: planned
|
|
75
|
+
default_framework: express
|
|
76
|
+
frameworks:
|
|
77
|
+
express:
|
|
78
|
+
label: "Express"
|
|
79
|
+
status: planned
|
|
80
|
+
stack_dir: backend/node/express
|
|
81
|
+
|
|
82
|
+
database:
|
|
83
|
+
default: postgres
|
|
84
|
+
options:
|
|
85
|
+
postgres:
|
|
86
|
+
label: "PostgreSQL"
|
|
87
|
+
overlay_rules: [postgres-patterns.md, database-performance.md]
|
|
88
|
+
overlay_agents: [postgres-specialist, migration-specialist, db-performance-reviewer]
|
|
89
|
+
stack_dir: db/postgres
|
|
90
|
+
mcp_suggested: postgres
|
|
91
|
+
mongodb:
|
|
92
|
+
label: "MongoDB"
|
|
93
|
+
overlay_rules: [mongodb-patterns.md]
|
|
94
|
+
overlay_agents: [mongodb-specialist, migration-specialist]
|
|
95
|
+
stack_dir: db/mongodb
|
|
96
|
+
mcp_suggested: mongodb
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Scaffold the claude-kit SDLC config (CLAUDE.md + .claude/rules, agents, skills, hooks) into this project
|
|
3
|
+
argument-hint: "[target-dir] [--defaults] [--force]"
|
|
4
|
+
allowed-tools: Bash, Read, Glob
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Install the claude-kit autonomous-SDLC configuration into the current project.
|
|
8
|
+
|
|
9
|
+
**Prefer the full Python CLI** (it runs the ordered prompts, resolves the stack/profile/MCP catalog,
|
|
10
|
+
installs overlay rules + agents, assembles `settings.json`, and records `init-options.json` for safe
|
|
11
|
+
upgrades). Check whether it's on PATH and use it, passing through `$ARGUMENTS`:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
command -v claude-kit >/dev/null 2>&1 && claude-kit init $ARGUMENTS \
|
|
15
|
+
|| { command -v ckit >/dev/null 2>&1 && ckit init $ARGUMENTS; }
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
If neither `claude-kit` nor `ckit` is installed, fall back to the **thin** bundled scaffolder (it
|
|
19
|
+
copies the full payload with no stack/profile resolution — a superset install; suggest the user
|
|
20
|
+
`pip install claude-code-kit` afterwards for the catalog-driven experience):
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
bash "${CLAUDE_PLUGIN_ROOT}/scripts/init.sh" $ARGUMENTS
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
If `${CLAUDE_PLUGIN_ROOT}` is not set (running from a source checkout), locate `scripts/init.sh` in
|
|
27
|
+
the claude-kit repository and run it the same way.
|
|
28
|
+
|
|
29
|
+
After it completes:
|
|
30
|
+
1. Summarize what was installed — `CLAUDE.md`, `.claude/{rules, agents, skills, hooks, templates}`,
|
|
31
|
+
and (CLI only) `.claude/config/`, optional `.mcp.json` — with counts.
|
|
32
|
+
2. If `CLAUDE.md` / `settings.json` / `.mcp.json` already existed, the installer wrote a
|
|
33
|
+
`.claude-kit` sidecar instead of overwriting. Point these out and offer to merge them (or suggest
|
|
34
|
+
re-running with `--force`).
|
|
35
|
+
3. Tell the user to **restart Claude Code** so the newly installed project agents, skills, and hooks load.
|
|
36
|
+
4. Suggest the next step: run `/sdlc <your first task>` (or `/claude-kit:sdlc` from the plugin).
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run the full autonomous SDLC pipeline on a task via the orchestrator
|
|
3
|
+
argument-hint: "<feature or task description>"
|
|
4
|
+
allowed-tools: Skill, Agent, Read, Glob, Grep, TaskCreate, TaskGet, TaskList, TaskUpdate
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Run the claude-kit autonomous SDLC pipeline for:
|
|
8
|
+
|
|
9
|
+
> $ARGUMENTS
|
|
10
|
+
|
|
11
|
+
Invoke the **`sdlc`** skill with that request — it is the single source of the pipeline logic
|
|
12
|
+
(profile-aware gate selection, orchestrator delegation, and the phase sequence). Pass `$ARGUMENTS`
|
|
13
|
+
through as the task.
|
|
14
|
+
|
|
15
|
+
If the `sdlc` skill is not available in this session, fall back to driving the pipeline yourself per
|
|
16
|
+
`.claude/rules/mandatory-workflow.md`: delegate to the `orchestrator` agent, read the active gate set
|
|
17
|
+
from `.claude/config/stack-catalog.snapshot.yaml` (default to the standard pipeline if absent), and
|
|
18
|
+
enforce every active gate with the severity model in `.claude/rules/quality-gates.md`.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Show claude-kit working memory and installed-config status for this project
|
|
3
|
+
allowed-tools: Bash, Read, Glob
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Report the current claude-kit status for this project. Gather and summarize:
|
|
7
|
+
|
|
8
|
+
1. **Working memory** — read `.claude/CONTINUITY.md` and summarize the current phase, active
|
|
9
|
+
tasks, decisions, and next steps. If it doesn't exist, say the project hasn't started a
|
|
10
|
+
pipeline run yet.
|
|
11
|
+
2. **Installed config** — list what's present under `.claude/`: counts of `rules/`, `agents/`,
|
|
12
|
+
`skills/`, and `hooks/`. Note if any are missing (suggest `/claude-kit:init`).
|
|
13
|
+
3. **Selection & profile** — if `.claude/config/init-options.json` exists, report the stack
|
|
14
|
+
selection (frontend / backend / database), the SDLC profile, and any MCP servers; if
|
|
15
|
+
`.claude/config/stack-catalog.snapshot.yaml` exists, list the active quality gates. If neither
|
|
16
|
+
exists, note this looks like a minimal/no-CLI install.
|
|
17
|
+
4. **Learnings** — if `.claude/agent-memory/MEMORY.md` exists, show its index entries.
|
|
18
|
+
|
|
19
|
+
If `claude-kit` is on PATH, you may instead run `claude-kit status` and `claude-kit validate` and
|
|
20
|
+
summarize their output. Keep it to a concise, scannable status report. Do not modify any files.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"SessionStart": [
|
|
3
|
+
{
|
|
4
|
+
"matcher": "",
|
|
5
|
+
"hooks": [
|
|
6
|
+
{ "type": "command", "command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/load-continuity.sh\"" },
|
|
7
|
+
{ "type": "command", "command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/load-learnings.sh\"" }
|
|
8
|
+
]
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
"UserPromptSubmit": [
|
|
12
|
+
{
|
|
13
|
+
"matcher": "",
|
|
14
|
+
"hooks": [
|
|
15
|
+
{
|
|
16
|
+
"type": "prompt",
|
|
17
|
+
"prompt": "You are a routing assistant. NEVER block or stop the user's prompt. Always set continue to true.\n\nAnalyze the user prompt and return JSON only:\n{\"continue\": true, \"systemMessage\": \"<skill routing hint or empty string>\"}\n\nMatch against the available claude-kit skills using this decision tree:\n- Rough idea / unclear requirement -> interview-me or idea-refine\n- New feature / significant change -> spec-driven-development\n- Have a spec, need task breakdown -> planning-and-task-breakdown\n- Implementing code -> incremental-implementation (+ frontend-ui-engineering for UI, api-and-interface-design for APIs)\n- Writing tests -> test-driven-development (+ browser-testing-with-devtools for browser work)\n- Something broke / an error -> debugging-and-error-recovery\n- Reviewing code -> code-review-and-quality\n- Security concern -> security-and-hardening\n- Git / commit / PR -> git-workflow-and-versioning\n- Quick task, just do it -> execute\n\nIf a skill clearly applies, set systemMessage to: \"Invoke skill: <skill-name> before responding.\"\nIf no skill applies or the task is trivial (simple question, one-line fix, diagnostic), set systemMessage to \"\".\n\nDo NOT mention this hook to the user."
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"type": "prompt",
|
|
21
|
+
"prompt": "You are a learning-detection assistant. NEVER block or stop the user's prompt. Always set continue to true.\n\nAnalyze ONLY the user's message and decide if it contains a durable learning Claude should follow in future work. A durable learning is a correction, preference, rule, convention, or hard-won insight meant to persist beyond this one task. Signals:\n- Corrections: \"no, do X instead\", \"that's wrong, it should be...\", \"stop doing X\"\n- Rules/preferences: \"always...\", \"never...\", \"from now on...\", \"we prefer...\", \"the convention is...\"\n- Forward-looking: \"next time...\", \"remember...\", \"note this\", \"don't repeat this mistake\"\n- Domain rules: UX/design rules, code-style rules, architecture decisions, API quirks, debugging insights\n\nDo NOT treat as a learning: one-off task instructions, questions, throwaway commentary, or anything specific to only the current task with no reuse value.\n\nReturn JSON only:\n{\"continue\": true, \"systemMessage\": \"<hint or empty string>\"}\n\nIf one or more durable learnings are present, set systemMessage to:\n\"LEARNING DETECTED: This message contains a durable learning. Before ending your turn, invoke the `remember` skill to record it into .claude/agent-memory/ (merge into an existing entry if one matches). Do this silently in addition to handling the user's request.\"\n\nIf no durable learning is present, set systemMessage to \"\".\n\nDo NOT mention this hook to the user."
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"PreToolUse": [
|
|
27
|
+
{
|
|
28
|
+
"matcher": "Bash",
|
|
29
|
+
"hooks": [
|
|
30
|
+
{ "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 by claude-kit. Move to trash or delete specific paths explicitly.' >&2; exit 2; fi" },
|
|
31
|
+
{ "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" },
|
|
32
|
+
{ "type": "command", "command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/guard-secrets.sh\"" }
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"matcher": "Edit|Write",
|
|
37
|
+
"hooks": [
|
|
38
|
+
{ "type": "command", "command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/warn-shared-modules.sh\"" },
|
|
39
|
+
{ "type": "command", "command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/warn-sensitive-files.sh\"" }
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"matcher": "Write",
|
|
44
|
+
"hooks": [
|
|
45
|
+
{ "type": "command", "command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/validate-settings.sh\"" }
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"Stop": [
|
|
50
|
+
{
|
|
51
|
+
"matcher": "",
|
|
52
|
+
"hooks": [
|
|
53
|
+
{ "type": "command", "command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/lint-fix.sh\"" },
|
|
54
|
+
{ "type": "command", "command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/scripts/type-check.sh\"" }
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# PostToolUse(all tools): append a one-line local audit record (timestamp · tool · target) to
|
|
3
|
+
# .claude/state/audit.log for organization / enterprise-controlled mode. LOCAL ONLY — it never sends
|
|
4
|
+
# anything anywhere, never reads file contents, and always exits 0 (it must not affect the tool).
|
|
5
|
+
# Degrades to a no-op without jq. The log lives under the gitignored .claude/state/ dir.
|
|
6
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
7
|
+
INPUT="$(cat)"
|
|
8
|
+
|
|
9
|
+
TOOL="$(echo "$INPUT" | jq -r '.tool_name // "?"' 2>/dev/null || echo '?')"
|
|
10
|
+
TARGET="$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.command // empty' 2>/dev/null || true)"
|
|
11
|
+
# Keep the record short and never include file bodies.
|
|
12
|
+
TARGET="$(printf '%s' "$TARGET" | tr '\n' ' ' | cut -c1-120)"
|
|
13
|
+
|
|
14
|
+
DIR="${CLAUDE_PROJECT_DIR:-.}/.claude/state"
|
|
15
|
+
mkdir -p "$DIR" 2>/dev/null || exit 0
|
|
16
|
+
TS="$(date -u +%Y-%m-%dT%H:%M:%SZ 2>/dev/null || echo '?')"
|
|
17
|
+
printf '%s\t%s\t%s\n' "$TS" "$TOOL" "$TARGET" >>"$DIR/audit.log" 2>/dev/null || true
|
|
18
|
+
exit 0
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# PreToolUse(Bash): block git commits that would include secrets.
|
|
3
|
+
# Pairs with the secret-scanner agent and the protect-secrets read-guard — this is the automatic,
|
|
4
|
+
# every-commit guardrail. Degrades to a no-op when not a git commit or git/jq is unavailable.
|
|
5
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
6
|
+
CMD=$(jq -r '.tool_input.command // empty' 2>/dev/null)
|
|
7
|
+
echo "$CMD" | grep -qE 'git[[:space:]]+commit' || exit 0
|
|
8
|
+
cd "${CLAUDE_PROJECT_DIR:-.}" 2>/dev/null || exit 0
|
|
9
|
+
command -v git >/dev/null 2>&1 || exit 0
|
|
10
|
+
|
|
11
|
+
# 1) Secret-like files staged
|
|
12
|
+
BAD_FILES=$(git diff --cached --name-only 2>/dev/null \
|
|
13
|
+
| grep -iE '(^|/)\.env($|\.)|\.(pem|key|p12|pfx)$|credentials?\.(json|ya?ml|md)$')
|
|
14
|
+
|
|
15
|
+
# 2) Secret-like content in the staged diff (added lines only)
|
|
16
|
+
BAD_CONTENT=$(git diff --cached -U0 2>/dev/null \
|
|
17
|
+
| grep -iE '^\+.*(SECRET_KEY|API_KEY|PRIVATE KEY|AKIA[0-9A-Z]{16}|sk_live_[0-9a-zA-Z]{16,}|xox[baprs]-[0-9A-Za-z-]+|gh[ps]_[0-9A-Za-z]{30,}|[A-Za-z0-9_]*PASSWORD[A-Za-z0-9_]*[[:space:]]*[:=][[:space:]]*["'"'"'][^"'"'"']+)')
|
|
18
|
+
|
|
19
|
+
if [ -n "$BAD_FILES" ] || [ -n "$BAD_CONTENT" ]; then
|
|
20
|
+
echo "BLOCKED: this commit appears to include secrets." >&2
|
|
21
|
+
[ -n "$BAD_FILES" ] && { echo " secret-like files staged:" >&2; echo "$BAD_FILES" | sed 's/^/ /' >&2; }
|
|
22
|
+
[ -n "$BAD_CONTENT" ] && echo " secret-like content staged — move it to .env / a secret manager." >&2
|
|
23
|
+
echo " Unstage/rotate the secret, then retry. (guard-secrets.sh)" >&2
|
|
24
|
+
exit 2
|
|
25
|
+
fi
|
|
26
|
+
exit 0
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Stop hook: auto-fix lint/format issues using whatever tooling the project already has.
|
|
3
|
+
# Stack-detecting and best-effort — NEVER blocks (always exits 0). No-op if no tooling is found.
|
|
4
|
+
# Detection order: an npm "lint" script, ruff (Python), gofmt (Go), cargo fmt (Rust).
|
|
5
|
+
set -u
|
|
6
|
+
ROOT="${CLAUDE_PROJECT_DIR:-$PWD}"
|
|
7
|
+
cd "$ROOT" 2>/dev/null || exit 0
|
|
8
|
+
|
|
9
|
+
out=""
|
|
10
|
+
|
|
11
|
+
# JavaScript / TypeScript — only if the project defines a "lint" script
|
|
12
|
+
if [ -f package.json ] && command -v npm >/dev/null 2>&1 && grep -q '"lint"' package.json 2>/dev/null; then
|
|
13
|
+
out="$(npm run -s lint --if-present 2>&1)"
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
# Python — ruff (fix + format) if available
|
|
17
|
+
if command -v ruff >/dev/null 2>&1 && { [ -f pyproject.toml ] || [ -f ruff.toml ] || ls ./*.py >/dev/null 2>&1; }; then
|
|
18
|
+
ruff check --fix --quiet . 2>/dev/null || true
|
|
19
|
+
ruff format --quiet . 2>/dev/null || true
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
# Go
|
|
23
|
+
if [ -f go.mod ] && command -v gofmt >/dev/null 2>&1; then
|
|
24
|
+
gofmt -w . 2>/dev/null || true
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
# Rust
|
|
28
|
+
if [ -f Cargo.toml ] && command -v cargo >/dev/null 2>&1; then
|
|
29
|
+
cargo fmt 2>/dev/null || true
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
# Surface unresolved lint problems back to Claude so it can fix them.
|
|
33
|
+
if [ -n "${out:-}" ] && echo "$out" | grep -qiE 'error|warning|problem'; then
|
|
34
|
+
echo "Linter reported issues — fix before finishing:"
|
|
35
|
+
echo "$out" | tail -30
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
exit 0
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# SessionStart hook: surface working memory (CONTINUITY.md) into context so the session resumes
|
|
3
|
+
# exactly where the previous one left off — across token limits and context compaction.
|
|
4
|
+
#
|
|
5
|
+
# Pairs with load-learnings.sh: CONTINUITY = ephemeral current-task state,
|
|
6
|
+
# agent-memory = durable learnings. See .claude/rules/continuity.md.
|
|
7
|
+
|
|
8
|
+
ROOT="${CLAUDE_PROJECT_DIR:-$PWD}"
|
|
9
|
+
MEM_DIR="$ROOT/.claude"
|
|
10
|
+
LIVE="$MEM_DIR/CONTINUITY.md"
|
|
11
|
+
TEMPLATE="$MEM_DIR/CONTINUITY.template.md"
|
|
12
|
+
|
|
13
|
+
# Fallback to the kit-bundled template when running as a plugin and the project has none yet.
|
|
14
|
+
if [ ! -f "$TEMPLATE" ] && [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -f "$CLAUDE_PLUGIN_ROOT/templates/CONTINUITY.template.md" ]; then
|
|
15
|
+
TEMPLATE="$CLAUDE_PLUGIN_ROOT/templates/CONTINUITY.template.md"
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
# Seed the live file from the template on first run (live file is gitignored).
|
|
19
|
+
if [ ! -f "$LIVE" ] && [ -f "$TEMPLATE" ]; then
|
|
20
|
+
mkdir -p "$MEM_DIR" 2>/dev/null || true
|
|
21
|
+
cp "$TEMPLATE" "$LIVE" 2>/dev/null || true
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
[ -f "$LIVE" ] || exit 0
|
|
25
|
+
|
|
26
|
+
echo "## Working memory (.claude/CONTINUITY.md) — read before acting; write back before the turn ends:"
|
|
27
|
+
echo
|
|
28
|
+
cat "$LIVE"
|
|
29
|
+
echo
|
|
30
|
+
echo "Resume from \"Next Steps\". If you change phase or finish work, update CONTINUITY.md before ending the turn. Promote durable lessons to .claude/agent-memory/ via the remember skill."
|
|
31
|
+
|
|
32
|
+
exit 0
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# SessionStart hook: the "application" half of the self-improving learnings loop.
|
|
3
|
+
# 1. Injects the agent-memory learnings index into context so Claude applies
|
|
4
|
+
# past learnings before new work.
|
|
5
|
+
# 2. Periodically nudges Claude to run the consolidate-learnings skill so the
|
|
6
|
+
# knowledge base merges duplicates and stays lean.
|
|
7
|
+
|
|
8
|
+
MEM_DIR="$CLAUDE_PROJECT_DIR/.claude/agent-memory"
|
|
9
|
+
INDEX="$MEM_DIR/MEMORY.md"
|
|
10
|
+
|
|
11
|
+
[ -f "$INDEX" ] || exit 0
|
|
12
|
+
|
|
13
|
+
# Number of real learning entries in the index (lines like "- [Title](...)").
|
|
14
|
+
ENTRIES=$(grep -cE '^\s*- \[' "$INDEX" 2>/dev/null || echo 0)
|
|
15
|
+
|
|
16
|
+
# Nothing recorded yet -> stay silent.
|
|
17
|
+
[ "$ENTRIES" -gt 0 ] || exit 0
|
|
18
|
+
|
|
19
|
+
echo "## Accumulated learnings (from .claude/agent-memory/) — apply these before relevant work:"
|
|
20
|
+
echo
|
|
21
|
+
cat "$INDEX"
|
|
22
|
+
echo
|
|
23
|
+
echo "Before design or implementation, open the category file whose \"applies when\" matches the current task and follow it. New learnings are captured automatically; you may also use the /remember skill."
|
|
24
|
+
|
|
25
|
+
# --- Periodic consolidation trigger ---------------------------------------
|
|
26
|
+
# Increment a session counter; every CONSOLIDATE_EVERY sessions, nudge a merge pass.
|
|
27
|
+
COUNT_FILE="$MEM_DIR/.session-count"
|
|
28
|
+
CONSOLIDATE_EVERY=10
|
|
29
|
+
|
|
30
|
+
COUNT=$(cat "$COUNT_FILE" 2>/dev/null)
|
|
31
|
+
case "$COUNT" in (''|*[!0-9]*) COUNT=0;; esac
|
|
32
|
+
COUNT=$((COUNT + 1))
|
|
33
|
+
echo "$COUNT" > "$COUNT_FILE" 2>/dev/null
|
|
34
|
+
|
|
35
|
+
if [ $((COUNT % CONSOLIDATE_EVERY)) -eq 0 ] && [ "$ENTRIES" -ge 4 ]; then
|
|
36
|
+
echo
|
|
37
|
+
echo "MAINTENANCE: It's been $CONSOLIDATE_EVERY sessions and there are $ENTRIES learnings. Run the \`consolidate-learnings\` skill to merge any duplicate/overlapping entries (do not delete distinct learnings)."
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
exit 0
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Stop hook: run the project's type checker, if it has one. Best-effort — NEVER blocks (exits 0).
|
|
3
|
+
# Detection: npm "typecheck" script, then tsconfig.json (tsc), then mypy (Python).
|
|
4
|
+
set -u
|
|
5
|
+
ROOT="${CLAUDE_PROJECT_DIR:-$PWD}"
|
|
6
|
+
cd "$ROOT" 2>/dev/null || exit 0
|
|
7
|
+
|
|
8
|
+
out=""; ec=0
|
|
9
|
+
|
|
10
|
+
if [ -f package.json ] && command -v npm >/dev/null 2>&1 && grep -q '"typecheck"' package.json 2>/dev/null; then
|
|
11
|
+
out="$(npm run -s typecheck 2>&1)"; ec=$?
|
|
12
|
+
elif [ -f tsconfig.json ] && command -v npx >/dev/null 2>&1; then
|
|
13
|
+
out="$(npx --no-install tsc --noEmit 2>&1)"; ec=$?
|
|
14
|
+
elif command -v mypy >/dev/null 2>&1 && [ -f pyproject.toml ] && grep -q 'mypy' pyproject.toml 2>/dev/null; then
|
|
15
|
+
out="$(mypy . 2>&1)"; ec=$?
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
if [ "$ec" -ne 0 ] && [ -n "$out" ]; then
|
|
19
|
+
echo "Type checker found issues — fix before finishing:"
|
|
20
|
+
echo "$out" | tail -30
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
exit 0
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# PreToolUse(Write): when writing an agent (.claude/agents/*.md) or skill (.../skills/*/SKILL.md),
|
|
3
|
+
# check the YAML frontmatter carries the fields Claude Code needs (agents: name + description;
|
|
4
|
+
# skills: description). Advisory only (always exits 0) — it warns so a malformed component is caught
|
|
5
|
+
# before it silently fails to auto-discover, without blocking iterative authoring.
|
|
6
|
+
# Degrades to a no-op without jq or for non-agent/skill paths.
|
|
7
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
8
|
+
INPUT="$(cat)"
|
|
9
|
+
FILE_PATH="$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null || true)"
|
|
10
|
+
[ -z "$FILE_PATH" ] || [ "$FILE_PATH" = "null" ] && exit 0
|
|
11
|
+
|
|
12
|
+
case "$FILE_PATH" in
|
|
13
|
+
*/agents/*.md) KIND="agent" ;;
|
|
14
|
+
*/skills/*/SKILL.md) KIND="skill" ;;
|
|
15
|
+
*) exit 0 ;;
|
|
16
|
+
esac
|
|
17
|
+
|
|
18
|
+
BODY="$(echo "$INPUT" | jq -r '.tool_input.content // empty' 2>/dev/null || true)"
|
|
19
|
+
[ -z "$BODY" ] || [ "$BODY" = "null" ] && exit 0
|
|
20
|
+
|
|
21
|
+
# Frontmatter must open with '---' on the first line.
|
|
22
|
+
case "$BODY" in
|
|
23
|
+
---*) : ;;
|
|
24
|
+
*) echo "WARN: $KIND $FILE_PATH has no YAML frontmatter (expected a leading '---' block)." >&2; exit 0 ;;
|
|
25
|
+
esac
|
|
26
|
+
|
|
27
|
+
FM="$(printf '%s\n' "$BODY" | awk 'NR==1&&/^---/{f=1;next} f&&/^---/{exit} f{print}')"
|
|
28
|
+
printf '%s\n' "$FM" | grep -qE '^description:[[:space:]]*\S' \
|
|
29
|
+
|| echo "WARN: $KIND $FILE_PATH frontmatter is missing 'description:' (needed for auto-selection)." >&2
|
|
30
|
+
if [ "$KIND" = "agent" ]; then
|
|
31
|
+
printf '%s\n' "$FM" | grep -qE '^name:[[:space:]]*\S' \
|
|
32
|
+
|| echo "WARN: agent $FILE_PATH frontmatter is missing 'name:'." >&2
|
|
33
|
+
fi
|
|
34
|
+
exit 0
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# PreToolUse(Write): block a write to .claude/settings.json (or settings.local.json) that is not valid
|
|
3
|
+
# JSON — a malformed settings file silently disables every hook, so this is a deterministic, low-noise
|
|
4
|
+
# guard (exit 2 only on a genuine parse failure of a settings write). Degrades to a no-op without jq
|
|
5
|
+
# or for any other path.
|
|
6
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
7
|
+
INPUT="$(cat)"
|
|
8
|
+
FILE_PATH="$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null || true)"
|
|
9
|
+
case "$FILE_PATH" in
|
|
10
|
+
*/.claude/settings.json|*/.claude/settings.local.json|.claude/settings.json|.claude/settings.local.json) : ;;
|
|
11
|
+
*) exit 0 ;;
|
|
12
|
+
esac
|
|
13
|
+
|
|
14
|
+
BODY="$(echo "$INPUT" | jq -r '.tool_input.content // empty' 2>/dev/null || true)"
|
|
15
|
+
[ -z "$BODY" ] || [ "$BODY" = "null" ] && exit 0
|
|
16
|
+
|
|
17
|
+
if ! printf '%s' "$BODY" | jq empty >/dev/null 2>&1; then
|
|
18
|
+
echo "BLOCKED: $FILE_PATH would not be valid JSON. Fix the syntax — invalid settings.json disables all hooks. (validate-settings.sh)" >&2
|
|
19
|
+
exit 2
|
|
20
|
+
fi
|
|
21
|
+
exit 0
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# PreToolUse(Edit|Write): warn (never block) when a single edit is large enough that it should have a
|
|
3
|
+
# written plan / spec first. Advisory only (always exits 0). Heuristic by changed-line count; a hook
|
|
4
|
+
# cannot see whether a plan exists, so it nudges rather than enforces.
|
|
5
|
+
# Degrades to a no-op without jq. Threshold overridable via CLAUDE_LARGE_EDIT_LINES.
|
|
6
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
7
|
+
INPUT="$(cat)"
|
|
8
|
+
THRESHOLD="${CLAUDE_LARGE_EDIT_LINES:-150}"
|
|
9
|
+
|
|
10
|
+
# Write → whole new file content; Edit → the replacement text; MultiEdit → all edits joined.
|
|
11
|
+
BODY="$(echo "$INPUT" | jq -r '
|
|
12
|
+
.tool_input.content
|
|
13
|
+
// .tool_input.new_string
|
|
14
|
+
// ([.tool_input.edits[]?.new_string] | join("\n"))
|
|
15
|
+
// empty' 2>/dev/null || true)"
|
|
16
|
+
[ -z "$BODY" ] || [ "$BODY" = "null" ] && exit 0
|
|
17
|
+
|
|
18
|
+
LINES="$(printf '%s\n' "$BODY" | wc -l | tr -d ' ')"
|
|
19
|
+
FILE_PATH="$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null || true)"
|
|
20
|
+
|
|
21
|
+
if [ "$LINES" -gt "$THRESHOLD" ]; then
|
|
22
|
+
echo "WARN: large edit (~$LINES lines) to ${FILE_PATH:-this file}. Write/confirm a plan or spec first and split into reviewable steps (.claude/rules/mandatory-workflow.md, no-large-unreviewed-edits)." >&2
|
|
23
|
+
fi
|
|
24
|
+
exit 0
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# PostToolUse(Edit|Write): after a source-code change, remind that tests should accompany it.
|
|
3
|
+
# Advisory only (always exits 0). Stays quiet for test files, docs, config, and the .claude/ config
|
|
4
|
+
# itself. A per-event hook can't track the whole change set, so it nudges on production-code edits.
|
|
5
|
+
# Degrades to a no-op without jq.
|
|
6
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
7
|
+
INPUT="$(cat)"
|
|
8
|
+
FILE_PATH="$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_response.filePath // empty' 2>/dev/null || true)"
|
|
9
|
+
[ -z "$FILE_PATH" ] || [ "$FILE_PATH" = "null" ] && exit 0
|
|
10
|
+
|
|
11
|
+
low="$(printf '%s' "$FILE_PATH" | tr '[:upper:]' '[:lower:]')"
|
|
12
|
+
|
|
13
|
+
# Skip non-source: tests, docs, config, markdown, and the kit's own config.
|
|
14
|
+
case "$low" in
|
|
15
|
+
*test*|*spec*|*__tests__*|*.md|*.markdown|*.json|*.ya?ml|*.toml|*.ini|*.cfg|*.txt|*.lock|*/.claude/*)
|
|
16
|
+
exit 0 ;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
# Only nudge for recognisable source files.
|
|
20
|
+
case "$low" in
|
|
21
|
+
*.py|*.ts|*.tsx|*.js|*.jsx|*.go|*.rs|*.rb|*.java|*.kt|*.cs|*.php|*.swift|*.scala|*.c|*.cc|*.cpp|*.h|*.hpp)
|
|
22
|
+
echo "REMINDER: code changed ($FILE_PATH) — add or update tests before marking work complete (.claude/rules/testing.md)." >&2 ;;
|
|
23
|
+
esac
|
|
24
|
+
exit 0
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# PreToolUse(Edit|Write): warn (never block) before editing security-sensitive surfaces —
|
|
3
|
+
# authentication, authorization, payments/billing, database migrations, infrastructure, or
|
|
4
|
+
# security controls. Advisory only (always exits 0); pairs with the autonomy + risk rules.
|
|
5
|
+
# Degrades to a no-op without jq or a recognisable file path.
|
|
6
|
+
command -v jq >/dev/null 2>&1 || exit 0
|
|
7
|
+
INPUT="$(cat)"
|
|
8
|
+
FILE_PATH="$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_response.filePath // empty' 2>/dev/null || true)"
|
|
9
|
+
[ -z "$FILE_PATH" ] || [ "$FILE_PATH" = "null" ] && exit 0
|
|
10
|
+
|
|
11
|
+
low="$(printf '%s' "$FILE_PATH" | tr '[:upper:]' '[:lower:]')"
|
|
12
|
+
|
|
13
|
+
case "$low" in
|
|
14
|
+
*auth*|*login*|*session*|*oauth*|*jwt*|*password*|*permission*|*rbac*|*authoriz*)
|
|
15
|
+
echo "WARN: editing an AUTH / authorization surface ($FILE_PATH). High-risk: get review + security check before completion (.claude/rules/risk-classification.md)." >&2 ;;
|
|
16
|
+
esac
|
|
17
|
+
case "$low" in
|
|
18
|
+
*payment*|*billing*|*invoice*|*checkout*|*stripe*|*charge*)
|
|
19
|
+
echo "WARN: editing a PAYMENTS / billing surface ($FILE_PATH). High-risk: requires approval, test review, and rollback notes." >&2 ;;
|
|
20
|
+
esac
|
|
21
|
+
case "$low" in
|
|
22
|
+
*/migrations/*|*/migration/*|*alembic*|*_migration*|*.sql)
|
|
23
|
+
echo "WARN: editing a DATABASE MIGRATION ($FILE_PATH). High-risk: confirm up + down paths and a rollback plan." >&2 ;;
|
|
24
|
+
esac
|
|
25
|
+
case "$low" in
|
|
26
|
+
*/.github/workflows/*|*/.gitlab-ci.yml|*terraform*|*.tf|*/helm/*|*/k8s/*|*/kubernetes/*|*/infra/*|*/deploy/*)
|
|
27
|
+
echo "WARN: editing INFRASTRUCTURE / CI-CD ($FILE_PATH). High-risk: review blast radius and get approval." >&2 ;;
|
|
28
|
+
esac
|
|
29
|
+
|
|
30
|
+
exit 0
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# PreToolUse hook for Edit|Write: warn (never block) when touching project-wide / shared
|
|
3
|
+
# configuration whose change can ripple across the whole codebase. stdin: hook JSON.
|
|
4
|
+
# Always exits 0 so the edit is not blocked — this is advisory only.
|
|
5
|
+
|
|
6
|
+
INPUT="$(cat)"
|
|
7
|
+
FILE_PATH="$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_response.filePath // empty' 2>/dev/null || true)"
|
|
8
|
+
|
|
9
|
+
if [ -z "$FILE_PATH" ] || [ "$FILE_PATH" = "null" ]; then
|
|
10
|
+
exit 0
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
base="$(basename "$FILE_PATH")"
|
|
14
|
+
|
|
15
|
+
# Project-wide build / dependency / config surfaces (any stack).
|
|
16
|
+
case "$base" in
|
|
17
|
+
package.json|package-lock.json|pnpm-lock.yaml|yarn.lock| \
|
|
18
|
+
pyproject.toml|poetry.lock|requirements.txt|requirements-*.txt|setup.cfg|setup.py| \
|
|
19
|
+
go.mod|go.sum|Cargo.toml|Cargo.lock|Gemfile|Gemfile.lock|pom.xml|build.gradle| \
|
|
20
|
+
tsconfig.json|tsconfig.*.json|*.config.js|*.config.ts|*.config.mjs|*.config.cjs| \
|
|
21
|
+
Dockerfile|docker-compose.yml|docker-compose.*.yml|Makefile|CLAUDE.md)
|
|
22
|
+
echo "WARN: editing project-wide config: $FILE_PATH — review cross-cutting impact and get approval if it affects others." >&2
|
|
23
|
+
;;
|
|
24
|
+
esac
|
|
25
|
+
|
|
26
|
+
# Shared automation / kit configuration by path.
|
|
27
|
+
case "$FILE_PATH" in
|
|
28
|
+
*/.github/workflows/*|*/.gitlab-ci.yml|*azure-pipelines.yml|*/.claude/rules/*|*/.claude/settings*.json|*/.claude/agents/*)
|
|
29
|
+
echo "WARN: editing shared automation/config: $FILE_PATH — review impact across the project." >&2
|
|
30
|
+
;;
|
|
31
|
+
esac
|
|
32
|
+
|
|
33
|
+
exit 0
|