codebyplan 1.5.1 → 1.8.0
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.
- package/dist/cli.js +4462 -748
- package/package.json +5 -1
- package/templates/.gitkeep +0 -0
- package/templates/README.md +20 -0
- package/templates/agents/cbp-cc-executor.md +213 -0
- package/templates/agents/cbp-database-agent.md +229 -0
- package/templates/agents/cbp-improve-claude.md +245 -0
- package/templates/agents/cbp-improve-round.md +284 -0
- package/templates/agents/cbp-mechanical-edits.md +111 -0
- package/templates/agents/cbp-research.md +282 -0
- package/templates/agents/cbp-round-executor.md +604 -0
- package/templates/agents/cbp-security-agent.md +134 -0
- package/templates/agents/cbp-task-check.md +213 -0
- package/templates/agents/cbp-task-planner.md +582 -0
- package/templates/agents/cbp-test-e2e-agent.md +363 -0
- package/templates/agents/cbp-testing-qa-agent.md +400 -0
- package/templates/context/mcp-docs.md +139 -0
- package/templates/hooks/README.md +236 -0
- package/templates/hooks/cbp-auto-test-hooks.sh +44 -0
- package/templates/hooks/cbp-lint-format-on-edit.sh +159 -0
- package/templates/hooks/cbp-maestro-yaml-validate.sh +100 -0
- package/templates/hooks/cbp-mcp-migration-guard.sh +32 -0
- package/templates/hooks/cbp-mcp-round-sync.sh +79 -0
- package/templates/hooks/cbp-mcp-worktree-inject.sh +76 -0
- package/templates/hooks/cbp-notify.sh +68 -0
- package/templates/hooks/cbp-plugin-dispatch.sh +29 -0
- package/templates/hooks/cbp-pre-commit-quality-gate.sh +204 -0
- package/templates/hooks/cbp-statusline.sh +347 -0
- package/templates/hooks/cbp-subagent-statusline.sh +182 -0
- package/templates/hooks/cbp-test-coverage-gate.sh +144 -0
- package/templates/hooks/cbp-test-hooks.sh +320 -0
- package/templates/hooks/hooks.json +85 -0
- package/templates/hooks/validate-context-usage.sh +59 -0
- package/templates/hooks/validate-git-commit.sh +78 -0
- package/templates/hooks/validate-git-stash-deny.sh +32 -0
- package/templates/hooks/validate-structure-lengths.sh +57 -0
- package/templates/hooks/validate-structure-lib.sh +104 -0
- package/templates/hooks/validate-structure-patterns.sh +54 -0
- package/templates/hooks/validate-structure-scope.sh +33 -0
- package/templates/hooks/validate-structure-smoke.sh +95 -0
- package/templates/hooks/validate-structure-templates.sh +34 -0
- package/templates/hooks/validate-structure.sh +69 -0
- package/templates/rules/.gitkeep +0 -0
- package/templates/rules/README.md +47 -0
- package/templates/rules/context-file-loading.md +52 -0
- package/templates/rules/scope-vocabulary.md +64 -0
- package/templates/rules/todo-backend.md +109 -0
- package/templates/settings.project.base.json +55 -0
- package/templates/settings.user.base.json +25 -0
- package/templates/skills/cbp-build-cc-agent/SKILL.md +139 -0
- package/templates/skills/cbp-build-cc-agent/examples/read-only-reviewer.md +32 -0
- package/templates/skills/cbp-build-cc-agent/examples/with-hooks.md +41 -0
- package/templates/skills/cbp-build-cc-agent/examples/with-skills-preload.md +25 -0
- package/templates/skills/cbp-build-cc-agent/reference/cbp-quality.md +153 -0
- package/templates/skills/cbp-build-cc-agent/reference/frontmatter-fields.md +37 -0
- package/templates/skills/cbp-build-cc-agent/reference/permission-modes.md +18 -0
- package/templates/skills/cbp-build-cc-agent/scripts/validate-agent.sh +67 -0
- package/templates/skills/cbp-build-cc-agent/templates/agent.md +66 -0
- package/templates/skills/cbp-build-cc-claude-file/SKILL.md +178 -0
- package/templates/skills/cbp-build-cc-claude-file/examples/minimal-project.md +33 -0
- package/templates/skills/cbp-build-cc-claude-file/examples/monorepo-with-imports.md +39 -0
- package/templates/skills/cbp-build-cc-claude-file/reference/imports.md +72 -0
- package/templates/skills/cbp-build-cc-claude-file/reference/what-belongs.md +39 -0
- package/templates/skills/cbp-build-cc-claude-file/templates/project-claude-md.md +48 -0
- package/templates/skills/cbp-build-cc-claude-file/templates/user-claude-md.md +22 -0
- package/templates/skills/cbp-build-cc-memory/SKILL.md +201 -0
- package/templates/skills/cbp-build-cc-memory/examples/feedback-memory.md +11 -0
- package/templates/skills/cbp-build-cc-memory/examples/project-memory.md +11 -0
- package/templates/skills/cbp-build-cc-memory/examples/reference-memory.md +13 -0
- package/templates/skills/cbp-build-cc-memory/examples/user-memory.md +14 -0
- package/templates/skills/cbp-build-cc-memory/reference/memory-types.md +59 -0
- package/templates/skills/cbp-build-cc-memory/reference/when-to-save.md +62 -0
- package/templates/skills/cbp-build-cc-memory/templates/MEMORY-index.md +4 -0
- package/templates/skills/cbp-build-cc-memory/templates/memory-entry.md +15 -0
- package/templates/skills/cbp-build-cc-mode/SKILL.md +99 -0
- package/templates/skills/cbp-build-cc-rule/SKILL.md +176 -0
- package/templates/skills/cbp-build-cc-rule/examples/global-rule.md +19 -0
- package/templates/skills/cbp-build-cc-rule/examples/scoped-rule.md +41 -0
- package/templates/skills/cbp-build-cc-rule/reference/paths-patterns.md +48 -0
- package/templates/skills/cbp-build-cc-rule/templates/rule.md +32 -0
- package/templates/skills/cbp-build-cc-settings/SKILL.md +220 -0
- package/templates/skills/cbp-build-cc-settings/examples/hooks-config.json +64 -0
- package/templates/skills/cbp-build-cc-settings/examples/permissions-config.json +34 -0
- package/templates/skills/cbp-build-cc-settings/examples/sandbox-config.json +42 -0
- package/templates/skills/cbp-build-cc-settings/reference/cbp-conventions.md +104 -0
- package/templates/skills/cbp-build-cc-settings/reference/permission-rules.md +61 -0
- package/templates/skills/cbp-build-cc-settings/reference/scope-precedence.md +73 -0
- package/templates/skills/cbp-build-cc-settings/reference/settings-fields.md +166 -0
- package/templates/skills/cbp-build-cc-settings/templates/settings.json +23 -0
- package/templates/skills/cbp-build-cc-settings/templates/settings.local.json +10 -0
- package/templates/skills/cbp-build-cc-skill/SKILL.md +154 -0
- package/templates/skills/cbp-build-cc-skill/examples/dynamic-context.md +31 -0
- package/templates/skills/cbp-build-cc-skill/examples/fork-skill.md +22 -0
- package/templates/skills/cbp-build-cc-skill/examples/knowledge-skill.md +25 -0
- package/templates/skills/cbp-build-cc-skill/examples/task-skill.md +29 -0
- package/templates/skills/cbp-build-cc-skill/reference/cbp-quality.md +157 -0
- package/templates/skills/cbp-build-cc-skill/reference/frontmatter-fields.md +35 -0
- package/templates/skills/cbp-build-cc-skill/reference/string-substitutions.md +60 -0
- package/templates/skills/cbp-build-cc-skill/scripts/validate-skill.sh +90 -0
- package/templates/skills/cbp-build-cc-skill/templates/skill.md +51 -0
- package/templates/skills/cbp-checkpoint-check/SKILL.md +156 -0
- package/templates/skills/cbp-checkpoint-complete/SKILL.md +109 -0
- package/templates/skills/cbp-checkpoint-create/SKILL.md +287 -0
- package/templates/skills/cbp-checkpoint-end/SKILL.md +241 -0
- package/templates/skills/cbp-checkpoint-update/SKILL.md +115 -0
- package/templates/skills/cbp-frontend-a11y/SKILL.md +109 -0
- package/templates/skills/cbp-frontend-a11y/reference/aria-roles-states.md +130 -0
- package/templates/skills/cbp-frontend-a11y/reference/contrast-visual.md +122 -0
- package/templates/skills/cbp-frontend-a11y/reference/keyboard-patterns.md +154 -0
- package/templates/skills/cbp-frontend-a11y/reference/semantic-html.md +111 -0
- package/templates/skills/cbp-frontend-design/SKILL.md +145 -0
- package/templates/skills/cbp-frontend-design/reference/nextjs-scss.md +118 -0
- package/templates/skills/cbp-frontend-design/reference/rn-expo.md +101 -0
- package/templates/skills/cbp-frontend-design/reference/tauri-react.md +82 -0
- package/templates/skills/cbp-frontend-ui/SKILL.md +262 -0
- package/templates/skills/cbp-frontend-ui/reference/ui-label-maps.md +42 -0
- package/templates/skills/cbp-frontend-ui/reference/ui-layout-patterns.md +105 -0
- package/templates/skills/cbp-frontend-ui/reference/variant-defaults.md +149 -0
- package/templates/skills/cbp-frontend-ux/SKILL.md +181 -0
- package/templates/skills/cbp-git-branch-feat-create/SKILL.md +115 -0
- package/templates/skills/cbp-git-commit/SKILL.md +278 -0
- package/templates/skills/cbp-git-worktree-create/SKILL.md +226 -0
- package/templates/skills/cbp-git-worktree-remove/SKILL.md +145 -0
- package/templates/skills/cbp-merge-main/SKILL.md +228 -0
- package/templates/skills/cbp-round-check/SKILL.md +104 -0
- package/templates/skills/cbp-round-end/SKILL.md +183 -0
- package/templates/skills/cbp-round-end/reference/findings-presentation.md +44 -0
- package/templates/skills/cbp-round-end/reference/inline-fallback.md +35 -0
- package/templates/skills/cbp-round-execute/SKILL.md +211 -0
- package/templates/skills/cbp-round-execute/reference/inline-fallback.md +59 -0
- package/templates/skills/cbp-round-input/SKILL.md +165 -0
- package/templates/skills/cbp-round-start/SKILL.md +222 -0
- package/templates/skills/cbp-round-update/SKILL.md +163 -0
- package/templates/skills/cbp-session-end/SKILL.md +187 -0
- package/templates/skills/cbp-session-start/SKILL.md +155 -0
- package/templates/skills/cbp-ship/SKILL.md +332 -0
- package/templates/skills/cbp-ship/reference/changesets-overview.md +120 -0
- package/templates/skills/cbp-ship/reference/eas-cli-overview.md +60 -0
- package/templates/skills/cbp-ship/reference/gh-cli-overview.md +135 -0
- package/templates/skills/cbp-ship/reference/gh-cli-shipment-commands.md +283 -0
- package/templates/skills/cbp-ship/reference/npm-publish-monorepo.md +252 -0
- package/templates/skills/cbp-ship/reference/npm-publish-oidc-trusted.md +157 -0
- package/templates/skills/cbp-ship/reference/npm-publish-overview.md +171 -0
- package/templates/skills/cbp-ship/reference/preflight-checklist.md +88 -0
- package/templates/skills/cbp-ship/reference/railway-nestjs-deployment.md +169 -0
- package/templates/skills/cbp-ship/reference/railway-overview.md +120 -0
- package/templates/skills/cbp-ship/reference/railway-troubleshooting.md +168 -0
- package/templates/skills/cbp-ship/reference/release-please-overview.md +99 -0
- package/templates/skills/cbp-ship/reference/surface-expo-eas.md +155 -0
- package/templates/skills/cbp-ship/reference/surface-npm.md +180 -0
- package/templates/skills/cbp-ship/reference/surface-railway.md +152 -0
- package/templates/skills/cbp-ship/reference/surface-supabase.md +178 -0
- package/templates/skills/cbp-ship/reference/surface-tauri.md +138 -0
- package/templates/skills/cbp-ship/reference/surface-vercel.md +124 -0
- package/templates/skills/cbp-ship/reference/surface-vscode-ext.md +144 -0
- package/templates/skills/cbp-ship/reference/surfaces.md +60 -0
- package/templates/skills/cbp-ship/reference/testflight-automation.md +215 -0
- package/templates/skills/cbp-ship/reference/testflight-internal-vs-external.md +69 -0
- package/templates/skills/cbp-ship/reference/testflight-overview.md +98 -0
- package/templates/skills/cbp-ship/reference/versioning.md +116 -0
- package/templates/skills/cbp-ship/scripts/detect-surfaces.sh +217 -0
- package/templates/skills/cbp-ship/scripts/verify-expo-eas.sh +35 -0
- package/templates/skills/cbp-ship/scripts/verify-npm.sh +21 -0
- package/templates/skills/cbp-ship/scripts/verify-railway.sh +41 -0
- package/templates/skills/cbp-ship/scripts/verify-supabase.sh +19 -0
- package/templates/skills/cbp-ship/scripts/verify-tauri.sh +24 -0
- package/templates/skills/cbp-ship/scripts/verify-vercel.sh +32 -0
- package/templates/skills/cbp-ship/scripts/verify-vscode-ext.sh +25 -0
- package/templates/skills/cbp-ship/templates/eas.json +66 -0
- package/templates/skills/cbp-ship/templates/railway.toml +15 -0
- package/templates/skills/cbp-ship/templates/release-please-config.json +17 -0
- package/templates/skills/cbp-ship/templates/vercel.json +19 -0
- package/templates/skills/cbp-ship/templates/vscodeignore +21 -0
- package/templates/skills/cbp-ship/templates/workflow-changesets.yml +41 -0
- package/templates/skills/cbp-ship/templates/workflow-eas-submit.yml +53 -0
- package/templates/skills/cbp-ship/templates/workflow-npm-publish.yml +36 -0
- package/templates/skills/cbp-ship/templates/workflow-release-please.yml +21 -0
- package/templates/skills/cbp-ship/templates/workflow-tauri-release.yml +69 -0
- package/templates/skills/cbp-ship/templates/workflow-vsce-publish.yml +31 -0
- package/templates/skills/cbp-ship-configure/SKILL.md +296 -0
- package/templates/skills/cbp-ship-configure/reference/expo-mobile.md +204 -0
- package/templates/skills/cbp-ship-configure/reference/npm-package.md +165 -0
- package/templates/skills/cbp-ship-configure/reference/railway-backend.md +199 -0
- package/templates/skills/cbp-ship-configure/reference/supabase.md +200 -0
- package/templates/skills/cbp-ship-configure/reference/tauri-desktop.md +181 -0
- package/templates/skills/cbp-ship-configure/reference/vercel.md +117 -0
- package/templates/skills/cbp-ship-configure/reference/vscode-ext.md +155 -0
- package/templates/skills/cbp-ship-main/SKILL.md +65 -0
- package/templates/skills/cbp-supabase-branch-check/SKILL.md +337 -0
- package/templates/skills/cbp-supabase-branch-check/reference/dag-steps.md +29 -0
- package/templates/skills/cbp-supabase-migrate/SKILL.md +314 -0
- package/templates/skills/cbp-supabase-migrate/reference/advisor-triage.md +70 -0
- package/templates/skills/cbp-supabase-migrate/reference/cli-fallback.md +87 -0
- package/templates/skills/cbp-supabase-migrate/reference/preflight-dry-run.md +58 -0
- package/templates/skills/cbp-supabase-setup/SKILL.md +239 -0
- package/templates/skills/cbp-supabase-setup/reference/branching-setup.md +121 -0
- package/templates/skills/cbp-supabase-setup/reference/cli-fallback.md +109 -0
- package/templates/skills/cbp-task-check/SKILL.md +166 -0
- package/templates/skills/cbp-task-complete/SKILL.md +206 -0
- package/templates/skills/cbp-task-complete/reference/checkpoint-done-branching.md +48 -0
- package/templates/skills/cbp-task-complete/reference/next-step-heuristic.md +56 -0
- package/templates/skills/cbp-task-create/SKILL.md +167 -0
- package/templates/skills/cbp-task-start/SKILL.md +239 -0
- package/templates/skills/cbp-task-testing/SKILL.md +277 -0
- package/templates/skills/cbp-todo/SKILL.md +97 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Validate a Claude Code subagent file (CBP folder form).
|
|
3
|
+
# Usage: validate-agent.sh <path-to-AGENT.md>
|
|
4
|
+
# Exit 0 = valid, exit 1 = invalid (errors printed to stderr).
|
|
5
|
+
|
|
6
|
+
set -uo pipefail
|
|
7
|
+
|
|
8
|
+
FILE="${1:?Usage: validate-agent.sh <path-to-AGENT.md>}"
|
|
9
|
+
|
|
10
|
+
if [ ! -f "$FILE" ]; then
|
|
11
|
+
echo "ERROR: file not found: $FILE" >&2
|
|
12
|
+
exit 1
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
errors=0
|
|
16
|
+
err() { echo " - $1" >&2; errors=$((errors + 1)); }
|
|
17
|
+
|
|
18
|
+
# CBP folder form: .claude/agents/{name}/AGENT.md
|
|
19
|
+
case "$FILE" in
|
|
20
|
+
*/AGENT.md) ;;
|
|
21
|
+
*) err "CBP expects folder form: .claude/agents/{name}/AGENT.md (got: $FILE)";;
|
|
22
|
+
esac
|
|
23
|
+
|
|
24
|
+
# Frontmatter must be present
|
|
25
|
+
if ! head -1 "$FILE" | grep -qE '^---[[:space:]]*$'; then
|
|
26
|
+
err "missing YAML frontmatter opener '---'"
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# Extract frontmatter block
|
|
30
|
+
fm=$(awk '/^---[[:space:]]*$/{n++; next} n==1{print} n==2{exit}' "$FILE")
|
|
31
|
+
|
|
32
|
+
# Required fields
|
|
33
|
+
grep -qE '^name:[[:space:]]*' <<< "$fm" || err "missing required field: name"
|
|
34
|
+
grep -qE '^description:[[:space:]]*' <<< "$fm" || err "missing required field: description"
|
|
35
|
+
grep -qE '^scope:[[:space:]]*' <<< "$fm" || err "missing CBP required field: scope (org-shared|project-shared|repo-only:<repo-name>)"
|
|
36
|
+
|
|
37
|
+
# Name format: kebab-case
|
|
38
|
+
name=$(grep -E '^name:' <<< "$fm" | head -1 | sed -E 's/^name:[[:space:]]*//; s/[[:space:]]*$//; s/^"(.*)"$/\1/' || true)
|
|
39
|
+
if [ -n "$name" ] && ! [[ "$name" =~ ^[a-z0-9]+(-[a-z0-9]+)*$ ]]; then
|
|
40
|
+
err "name must be kebab-case (lowercase, hyphens): got '$name'"
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# Model alias check (if present)
|
|
44
|
+
model=$(grep -E '^model:' <<< "$fm" | head -1 | sed -E 's/^model:[[:space:]]*//; s/[[:space:]]*$//; s/^"(.*)"$/\1/' || true)
|
|
45
|
+
if [ -n "$model" ] && [[ ! "$model" =~ ^(sonnet|opus|haiku|inherit|claude-.+)$ ]]; then
|
|
46
|
+
err "model must be alias (sonnet|opus|haiku|inherit) or full ID (claude-*): got '$model'"
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
# Permission mode check (if present)
|
|
50
|
+
pm=$(grep -E '^permissionMode:' <<< "$fm" | head -1 | sed -E 's/^permissionMode:[[:space:]]*//; s/[[:space:]]*$//; s/^"(.*)"$/\1/' || true)
|
|
51
|
+
if [ -n "$pm" ] && [[ ! "$pm" =~ ^(default|acceptEdits|auto|dontAsk|bypassPermissions|plan)$ ]]; then
|
|
52
|
+
err "permissionMode invalid: got '$pm'"
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
# Memory scope check
|
|
56
|
+
mem=$(grep -E '^memory:' <<< "$fm" | head -1 | sed -E 's/^memory:[[:space:]]*//; s/[[:space:]]*$//; s/^"(.*)"$/\1/' || true)
|
|
57
|
+
if [ -n "$mem" ] && [[ ! "$mem" =~ ^(user|project|local)$ ]]; then
|
|
58
|
+
err "memory must be user|project|local: got '$mem'"
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
if [ "$errors" -gt 0 ]; then
|
|
62
|
+
echo "validation FAILED ($errors issue(s)) for $FILE" >&2
|
|
63
|
+
exit 1
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
echo "validation OK: $FILE"
|
|
67
|
+
exit 0
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
scope: org-shared # CBP sync marker: org-shared | project-shared | repo-only:<repo-name>
|
|
3
|
+
name: agent-name
|
|
4
|
+
description: One sentence describing when Claude should delegate to this agent. Write for matching, not for humans. Include trigger phrases.
|
|
5
|
+
tools: Read, Grep, Glob, Bash
|
|
6
|
+
# disallowedTools: Write, Edit # alternative to tools — inherits then removes
|
|
7
|
+
# review with /cbp-build-cc-mode if defaults don't fit this agent's purpose
|
|
8
|
+
model: sonnet
|
|
9
|
+
# permissionMode: default # default | acceptEdits | auto | dontAsk | bypassPermissions | plan
|
|
10
|
+
# maxTurns: 20
|
|
11
|
+
effort: xhigh
|
|
12
|
+
# color: blue # red | blue | green | yellow | purple | orange | pink | cyan
|
|
13
|
+
# background: false
|
|
14
|
+
# isolation: worktree # only if the agent should work in an isolated git worktree
|
|
15
|
+
# memory: project # project | user | local — enables persistent MEMORY.md
|
|
16
|
+
# skills:
|
|
17
|
+
# - api-conventions
|
|
18
|
+
# - error-handling-patterns
|
|
19
|
+
# mcpServers:
|
|
20
|
+
# - github
|
|
21
|
+
# - playwright:
|
|
22
|
+
# type: stdio
|
|
23
|
+
# command: npx
|
|
24
|
+
# args: ["-y", "@playwright/mcp@latest"]
|
|
25
|
+
# hooks:
|
|
26
|
+
# PreToolUse:
|
|
27
|
+
# - matcher: "Bash"
|
|
28
|
+
# hooks:
|
|
29
|
+
# - type: command
|
|
30
|
+
# command: "./scripts/validate-command.sh"
|
|
31
|
+
# PostToolUse:
|
|
32
|
+
# - matcher: "Edit|Write"
|
|
33
|
+
# hooks:
|
|
34
|
+
# - type: command
|
|
35
|
+
# command: "./scripts/run-linter.sh"
|
|
36
|
+
# initialPrompt: "Start by reading MEMORY.md, then wait for instructions." # only used when run as main thread via --agent
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
You are a [role] specialising in [domain].
|
|
40
|
+
|
|
41
|
+
## When invoked
|
|
42
|
+
|
|
43
|
+
1. [First action — often: read diff, list files, query status]
|
|
44
|
+
2. [Second action]
|
|
45
|
+
3. [Third action]
|
|
46
|
+
|
|
47
|
+
## Workflow
|
|
48
|
+
|
|
49
|
+
- [Step-by-step procedure the agent follows]
|
|
50
|
+
- [Keep concrete — name the tools and patterns it uses]
|
|
51
|
+
|
|
52
|
+
## Output format
|
|
53
|
+
|
|
54
|
+
Return:
|
|
55
|
+
|
|
56
|
+
- **Summary** — one sentence
|
|
57
|
+
- **Findings** — bulleted list with file:line references
|
|
58
|
+
- **Recommendations** — ordered by priority (critical / warning / suggestion)
|
|
59
|
+
|
|
60
|
+
## Failure modes
|
|
61
|
+
|
|
62
|
+
| Condition | Action |
|
|
63
|
+
|-----------|--------|
|
|
64
|
+
| Requirements unclear | Return `blocked` with what's missing |
|
|
65
|
+
| No matching files | Return `no_findings` |
|
|
66
|
+
| Unrecoverable error | Return `failed` with the error message |
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
---
|
|
2
|
+
scope: org-shared
|
|
3
|
+
name: cbp-build-cc-claude-file
|
|
4
|
+
description: Create or update a CLAUDE.md file at any scope (managed, project, user, local) following the official memory spec — imports (@path), nested discovery, AGENTS.md bridge, comment stripping, and claudeMdExcludes.
|
|
5
|
+
argument-hint: "[action] [--scope=managed|project|user|local]"
|
|
6
|
+
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
7
|
+
effort: xhigh
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Build CLAUDE.md File
|
|
11
|
+
|
|
12
|
+
Create or update a CLAUDE.md file per the official Claude Code memory spec (section _CLAUDE.md files_). CLAUDE.md is loaded in full at session start for every matching directory walked from the working directory. Nested files load on-demand when Claude reads files in subdirectories.
|
|
13
|
+
|
|
14
|
+
## Arguments
|
|
15
|
+
|
|
16
|
+
`$ARGUMENTS` — action: `create`, `update`, `check`, `init`. Flag: `--scope=managed|project|user|local` (default `project`).
|
|
17
|
+
|
|
18
|
+
Actions:
|
|
19
|
+
|
|
20
|
+
- `create` — new CLAUDE.md at the scope path
|
|
21
|
+
- `update` — modify existing CLAUDE.md
|
|
22
|
+
- `check` — audit for duplication with rules/context and report fixes
|
|
23
|
+
- `init` — defer to Claude Code's built-in `/init` for first-time setup
|
|
24
|
+
|
|
25
|
+
## When to Use
|
|
26
|
+
|
|
27
|
+
- First-time project onboarding → `/init` (not this skill)
|
|
28
|
+
- Adding a new project-level fact (build command, architecture decision)
|
|
29
|
+
- Restructuring when CLAUDE.md grows past ~200 lines
|
|
30
|
+
- Migrating from AGENTS.md to CLAUDE.md (or bridging them)
|
|
31
|
+
|
|
32
|
+
Do NOT use this skill for:
|
|
33
|
+
|
|
34
|
+
- Workflow details or behavioural rules → `/cbp-build-cc-rule`
|
|
35
|
+
- Reusable step-by-step procedures → `/cbp-build-cc-skill`
|
|
36
|
+
- Personal learnings across projects → `/cbp-build-cc-memory`
|
|
37
|
+
|
|
38
|
+
## Instructions
|
|
39
|
+
|
|
40
|
+
### Step 1 — Pick the scope
|
|
41
|
+
|
|
42
|
+
| Scope | Path | Use for |
|
|
43
|
+
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
|
|
44
|
+
| managed | `/Library/Application Support/ClaudeCode/CLAUDE.md` (mac), `/etc/claude-code/CLAUDE.md` (linux/WSL), `C:\Program Files\ClaudeCode\CLAUDE.md` (win) | IT/DevOps policy, cannot be excluded |
|
|
45
|
+
| project (shared) | `./CLAUDE.md` or `./.claude/CLAUDE.md` | Team-shared via git |
|
|
46
|
+
| user | `~/.claude/CLAUDE.md` | Personal, all projects |
|
|
47
|
+
| local | `./CLAUDE.local.md` (gitignored) | Personal, this project |
|
|
48
|
+
|
|
49
|
+
Default: project. Either `./CLAUDE.md` or `./.claude/CLAUDE.md` works; pick one and stick to it.
|
|
50
|
+
|
|
51
|
+
### Step 2 — Read existing CLAUDE.md (for update/check)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
cat .claude/CLAUDE.md 2>/dev/null || cat ./CLAUDE.md 2>/dev/null
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Also list sibling rules for duplication check:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
ls .claude/rules/
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Step 3 — Decide what belongs in CLAUDE.md
|
|
64
|
+
|
|
65
|
+
Read [reference/what-belongs.md](reference/what-belongs.md) — definitive table.
|
|
66
|
+
|
|
67
|
+
Quick gate: "Will Claude make a mistake without this in the context?" Every line competes for context window space — keep it high-signal.
|
|
68
|
+
|
|
69
|
+
| Belongs in CLAUDE.md | Belongs elsewhere |
|
|
70
|
+
| -------------------------------------- | -------------------------------------------- |
|
|
71
|
+
| Project name, production URL, repo IDs | API endpoint docs → `docs/` |
|
|
72
|
+
| Branch strategy one-liner | Full git workflow → `rules/git-workflow.md` |
|
|
73
|
+
| Command list (name + purpose) | Command implementation → `skills/*/SKILL.md` |
|
|
74
|
+
| "DB is source of truth" | DB schema → `docs/architecture/` |
|
|
75
|
+
| Tech stack summary | Framework deep-dives → `docs/stack/` |
|
|
76
|
+
|
|
77
|
+
**No duplication.** CLAUDE.md should **reference**, not **repeat**. If a rule or context file covers the topic, CLAUDE.md gets a one-liner pointing to it.
|
|
78
|
+
|
|
79
|
+
**Keep it stable.** If you're updating CLAUDE.md every task, the content probably belongs in a rule or skill. CLAUDE.md changes should be: new project-level decisions (tech stack, deployment), new key references (repo ID, URL), or command table updates when a skill is added/removed. Workflow details, testing patterns, and style conventions go in rules or `.claude/docs/`.
|
|
80
|
+
|
|
81
|
+
### Step 4 — Apply structure
|
|
82
|
+
|
|
83
|
+
Target under 200 lines. Use markdown headers and bullets (Claude scans structure like readers).
|
|
84
|
+
|
|
85
|
+
Recommended section order:
|
|
86
|
+
|
|
87
|
+
1. **Project** — name, type, production URL
|
|
88
|
+
2. **Tech Stack** — framework, language, DB, deployment
|
|
89
|
+
3. **Structure** — key directories or monorepo packages
|
|
90
|
+
4. **Key References** — repo IDs, URLs, auth method
|
|
91
|
+
5. **Git** — branch strategy one-liner, attribution rules
|
|
92
|
+
6. **Workflow** — entry point command + pointer to rule file
|
|
93
|
+
|
|
94
|
+
See [templates/project-claude-md.md](templates/project-claude-md.md).
|
|
95
|
+
|
|
96
|
+
### Step 5 — Use imports to split large files
|
|
97
|
+
|
|
98
|
+
When content grows, use `@path/to/file` imports to load additional files at launch:
|
|
99
|
+
|
|
100
|
+
```markdown
|
|
101
|
+
See @README.md for project overview and @package.json for npm commands.
|
|
102
|
+
|
|
103
|
+
# Additional Instructions
|
|
104
|
+
|
|
105
|
+
- git workflow @docs/git-instructions.md
|
|
106
|
+
- testing patterns @docs/testing.md
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Rules:
|
|
110
|
+
|
|
111
|
+
- Relative paths resolve relative to the file containing the import
|
|
112
|
+
- Absolute paths allowed
|
|
113
|
+
- Recursive imports up to 5 hops deep
|
|
114
|
+
- First-time imports from outside the repo trigger an approval dialog
|
|
115
|
+
|
|
116
|
+
Full reference: [reference/imports.md](reference/imports.md).
|
|
117
|
+
|
|
118
|
+
### Step 6 — Bridge to AGENTS.md if the project uses it
|
|
119
|
+
|
|
120
|
+
If the repo already has `AGENTS.md` for other coding agents:
|
|
121
|
+
|
|
122
|
+
```markdown filename="CLAUDE.md"
|
|
123
|
+
@AGENTS.md
|
|
124
|
+
|
|
125
|
+
## Claude Code
|
|
126
|
+
|
|
127
|
+
[Claude-specific additions below the import]
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Claude Code reads CLAUDE.md, not AGENTS.md, so the import ensures both tools see the same instructions.
|
|
131
|
+
|
|
132
|
+
### Step 7 — Use block-level HTML comments for maintainer notes
|
|
133
|
+
|
|
134
|
+
Comments are stripped before Claude sees the content:
|
|
135
|
+
|
|
136
|
+
```markdown
|
|
137
|
+
<!-- maintainer: review this section quarterly; @alice is owner -->
|
|
138
|
+
|
|
139
|
+
## Tech Stack
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Comments inside code blocks are preserved. Use freely for context that humans need but tokens shouldn't burn.
|
|
143
|
+
|
|
144
|
+
### Step 8 — For monorepos, manage excludes
|
|
145
|
+
|
|
146
|
+
Other teams' CLAUDE.md files in the ancestor tree get picked up by default. Exclude them via `claudeMdExcludes` in `.claude/settings.local.json`:
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"claudeMdExcludes": [
|
|
151
|
+
"**/other-team/CLAUDE.md",
|
|
152
|
+
"/home/user/monorepo/platform/.claude/rules/**"
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Managed policy CLAUDE.md cannot be excluded.
|
|
158
|
+
|
|
159
|
+
### Step 9 — Verify with `/memory`
|
|
160
|
+
|
|
161
|
+
Run `/memory` to confirm the file is loaded. The list shows all CLAUDE.md, CLAUDE.local.md, and rules files in effect.
|
|
162
|
+
|
|
163
|
+
## Integration
|
|
164
|
+
|
|
165
|
+
- **Triggered by**: user invocation
|
|
166
|
+
- **Reads**: `${CLAUDE_SKILL_DIR}/templates/*.md`, `${CLAUDE_SKILL_DIR}/reference/*.md`, current CLAUDE.md, `.claude/rules/*.md`
|
|
167
|
+
- **Writes**: CLAUDE.md at the chosen scope
|
|
168
|
+
- **Related skills**: `/cbp-build-cc-rule` (behavioural constraints), `/cbp-build-cc-memory` (personal learnings), `/cbp-build-cc-settings` (for `claudeMdExcludes`)
|
|
169
|
+
|
|
170
|
+
## Key Rules
|
|
171
|
+
|
|
172
|
+
- CLAUDE.md content enters as a user message (not system prompt) — no guarantee of strict compliance. Be specific
|
|
173
|
+
- Target under 200 lines. Longer files reduce adherence
|
|
174
|
+
- Project-root CLAUDE.md survives compaction. Nested files do not — they reload when Claude next reads a matching subdirectory file
|
|
175
|
+
- Specific > vague: "Use 2-space indentation" beats "format code nicely"
|
|
176
|
+
- Path resolution walks up from the working directory — instructions concatenate, don't override
|
|
177
|
+
- CLAUDE.local.md is appended after CLAUDE.md at each level. Personal notes win on conflict at the same level
|
|
178
|
+
- Block HTML comments are stripped but preserved inside code blocks
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
## Project
|
|
4
|
+
|
|
5
|
+
**Name**: acme-api
|
|
6
|
+
**Type**: Python FastAPI service
|
|
7
|
+
**Production**: https://api.acme.com
|
|
8
|
+
|
|
9
|
+
## Stack
|
|
10
|
+
|
|
11
|
+
- Python 3.12, FastAPI, Pydantic v2
|
|
12
|
+
- PostgreSQL (`asyncpg`), Alembic migrations
|
|
13
|
+
- Deployed on Fly.io
|
|
14
|
+
|
|
15
|
+
## Commands
|
|
16
|
+
|
|
17
|
+
| Task | Command |
|
|
18
|
+
|------|---------|
|
|
19
|
+
| Install | `uv sync` |
|
|
20
|
+
| Dev server | `uv run fastapi dev` |
|
|
21
|
+
| Tests | `uv run pytest` |
|
|
22
|
+
| Migrations | `uv run alembic upgrade head` |
|
|
23
|
+
|
|
24
|
+
## Conventions
|
|
25
|
+
|
|
26
|
+
- 2-space indentation (enforced by ruff)
|
|
27
|
+
- All endpoints under `src/api/v1/` with a matching test in `tests/api/v1/`
|
|
28
|
+
- Errors return `{"error": {"code": str, "message": str}}` — never raw exceptions
|
|
29
|
+
|
|
30
|
+
## Git
|
|
31
|
+
|
|
32
|
+
- Branch: `feat/* → main`
|
|
33
|
+
- Rebase, never merge. No force-pushes to `main`.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
<!-- Monorepo: see each package's nested CLAUDE.md for package-specific details -->
|
|
4
|
+
|
|
5
|
+
## Project
|
|
6
|
+
|
|
7
|
+
**Name**: acme-platform
|
|
8
|
+
**Type**: pnpm + Turborepo monorepo
|
|
9
|
+
**Production**: https://acme.com
|
|
10
|
+
|
|
11
|
+
## Packages
|
|
12
|
+
|
|
13
|
+
| Path | Package | Purpose |
|
|
14
|
+
|------|---------|---------|
|
|
15
|
+
| `apps/web` | `@acme/web` | Marketing + app shell |
|
|
16
|
+
| `apps/api` | `@acme/api` | NestJS backend |
|
|
17
|
+
| `packages/ui` | `@acme/ui` | Shared component library |
|
|
18
|
+
| `packages/db` | `@acme/db` | Prisma client + migrations |
|
|
19
|
+
|
|
20
|
+
Each package has its own `CLAUDE.md` loaded on-demand when Claude touches files in that directory.
|
|
21
|
+
|
|
22
|
+
## Shared standards
|
|
23
|
+
|
|
24
|
+
- Conventions @docs/conventions.md
|
|
25
|
+
- Testing @docs/testing.md
|
|
26
|
+
- Commit format @docs/commits.md
|
|
27
|
+
|
|
28
|
+
## Commands
|
|
29
|
+
|
|
30
|
+
- Install: `pnpm install`
|
|
31
|
+
- Build all: `pnpm -r build`
|
|
32
|
+
- Test: `pnpm -r test`
|
|
33
|
+
- Lint: `pnpm -r lint`
|
|
34
|
+
|
|
35
|
+
## Git
|
|
36
|
+
|
|
37
|
+
- `feat/*` → `main`
|
|
38
|
+
- PR preview reviewed before merge
|
|
39
|
+
- Attribution policy: @docs/attribution.md
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# CLAUDE.md Imports Reference
|
|
2
|
+
|
|
3
|
+
Source: official Claude Code memory spec — *Import additional files*.
|
|
4
|
+
|
|
5
|
+
## Syntax
|
|
6
|
+
|
|
7
|
+
```markdown
|
|
8
|
+
@path/to/file
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Imports expand and load at launch, merged into context alongside the importing CLAUDE.md.
|
|
12
|
+
|
|
13
|
+
## Path resolution
|
|
14
|
+
|
|
15
|
+
- **Relative**: resolves relative to the file containing the import (not the working directory)
|
|
16
|
+
- **Absolute**: accepted
|
|
17
|
+
- **Tilde**: `@~/.claude/my-notes.md` resolves to home
|
|
18
|
+
|
|
19
|
+
## Depth
|
|
20
|
+
|
|
21
|
+
Imports may recursively import. **Max depth: 5 hops.**
|
|
22
|
+
|
|
23
|
+
## Common patterns
|
|
24
|
+
|
|
25
|
+
### Pull in repo metadata
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
See @README.md for overview and @package.json for npm commands.
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Sectioned additions
|
|
32
|
+
|
|
33
|
+
```markdown
|
|
34
|
+
## Additional Instructions
|
|
35
|
+
|
|
36
|
+
- Git workflow @docs/git-instructions.md
|
|
37
|
+
- Testing patterns @docs/testing.md
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Cross-worktree personal instructions
|
|
41
|
+
|
|
42
|
+
CLAUDE.local.md is gitignored and only exists in the worktree where you created it. To share personal notes across worktrees, import from home:
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
# Individual Preferences
|
|
46
|
+
- @~/.claude/my-project-instructions.md
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### AGENTS.md bridge
|
|
50
|
+
|
|
51
|
+
```markdown
|
|
52
|
+
@AGENTS.md
|
|
53
|
+
|
|
54
|
+
## Claude Code
|
|
55
|
+
|
|
56
|
+
[Claude-specific additions here]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Approval dialog
|
|
60
|
+
|
|
61
|
+
The first time Claude Code sees an **external** import (outside the project), it prompts for approval. Declining disables imports in that project; the dialog does not reappear.
|
|
62
|
+
|
|
63
|
+
## What gets imported
|
|
64
|
+
|
|
65
|
+
- Markdown files — content merged into context
|
|
66
|
+
- Any readable file — the whole content is injected
|
|
67
|
+
|
|
68
|
+
## Troubleshooting
|
|
69
|
+
|
|
70
|
+
- Import not appearing → verify path resolves from the *file containing the import*, not the working directory
|
|
71
|
+
- Dialog not showing → check if you previously declined (run `/memory` to review loaded files)
|
|
72
|
+
- Exceeded depth → reduce the chain; re-flatten hierarchy
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# What Belongs in CLAUDE.md
|
|
2
|
+
|
|
3
|
+
Source: official Claude Code memory spec — *Write effective instructions*.
|
|
4
|
+
|
|
5
|
+
## Put it in CLAUDE.md when
|
|
6
|
+
|
|
7
|
+
- Claude would make the same mistake a second time without it
|
|
8
|
+
- A code review caught something Claude should have known
|
|
9
|
+
- You find yourself retyping the same correction each session
|
|
10
|
+
- A new teammate would need this context to be productive
|
|
11
|
+
|
|
12
|
+
## Keep it OUT of CLAUDE.md when
|
|
13
|
+
|
|
14
|
+
| Content type | Put here instead |
|
|
15
|
+
|-------------|------------------|
|
|
16
|
+
| Multi-step procedure | Skill (`.claude/skills/{name}/SKILL.md`) |
|
|
17
|
+
| File-specific constraint | Path-scoped rule (`.claude/rules/{name}.md` with `paths:`) |
|
|
18
|
+
| Personal learning | Auto memory (`~/.claude/projects/<project>/memory/`) |
|
|
19
|
+
| API endpoint documentation | `docs/` |
|
|
20
|
+
| Architecture deep-dive | `docs/architecture/` |
|
|
21
|
+
| Framework usage guide | `docs/stack/{framework}/` |
|
|
22
|
+
| Ephemeral task state | Task tracker / DB / issue |
|
|
23
|
+
|
|
24
|
+
## Quality gates
|
|
25
|
+
|
|
26
|
+
- **Size**: under 200 lines. Longer files reduce adherence
|
|
27
|
+
- **Specificity**: "Use 2-space indentation" > "format nicely"
|
|
28
|
+
- **Consistency**: conflicting rules get picked arbitrarily — remove one
|
|
29
|
+
- **Stability**: updating CLAUDE.md every task is a smell. Content probably belongs in a rule or context file
|
|
30
|
+
|
|
31
|
+
## What CLAUDE.md is for
|
|
32
|
+
|
|
33
|
+
Instructions and rules for the project. Written by humans, for Claude, to hold every session.
|
|
34
|
+
|
|
35
|
+
## What it isn't
|
|
36
|
+
|
|
37
|
+
- Not a style guide anyone reads — it's context, not documentation
|
|
38
|
+
- Not enforced configuration — instructions shape behaviour but don't block Claude
|
|
39
|
+
- Not a substitute for `settings.json` deny rules, which ARE enforced
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
<!-- Maintained by: @owner. Review quarterly. -->
|
|
4
|
+
|
|
5
|
+
## Project
|
|
6
|
+
|
|
7
|
+
**Name**: {project-name}
|
|
8
|
+
**Type**: {e.g. Next.js monorepo, Python service, Go binary}
|
|
9
|
+
**Production**: {url}
|
|
10
|
+
|
|
11
|
+
## Tech Stack
|
|
12
|
+
|
|
13
|
+
- **Framework**: {e.g. Next.js 15 App Router}
|
|
14
|
+
- **Language**: {TypeScript / Python / Go}
|
|
15
|
+
- **Styling**: {SCSS / Tailwind / CSS Modules}
|
|
16
|
+
- **Database**: {e.g. PostgreSQL via Supabase}
|
|
17
|
+
- **Deployment**: {Vercel / AWS / Fly.io}
|
|
18
|
+
|
|
19
|
+
## Structure
|
|
20
|
+
|
|
21
|
+
| Location | Purpose |
|
|
22
|
+
|----------|---------|
|
|
23
|
+
| `apps/web` | Web frontend |
|
|
24
|
+
| `apps/api` | Backend API |
|
|
25
|
+
| `packages/*` | Shared internal packages |
|
|
26
|
+
|
|
27
|
+
## Key References
|
|
28
|
+
|
|
29
|
+
| Item | Value |
|
|
30
|
+
|------|-------|
|
|
31
|
+
| Repo ID | {uuid} |
|
|
32
|
+
| Production URL | {url} |
|
|
33
|
+
| API auth | {header name + mechanism} |
|
|
34
|
+
|
|
35
|
+
## Git
|
|
36
|
+
|
|
37
|
+
- Branch strategy: `feat/* → main` (PR previews via Vercel)
|
|
38
|
+
- Attribution: {policy — e.g. "no AI co-authorship"}
|
|
39
|
+
- Details in `rules/git-workflow.md`
|
|
40
|
+
|
|
41
|
+
## Workflow
|
|
42
|
+
|
|
43
|
+
Start with `/{entry-command}`. Full pipeline in `rules/development-workflow.md`.
|
|
44
|
+
|
|
45
|
+
## Additional instructions
|
|
46
|
+
|
|
47
|
+
- Build commands @package.json
|
|
48
|
+
- Testing guide @docs/testing.md
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# User-level CLAUDE.md
|
|
2
|
+
|
|
3
|
+
<!-- Personal preferences. Loaded in every project on this machine. -->
|
|
4
|
+
|
|
5
|
+
## Communication style
|
|
6
|
+
|
|
7
|
+
- Terse. State results and decisions directly.
|
|
8
|
+
- No trailing summaries of what you just did — the diff is self-explanatory.
|
|
9
|
+
|
|
10
|
+
## Defaults
|
|
11
|
+
|
|
12
|
+
- Prefer `pnpm` over `npm`, `ripgrep` over `grep`, `fd` over `find` where available.
|
|
13
|
+
- Use `gh` CLI for GitHub interactions, not web fetches.
|
|
14
|
+
|
|
15
|
+
## Editing
|
|
16
|
+
|
|
17
|
+
- Never ask permission to format code.
|
|
18
|
+
- Never introduce comments unless a reader would be confused without them.
|
|
19
|
+
|
|
20
|
+
## Shared personal rules
|
|
21
|
+
|
|
22
|
+
- Home-directory preferences @~/.claude/my-workflows.md
|