@aslomon/effectum 0.1.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/README.md +633 -0
- package/bin/install.js +652 -0
- package/package.json +29 -0
- package/system/README.md +118 -0
- package/system/commands/build-fix.md +89 -0
- package/system/commands/cancel-ralph.md +90 -0
- package/system/commands/checkpoint.md +63 -0
- package/system/commands/code-review.md +120 -0
- package/system/commands/e2e.md +92 -0
- package/system/commands/plan.md +111 -0
- package/system/commands/ralph-loop.md +163 -0
- package/system/commands/refactor-clean.md +104 -0
- package/system/commands/tdd.md +84 -0
- package/system/commands/verify.md +71 -0
- package/system/stacks/generic.md +96 -0
- package/system/stacks/nextjs-supabase.md +114 -0
- package/system/stacks/python-fastapi.md +140 -0
- package/system/stacks/swift-ios.md +136 -0
- package/system/templates/AUTONOMOUS-WORKFLOW.md +1368 -0
- package/system/templates/CLAUDE.md.tmpl +141 -0
- package/system/templates/guardrails.md.tmpl +39 -0
- package/system/templates/settings.json.tmpl +201 -0
- package/workshop/knowledge/01-prd-template.md +275 -0
- package/workshop/knowledge/02-questioning-framework.md +209 -0
- package/workshop/knowledge/03-decomposition-guide.md +234 -0
- package/workshop/knowledge/04-examples.md +435 -0
- package/workshop/knowledge/05-quality-checklist.md +166 -0
- package/workshop/knowledge/06-network-map-guide.md +413 -0
- package/workshop/knowledge/07-prompt-templates.md +315 -0
- package/workshop/knowledge/08-workflow-modes.md +198 -0
- package/workshop/projects/_example-project/PROJECT.md +33 -0
- package/workshop/projects/_example-project/notes/decisions.md +15 -0
- package/workshop/projects/_example-project/notes/discovery-log.md +9 -0
- package/workshop/templates/PROJECT.md +25 -0
- package/workshop/templates/network-map.mmd +13 -0
- package/workshop/templates/prd.md +133 -0
- package/workshop/templates/requirements-map.md +48 -0
- package/workshop/templates/shared-contracts.md +89 -0
- package/workshop/templates/vision.md +66 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# {{PROJECT_NAME}} — Claude Code Configuration
|
|
2
|
+
|
|
3
|
+
## Communication
|
|
4
|
+
|
|
5
|
+
- {{LANGUAGE}}
|
|
6
|
+
- Be direct. Act autonomously. No unnecessary confirmations.
|
|
7
|
+
- Think step-by-step for complex problems. Use plan mode for multi-file changes.
|
|
8
|
+
- Use subagents (Task tool) for parallel and independent work.
|
|
9
|
+
|
|
10
|
+
## Tech Stack
|
|
11
|
+
|
|
12
|
+
{{TECH_STACK}}
|
|
13
|
+
|
|
14
|
+
## Architecture Principles
|
|
15
|
+
|
|
16
|
+
{{ARCHITECTURE_PRINCIPLES}}
|
|
17
|
+
|
|
18
|
+
## Project Structure
|
|
19
|
+
|
|
20
|
+
{{PROJECT_STRUCTURE}}
|
|
21
|
+
|
|
22
|
+
## Code Quality Rules
|
|
23
|
+
|
|
24
|
+
- Functions: max 40 lines, single responsibility
|
|
25
|
+
- Files: max 300 lines, split if larger
|
|
26
|
+
- Naming: descriptive, no abbreviations, no Hungarian notation
|
|
27
|
+
- Error handling: use Result pattern (`{ data, error }`) for operations that can fail. Never swallow errors.
|
|
28
|
+
- No console.log in production code (use structured logger)
|
|
29
|
+
- No hardcoded strings for config/env values
|
|
30
|
+
- Prefer `const` and immutable patterns
|
|
31
|
+
- Prefer named exports over default exports
|
|
32
|
+
- Prefer composition over inheritance
|
|
33
|
+
|
|
34
|
+
## Quality Gates
|
|
35
|
+
|
|
36
|
+
{{QUALITY_GATES}}
|
|
37
|
+
|
|
38
|
+
## Design System — MANDATORY
|
|
39
|
+
|
|
40
|
+
- ALWAYS use the `frontend-design` skill for ANY design-related work: UI components, pages, layouts, styling, visual polish, landing pages, dashboards, posters, artifacts — everything visual.
|
|
41
|
+
- Every project MUST have a `DESIGN.md` file in the project root. This is non-negotiable.
|
|
42
|
+
- If it does not exist, create it before doing any design work.
|
|
43
|
+
- If it exists, read and study it thoroughly before making any design decisions.
|
|
44
|
+
- Update it when new design decisions are made (colors, typography, spacing, patterns, components).
|
|
45
|
+
- `DESIGN.md` must document: color palette, typography (fonts, sizes, weights), spacing system, border radii, shadows, animation conventions, component patterns, brand guidelines, tone/mood, and any project-specific visual rules.
|
|
46
|
+
- Never make visual/design decisions that contradict `DESIGN.md`. When in doubt, consult the document first.
|
|
47
|
+
- This applies across ALL projects — web, mobile, CLI, docs, presentations, artifacts.
|
|
48
|
+
|
|
49
|
+
## Development Workflow
|
|
50
|
+
|
|
51
|
+
- SPEC-DRIVEN: define requirements and acceptance criteria before coding
|
|
52
|
+
- TEST-FIRST: write failing tests, then implement (use /tdd)
|
|
53
|
+
- DONE = compiles + tests pass + linter clean (use /verify)
|
|
54
|
+
- Plan complex features before implementing (use /plan)
|
|
55
|
+
- Review changes before committing (use /code-review)
|
|
56
|
+
- Fix build errors incrementally (use /build-fix)
|
|
57
|
+
- Clean dead code periodically (use /refactor-clean)
|
|
58
|
+
- Only commit when explicitly asked. Prefer specific file staging over `git add .`
|
|
59
|
+
|
|
60
|
+
## Available Commands
|
|
61
|
+
|
|
62
|
+
| Command | Phase | Function |
|
|
63
|
+
| ----------------- | -------------- | ---------------------------------------- |
|
|
64
|
+
| `/plan` | Start | Analysis + plan + **waits for approval** |
|
|
65
|
+
| `/tdd` | Implementation | Tests first -> code -> refactor |
|
|
66
|
+
| `/verify` | QA | Build + types + lint + tests |
|
|
67
|
+
| `/e2e` | QA | E2E tests (Playwright / XCTest UI) |
|
|
68
|
+
| `/code-review` | Review | Security + quality audit |
|
|
69
|
+
| `/build-fix` | Debugging | Incremental error resolution |
|
|
70
|
+
| `/refactor-clean` | Cleanup | Remove dead code |
|
|
71
|
+
| `/checkpoint` | Safety | Create a restore point |
|
|
72
|
+
| `/ralph-loop` | Full Auto | Iterative autonomous implementation |
|
|
73
|
+
| `/orchestrate` | Teams | Parallel multi-agent implementation |
|
|
74
|
+
|
|
75
|
+
## Context7 — Always Use for Research
|
|
76
|
+
|
|
77
|
+
- Always use Context7 MCP (`resolve_library_id` -> `get_library_docs`) when:
|
|
78
|
+
- Planning features that involve libraries, frameworks, or APIs
|
|
79
|
+
- Exploring documentation for setup, configuration, or integration
|
|
80
|
+
- Generating code that uses external dependencies
|
|
81
|
+
- Checking current API signatures, options, or best practices
|
|
82
|
+
- Comparing approaches or evaluating library capabilities
|
|
83
|
+
- This applies to ALL stacks
|
|
84
|
+
- Fetch docs proactively — do not rely on training data for library-specific details
|
|
85
|
+
|
|
86
|
+
## Active Hooks — Be Aware
|
|
87
|
+
|
|
88
|
+
The following hooks run automatically. Do NOT duplicate their behavior:
|
|
89
|
+
|
|
90
|
+
- **Auto-Format**: {{FORMATTER}} runs after every Edit/Write. Do not manually run the formatter.
|
|
91
|
+
- **CHANGELOG**: A Stop hook auto-updates CHANGELOG.md with [Unreleased] entries after meaningful changes. Do not manually update CHANGELOG.md unless the user explicitly asks.
|
|
92
|
+
- **Commit Message Gate**: Commit messages must be >= 10 characters and descriptive. The hook blocks short messages.
|
|
93
|
+
- **Stop Quality Gate**: A prompt hook verifies all tasks are completed before stopping. If it returns `ok: false`, continue working on what's missing.
|
|
94
|
+
- **Subagent Quality Gate**: Subagent output is verified. Ensure subagents complete their tasks fully, not just report findings.
|
|
95
|
+
- **Error Learning**: Tool failures are logged to `.claude/logs/tool-failures.jsonl`. Check this file at session start to learn from past mistakes and avoid repeating them.
|
|
96
|
+
- **Guardrails Injection**: At session start and after compaction, `~/.claude/guardrails.md` (global) and `$PROJECT/.claude/guardrails.md` (project) are loaded. Follow them strictly.
|
|
97
|
+
- **Transcript Backup**: Transcripts are backed up before context compaction to `.claude/backups/`.
|
|
98
|
+
- **Protected Files**: `.env`, `.env.local`, `.env.production`, `secrets/`, `.git/`, lock files cannot be written to. Use Bash for env file operations if absolutely needed.
|
|
99
|
+
- **Destructive Command Blocker**: `rm -rf /`, `DROP TABLE`, `--force push`, `reset --hard` are blocked.
|
|
100
|
+
- **Desktop Notifications**: User gets OS notifications on permission prompts and task completion.
|
|
101
|
+
|
|
102
|
+
## Stack-Specific Rules
|
|
103
|
+
|
|
104
|
+
{{STACK_SPECIFIC_GUARDRAILS}}
|
|
105
|
+
|
|
106
|
+
## Agent Teams — Opt-In
|
|
107
|
+
|
|
108
|
+
Agent Teams are DISABLED by default. Enable in settings.json:
|
|
109
|
+
`"env": { "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" }`
|
|
110
|
+
|
|
111
|
+
Three execution tiers exist — use the simplest that fits:
|
|
112
|
+
|
|
113
|
+
| Tier | Mechanism | When |
|
|
114
|
+
| -------------------- | ----------------------------------- | ---------------------------------------------- |
|
|
115
|
+
| Single-Agent | Main session alone | Simple tasks, bugfixes, single-file changes |
|
|
116
|
+
| Subagents (default) | Task Tool spawns specialized agents | Parallel research, code reviews, focused tasks |
|
|
117
|
+
| Agent Teams (opt-in) | Independent Claude instances | Complex features with 3+ parallel workstreams |
|
|
118
|
+
|
|
119
|
+
## Shell Commands — Non-Interactive Only
|
|
120
|
+
|
|
121
|
+
- ALWAYS use non-interactive flags for shell commands. AI agents cannot interact with stdin prompts.
|
|
122
|
+
- Examples: `{{PACKAGE_MANAGER}} install --yes`, `rm -rf`, `apt install -y`
|
|
123
|
+
- Never use interactive commands: `git rebase -i`, `git add -i`, `less`, `vim`, `nano`, `top`
|
|
124
|
+
- If a command might prompt for input, find and use its non-interactive equivalent or pass defaults via flags/env vars.
|
|
125
|
+
|
|
126
|
+
## Tool Usage
|
|
127
|
+
|
|
128
|
+
- Use dedicated tools (Read, Grep, Glob) over Bash equivalents
|
|
129
|
+
- Use Context7 MCP for up-to-date library/framework documentation
|
|
130
|
+
- Use git worktrees for risky or exploratory changes
|
|
131
|
+
- Parallelize independent tool calls
|
|
132
|
+
- When blocked, investigate root cause. Never brute-force or retry blindly.
|
|
133
|
+
- Never use destructive git operations as shortcuts
|
|
134
|
+
|
|
135
|
+
## Commit Conventions
|
|
136
|
+
|
|
137
|
+
- Conventional commits: `feat:`, `fix:`, `docs:`, `chore:`, `refactor:`, `test:`
|
|
138
|
+
- Include scope when applicable: `feat(auth): add login flow`
|
|
139
|
+
- Commit messages must be >= 10 characters and descriptive
|
|
140
|
+
- Prefer specific file staging over `git add .`
|
|
141
|
+
- Only commit when explicitly asked
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Project Guardrails
|
|
2
|
+
|
|
3
|
+
Curated lessons from past development sessions. These are injected at every session start.
|
|
4
|
+
Follow these strictly — each exists because ignoring it caused real problems.
|
|
5
|
+
|
|
6
|
+
## Error Patterns
|
|
7
|
+
|
|
8
|
+
- **Test env != dev env**: Never assume test and dev environments behave identically. Validate integration points early with the actual environment.
|
|
9
|
+
- **Read diagnostics before fixing**: Always read the full error message/stack trace before attempting a fix. Guessing wastes iterations.
|
|
10
|
+
- **Manual != automated**: Code that works when run manually may fail in automated contexts (CI, hooks, subagents). Test automation paths explicitly.
|
|
11
|
+
- **Stateful deps cause flaky tests**: External state (DB, files, network) makes tests non-deterministic. Mock or isolate stateful dependencies.
|
|
12
|
+
- **Use precise identifiers**: When searching/replacing code, use unique identifiers. Ambiguous patterns cause wrong matches.
|
|
13
|
+
|
|
14
|
+
## Workflow Lessons
|
|
15
|
+
|
|
16
|
+
- **Validate integration points early**: Don't build the full feature before testing that the integration (API, DB, auth) actually works.
|
|
17
|
+
- **Non-interactive commands only**: AI agents cannot handle stdin prompts. Always use `-y`, `--yes`, `--non-interactive` flags.
|
|
18
|
+
- **Check DESIGN.md first**: Before any UI/design work, read DESIGN.md. Making design decisions without it causes inconsistencies that are expensive to fix.
|
|
19
|
+
|
|
20
|
+
## Code Quality
|
|
21
|
+
|
|
22
|
+
- Functions: max 40 lines. Split immediately if exceeded.
|
|
23
|
+
- Files: max 300 lines. Split into logical modules if exceeded.
|
|
24
|
+
- No hardcoded strings for configuration values — use environment variables.
|
|
25
|
+
- Error handling: always use Result pattern `{ data, error }` for operations that can fail. Never swallow errors.
|
|
26
|
+
|
|
27
|
+
## Safety
|
|
28
|
+
|
|
29
|
+
- Never modify protected files (.env, .env.local, .env.production, secrets/, .git/, lock files) directly.
|
|
30
|
+
- Never run destructive commands (rm -rf /, DROP TABLE, --force push, reset --hard).
|
|
31
|
+
- Only commit when explicitly asked. Prefer specific file staging over `git add .`.
|
|
32
|
+
|
|
33
|
+
## Stack-Specific
|
|
34
|
+
|
|
35
|
+
{{STACK_SPECIFIC_GUARDRAILS}}
|
|
36
|
+
|
|
37
|
+
## Tool-Specific
|
|
38
|
+
|
|
39
|
+
{{TOOL_SPECIFIC_GUARDRAILS}}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "0"
|
|
4
|
+
},
|
|
5
|
+
"permissions": {
|
|
6
|
+
"allow": [
|
|
7
|
+
"Bash(*)",
|
|
8
|
+
"Read(*)",
|
|
9
|
+
"Write(*)",
|
|
10
|
+
"Edit(*)",
|
|
11
|
+
"Glob(*)",
|
|
12
|
+
"Grep(*)",
|
|
13
|
+
"WebFetch(*)",
|
|
14
|
+
"WebSearch(*)",
|
|
15
|
+
"Task(*)",
|
|
16
|
+
"NotebookEdit(*)",
|
|
17
|
+
"mcp__playwright",
|
|
18
|
+
"mcp__sequential-thinking"
|
|
19
|
+
],
|
|
20
|
+
"deny": [
|
|
21
|
+
"Bash(rm -rf /)",
|
|
22
|
+
"Bash(rm -rf ~)",
|
|
23
|
+
"Bash(rm -rf /*)",
|
|
24
|
+
"Bash(rm -rf .)"
|
|
25
|
+
],
|
|
26
|
+
"defaultMode": "{{AUTONOMY_PERMISSIONS}}"
|
|
27
|
+
},
|
|
28
|
+
"hooks": {
|
|
29
|
+
"SessionStart": [
|
|
30
|
+
{
|
|
31
|
+
"matcher": "startup|resume",
|
|
32
|
+
"hooks": [
|
|
33
|
+
{
|
|
34
|
+
"type": "command",
|
|
35
|
+
"command": "bash -c 'echo \"Git: branch=$(git branch --show-current 2>/dev/null || echo none) | uncommitted=$(git status --short 2>/dev/null | wc -l | tr -d \" \") files | recent: $(git log --oneline -3 2>/dev/null || echo none)\"; GLOBAL_GR=\"$HOME/.claude/guardrails.md\"; PROJECT_GR=\"${CLAUDE_PROJECT_DIR:-.}/.claude/guardrails.md\"; if [ -f \"$GLOBAL_GR\" ]; then echo \"=== GLOBAL GUARDRAILS ===\"; cat \"$GLOBAL_GR\"; echo \"=== END GUARDRAILS ===\"; fi; if [ -f \"$PROJECT_GR\" ] && [ \"$PROJECT_GR\" != \"$GLOBAL_GR\" ]; then echo \"=== PROJECT GUARDRAILS ===\"; cat \"$PROJECT_GR\"; echo \"=== END PROJECT GUARDRAILS ===\"; fi'",
|
|
36
|
+
"statusMessage": "Loading git context & guardrails..."
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"matcher": "compact",
|
|
42
|
+
"hooks": [
|
|
43
|
+
{
|
|
44
|
+
"type": "command",
|
|
45
|
+
"command": "bash -c 'cd \"$CLAUDE_PROJECT_DIR\" 2>/dev/null; echo \"=== POST-COMPACTION CONTEXT ===\"; echo \"Branch: $(git branch --show-current 2>/dev/null)\"; echo \"Modified: $(git diff --name-only 2>/dev/null | tr \"\\n\" \", \")\"; echo \"Staged: $(git diff --cached --name-only 2>/dev/null | tr \"\\n\" \", \")\"; echo \"Last 5 commits: $(git log --oneline -5 2>/dev/null)\"; echo \"Rules: {{PACKAGE_MANAGER}} (not others). Check DESIGN.md before UI work.\"; if [ -f DESIGN.md ]; then echo \"DESIGN.md exists — follow it.\"; fi; if [ -f .claude/logs/tool-failures.jsonl ]; then echo \"Recent errors:\"; tail -3 .claude/logs/tool-failures.jsonl 2>/dev/null; fi; GLOBAL_GR=\"$HOME/.claude/guardrails.md\"; PROJECT_GR=\"${CLAUDE_PROJECT_DIR:-.}/.claude/guardrails.md\"; if [ -f \"$GLOBAL_GR\" ]; then echo \"=== GUARDRAILS ===\"; head -50 \"$GLOBAL_GR\"; echo \"=== END ===\"; fi; if [ -f \"$PROJECT_GR\" ] && [ \"$PROJECT_GR\" != \"$GLOBAL_GR\" ]; then echo \"=== PROJECT GUARDRAILS ===\"; head -30 \"$PROJECT_GR\"; echo \"=== END ===\"; fi; echo \"=== END CONTEXT ===\"'",
|
|
46
|
+
"statusMessage": "Re-injecting context..."
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"PreToolUse": [
|
|
52
|
+
{
|
|
53
|
+
"matcher": "Edit|Write",
|
|
54
|
+
"hooks": [
|
|
55
|
+
{
|
|
56
|
+
"type": "command",
|
|
57
|
+
"command": "bash -c 'INPUT=$(cat); FILE=$(echo \"$INPUT\" | jq -r \".tool_input.file_path // empty\"); for p in \".env\" \".env.local\" \".env.production\" \"secrets/\" \".git/\" \"package-lock.json\" \"pnpm-lock.yaml\" \"Pipfile.lock\" \"poetry.lock\" \"Package.resolved\" \"Cargo.lock\"; do if [[ \"$FILE\" == *\"$p\"* ]]; then echo \"Blocked: protected file pattern \\\"$p\\\"\" >&2; exit 2; fi; done; exit 0'",
|
|
58
|
+
"statusMessage": "Checking file protection..."
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"matcher": "Bash",
|
|
64
|
+
"hooks": [
|
|
65
|
+
{
|
|
66
|
+
"type": "command",
|
|
67
|
+
"command": "bash -c 'CMD=$(jq -r \".tool_input.command\" <<< \"$(cat)\"); for p in \"rm -rf /\" \"rm -rf ~\" \"drop table\" \"DROP TABLE\" \"truncate table\" \"TRUNCATE TABLE\" \"push.*--force\" \"--force.*push\" \"reset --hard origin\"; do if echo \"$CMD\" | grep -qiE \"$p\"; then echo \"Blocked: destructive pattern \\\"$p\\\" detected\" >&2; exit 2; fi; done; exit 0'",
|
|
68
|
+
"statusMessage": "Checking command safety..."
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"type": "command",
|
|
72
|
+
"command": "bash -c 'CMD=$(jq -r \".tool_input.command\" <<< \"$(cat)\"); if echo \"$CMD\" | grep -qE \"^git commit\"; then MSG=$(echo \"$CMD\" | grep -oP \"(?<=-m \\\")[^\\\"]+|(?<=-m \\x27)[^\\x27]+\" || echo \"\"); if [ -n \"$MSG\" ] && [ ${#MSG} -lt 10 ]; then echo \"Commit message too short (min 10 chars). Be descriptive.\" >&2; exit 2; fi; fi; exit 0'",
|
|
73
|
+
"statusMessage": "Checking commit message..."
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"PostToolUse": [
|
|
79
|
+
{
|
|
80
|
+
"matcher": "Edit|Write",
|
|
81
|
+
"hooks": [
|
|
82
|
+
{
|
|
83
|
+
"type": "command",
|
|
84
|
+
"command": "bash -c 'FILE=$(jq -r \".tool_input.file_path\" <<< \"$(cat)\"); EXT=\"${FILE##*.}\"; case \"$EXT\" in {{FORMATTER_GLOB}}) {{FORMATTER_COMMAND}} \"$FILE\" 2>/dev/null;; esac; exit 0'",
|
|
85
|
+
"timeout": 15,
|
|
86
|
+
"statusMessage": "Auto-formatting..."
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"matcher": "Bash",
|
|
92
|
+
"hooks": [
|
|
93
|
+
{
|
|
94
|
+
"type": "command",
|
|
95
|
+
"command": "bash -c 'jq -r \".tool_input.command\" <<< \"$(cat)\" | while IFS= read -r cmd; do echo \"$(date +%Y-%m-%dT%H:%M:%S) [$(pwd)] $cmd\" >> ~/.claude/command-audit.log; done; exit 0'",
|
|
96
|
+
"async": true
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"PostToolUseFailure": [
|
|
102
|
+
{
|
|
103
|
+
"hooks": [
|
|
104
|
+
{
|
|
105
|
+
"type": "command",
|
|
106
|
+
"command": "bash -c 'INPUT=$(cat); TOOL=$(echo \"$INPUT\" | jq -r \".tool_name\"); ERROR=$(echo \"$INPUT\" | jq -r \".error // empty\" | head -3); CMD=$(echo \"$INPUT\" | jq -r \".tool_input.command // .tool_input.file_path // empty\" | head -1); mkdir -p \"${CLAUDE_PROJECT_DIR:-.}/.claude/logs\"; echo \"{\\\"ts\\\":\\\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\\\",\\\"tool\\\":\\\"$TOOL\\\",\\\"input\\\":\\\"$(echo $CMD | tr '\"' \"'\" | cut -c1-100)\\\",\\\"error\\\":\\\"$(echo $ERROR | tr '\"' \"'\" | tr \"\\n\" \" \" | cut -c1-200)\\\"}\" >> \"${CLAUDE_PROJECT_DIR:-.}/.claude/logs/tool-failures.jsonl\"; exit 0'",
|
|
107
|
+
"statusMessage": "Logging error pattern...",
|
|
108
|
+
"async": true
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
],
|
|
113
|
+
"PreCompact": [
|
|
114
|
+
{
|
|
115
|
+
"hooks": [
|
|
116
|
+
{
|
|
117
|
+
"type": "command",
|
|
118
|
+
"command": "bash -c 'INPUT=$(cat); TRANSCRIPT=$(echo \"$INPUT\" | jq -r \".transcript_path // empty\"); if [ -n \"$TRANSCRIPT\" ] && [ -f \"$TRANSCRIPT\" ]; then BACKUP_DIR=\"${CLAUDE_PROJECT_DIR:-.}/.claude/backups\"; mkdir -p \"$BACKUP_DIR\"; cp \"$TRANSCRIPT\" \"$BACKUP_DIR/transcript_$(date +%Y%m%d_%H%M%S).jsonl\"; ls -t \"$BACKUP_DIR\"/transcript_*.jsonl 2>/dev/null | tail -n +6 | xargs rm -f 2>/dev/null; fi; exit 0'",
|
|
119
|
+
"statusMessage": "Backing up transcript..."
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
"Stop": [
|
|
125
|
+
{
|
|
126
|
+
"hooks": [
|
|
127
|
+
{
|
|
128
|
+
"type": "prompt",
|
|
129
|
+
"prompt": "Evaluate if Claude should stop. Context: $ARGUMENTS\n\nCheck:\n1. Were ALL user-requested tasks completed (not just attempted)?\n2. Any unresolved errors or failed operations?\n3. If code was changed, was it verified (no obvious type errors, no broken imports)?\n4. Any TODO/FIXME comments added but not resolved?\n\nIMPORTANT: If stop_hook_active is true in the input, this is a second pass — be lenient and only block for critical unfinished work. Never block twice in a row for the same reason.\n\nRespond {\"ok\": true} to allow stopping, or {\"ok\": false, \"reason\": \"what remains\"} to continue.",
|
|
130
|
+
"timeout": 30,
|
|
131
|
+
"statusMessage": "Verifying work completion..."
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"type": "agent",
|
|
135
|
+
"prompt": "Check if meaningful code changes were made in this session by running: git diff --stat HEAD 2>/dev/null\n\nIf there are staged or unstaged changes to source code files (not just config/formatting):\n1. Read the current CHANGELOG.md if it exists\n2. Add entries under [Unreleased] following Keep a Changelog format (Added/Changed/Fixed/Removed)\n3. If CHANGELOG.md doesn't exist, create it with a proper header and the current changes\n\nIf changes are trivial (only formatting, only comments, only config), skip and respond {\"ok\": true}.\nIf stop_hook_active is true, respond {\"ok\": true} immediately — do not update CHANGELOG on second pass.\n\nContext: $ARGUMENTS",
|
|
136
|
+
"timeout": 60,
|
|
137
|
+
"statusMessage": "Updating CHANGELOG..."
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
"SubagentStop": [
|
|
143
|
+
{
|
|
144
|
+
"hooks": [
|
|
145
|
+
{
|
|
146
|
+
"type": "prompt",
|
|
147
|
+
"prompt": "A subagent just finished its work. Review the output in $ARGUMENTS.\n\nCheck the last_assistant_message field:\n1. Did the subagent actually complete its assigned task (not just describe findings)?\n2. Did it leave placeholder code, TODO comments, or incomplete implementations?\n3. If it was supposed to write/edit files, did it actually do so?\n\nIf complete, respond {\"ok\": true}.\nIf incomplete, respond {\"ok\": false, \"reason\": \"specific description of what the subagent still needs to do\"}.",
|
|
148
|
+
"timeout": 30,
|
|
149
|
+
"statusMessage": "Verifying subagent work..."
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
],
|
|
154
|
+
"TeammateIdle": [
|
|
155
|
+
{
|
|
156
|
+
"hooks": [
|
|
157
|
+
{
|
|
158
|
+
"type": "prompt",
|
|
159
|
+
"prompt": "A teammate just became idle. Context: $ARGUMENTS\n\nCheck:\n1. Are all their assigned tasks completed?\n2. Are there unclaimed tasks in the shared task list they could pick up?\n3. Should they assist another teammate who is blocked?\n\nRespond {\"ok\": true} to let them stop, or {\"ok\": false, \"reason\": \"description of remaining work\"} to assign more.",
|
|
160
|
+
"timeout": 30,
|
|
161
|
+
"statusMessage": "Checking teammate workload..."
|
|
162
|
+
}
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
],
|
|
166
|
+
"TaskCompleted": [
|
|
167
|
+
{
|
|
168
|
+
"hooks": [
|
|
169
|
+
{
|
|
170
|
+
"type": "command",
|
|
171
|
+
"command": "bash -c 'INPUT=$(cat); TASK=$(echo \"$INPUT\" | jq -r \".task_id // empty\"); AGENT=$(echo \"$INPUT\" | jq -r \".agent_name // empty\"); mkdir -p \"${CLAUDE_PROJECT_DIR:-.}/.claude/logs\"; echo \"$(date +%Y-%m-%dT%H:%M:%S) TASK_DONE: $TASK by $AGENT\" >> \"${CLAUDE_PROJECT_DIR:-.}/.claude/logs/team-activity.log\"; exit 0'",
|
|
172
|
+
"statusMessage": "Logging task completion...",
|
|
173
|
+
"async": true
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"Notification": [
|
|
179
|
+
{
|
|
180
|
+
"matcher": "permission_prompt",
|
|
181
|
+
"hooks": [
|
|
182
|
+
{
|
|
183
|
+
"type": "command",
|
|
184
|
+
"command": "osascript -e 'display notification \"Claude needs your attention\" with title \"Claude Code\" sound name \"Ping\"'"
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"matcher": "idle_prompt",
|
|
190
|
+
"hooks": [
|
|
191
|
+
{
|
|
192
|
+
"type": "command",
|
|
193
|
+
"command": "osascript -e 'display notification \"Task completed\" with title \"Claude Code\" sound name \"Glass\"'"
|
|
194
|
+
}
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
"skipDangerousModePermissionPrompt": true,
|
|
200
|
+
"effortLevel": "high"
|
|
201
|
+
}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
# PRD Template — Agent-Ready
|
|
2
|
+
|
|
3
|
+
This template produces PRDs that can be handed directly to Claude Code, GSD, or any AI coding agent for autonomous implementation.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Standard PRD Template
|
|
8
|
+
|
|
9
|
+
````markdown
|
|
10
|
+
# PRD: [Feature Name]
|
|
11
|
+
|
|
12
|
+
## Problem
|
|
13
|
+
|
|
14
|
+
What is the problem? Why does it need to be solved? Include business context and who is affected.
|
|
15
|
+
|
|
16
|
+
[2-4 sentences. Be specific about the pain point and its impact.]
|
|
17
|
+
|
|
18
|
+
## Goal
|
|
19
|
+
|
|
20
|
+
What should work when this is done? Measurable outcome.
|
|
21
|
+
|
|
22
|
+
[1-3 sentences. Include success metrics if possible.]
|
|
23
|
+
|
|
24
|
+
## User Stories
|
|
25
|
+
|
|
26
|
+
- As a [role], I want to [action], so that [benefit]
|
|
27
|
+
- As a [role], I want to [action], so that [benefit]
|
|
28
|
+
- As a [role], I want to [action], so that [benefit]
|
|
29
|
+
|
|
30
|
+
[Use Jobs-to-be-Done framing: focus on the motivation behind the action, not just the action itself.]
|
|
31
|
+
|
|
32
|
+
## Acceptance Criteria
|
|
33
|
+
|
|
34
|
+
Each criterion must be independently testable. Use Given/When/Then format for complex criteria.
|
|
35
|
+
|
|
36
|
+
- [ ] AC1: [Concrete, testable criterion]
|
|
37
|
+
- [ ] AC2: [Concrete, testable criterion]
|
|
38
|
+
- [ ] AC3: Given [precondition], When [action], Then [expected result]
|
|
39
|
+
- [ ] AC4: Given [precondition], When [action], Then [expected result]
|
|
40
|
+
|
|
41
|
+
[Every criterion must map to at least one automated test. If you cannot write a test for it, it is not concrete enough.]
|
|
42
|
+
|
|
43
|
+
## Scope
|
|
44
|
+
|
|
45
|
+
### In Scope
|
|
46
|
+
|
|
47
|
+
- Feature X
|
|
48
|
+
- Screen Y
|
|
49
|
+
- API Endpoint Z
|
|
50
|
+
- [List everything that IS being built]
|
|
51
|
+
|
|
52
|
+
### Out of Scope
|
|
53
|
+
|
|
54
|
+
- What should NOT be built (explicit boundaries)
|
|
55
|
+
- Future features that are intentionally deferred
|
|
56
|
+
- Related functionality that belongs to a different PRD
|
|
57
|
+
- [Be explicit — vague boundaries cause scope creep]
|
|
58
|
+
|
|
59
|
+
## Data Model
|
|
60
|
+
|
|
61
|
+
### Tables
|
|
62
|
+
|
|
63
|
+
#### [table_name]
|
|
64
|
+
|
|
65
|
+
| Column | Type | Constraints | Description |
|
|
66
|
+
| ---------- | ----------- | ------------------------------- | --------------------- |
|
|
67
|
+
| id | uuid | PK, default gen_random_uuid() | Primary key |
|
|
68
|
+
| org_id | uuid | FK → organizations.id, NOT NULL | Tenant isolation |
|
|
69
|
+
| [field] | [type] | [constraints] | [description] |
|
|
70
|
+
| created_at | timestamptz | NOT NULL, default now() | Creation timestamp |
|
|
71
|
+
| updated_at | timestamptz | NOT NULL, default now() | Last update timestamp |
|
|
72
|
+
|
|
73
|
+
### Relations
|
|
74
|
+
|
|
75
|
+
- [table_a] belongs to [table_b] via [foreign_key]
|
|
76
|
+
- [table_a] has many [table_c] via [foreign_key]
|
|
77
|
+
|
|
78
|
+
### RLS Policies
|
|
79
|
+
|
|
80
|
+
- [table_name]: Users can only [SELECT/INSERT/UPDATE/DELETE] rows where org_id matches their organization
|
|
81
|
+
- [table_name]: Only admins can [specific operation]
|
|
82
|
+
|
|
83
|
+
### Indexes
|
|
84
|
+
|
|
85
|
+
- [table_name]: unique index on [columns]
|
|
86
|
+
- [table_name]: index on [columns] (query pattern: [describe])
|
|
87
|
+
|
|
88
|
+
## API Design
|
|
89
|
+
|
|
90
|
+
### [HTTP_METHOD] /api/[resource]
|
|
91
|
+
|
|
92
|
+
**Purpose:** [What this endpoint does]
|
|
93
|
+
|
|
94
|
+
**Authentication:** Required / Public
|
|
95
|
+
|
|
96
|
+
**Request:**
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"field": "type — description"
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
````
|
|
104
|
+
|
|
105
|
+
**Response (200):**
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"data": {
|
|
110
|
+
"id": "uuid",
|
|
111
|
+
"field": "value"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Error Responses:**
|
|
117
|
+
|
|
118
|
+
- 400: [When and why]
|
|
119
|
+
- 401: [When and why]
|
|
120
|
+
- 403: [When and why]
|
|
121
|
+
- 404: [When and why]
|
|
122
|
+
- 429: [Rate limit details]
|
|
123
|
+
|
|
124
|
+
[Repeat for each endpoint]
|
|
125
|
+
|
|
126
|
+
## UI/UX
|
|
127
|
+
|
|
128
|
+
- [Layout description or Figma link]
|
|
129
|
+
- [Responsive requirements and breakpoints]
|
|
130
|
+
- [Key interaction patterns]
|
|
131
|
+
- [Empty states, loading states, error states]
|
|
132
|
+
|
|
133
|
+
## Constraints
|
|
134
|
+
|
|
135
|
+
- Performance: [latency, throughput requirements]
|
|
136
|
+
- Dependencies: [external services, existing features]
|
|
137
|
+
- Security: [specific security requirements beyond standard]
|
|
138
|
+
- Timeline: [if applicable]
|
|
139
|
+
|
|
140
|
+
````
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Agent-Ready Extension
|
|
145
|
+
|
|
146
|
+
For autonomous implementation (Ralph Loop, GSD, or full-auto Claude Code), add these three sections to the PRD:
|
|
147
|
+
|
|
148
|
+
```markdown
|
|
149
|
+
## Quality Gates
|
|
150
|
+
|
|
151
|
+
Automated checks that MUST pass before the feature is considered done:
|
|
152
|
+
|
|
153
|
+
- Build: `pnpm build` — 0 errors
|
|
154
|
+
- Types: `tsc --noEmit` — 0 errors
|
|
155
|
+
- Tests: `pnpm vitest run` — all pass, 80%+ coverage on new code
|
|
156
|
+
- Lint: `pnpm lint` — 0 errors, 0 warnings
|
|
157
|
+
- E2E: `npx playwright test` — all pass (if applicable)
|
|
158
|
+
- Security: `/code-review` — no OWASP vulnerabilities
|
|
159
|
+
- RLS: Supabase security advisor — no warnings (if DB changes)
|
|
160
|
+
- No Debug Logs: 0 `console.log` in production code
|
|
161
|
+
- Type Safety: no `any`, no `as` casts in new code
|
|
162
|
+
- File Size: no file exceeds 300 lines
|
|
163
|
+
- Custom: [project-specific checks]
|
|
164
|
+
|
|
165
|
+
## Autonomy Rules
|
|
166
|
+
|
|
167
|
+
Where the AI agent can make its own decisions vs. where it must follow strict guidelines:
|
|
168
|
+
|
|
169
|
+
- Design decisions: [Follow DESIGN.md / use best judgment / ask]
|
|
170
|
+
- Library choices: [use existing dependencies only / free to add / predefined list]
|
|
171
|
+
- Architecture: [follow existing patterns in src/lib/ / free to decide]
|
|
172
|
+
- File structure: [follow project conventions / free to organize]
|
|
173
|
+
- Error messages: [follow i18n patterns / English only / free to decide]
|
|
174
|
+
- On ambiguity: [decide autonomously and document / stop and ask]
|
|
175
|
+
|
|
176
|
+
## Completion Promise
|
|
177
|
+
|
|
178
|
+
The exact phrase that must be 100% true before the agent may declare the feature done:
|
|
179
|
+
|
|
180
|
+
"[All acceptance criteria met, build passes, all tests pass, 0 lint errors, no console.log in production code]"
|
|
181
|
+
|
|
182
|
+
[This phrase is used as the --completion-promise for Ralph Loop or as the exit criterion for GSD execute-phase.]
|
|
183
|
+
````
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Prompt Templates for Handoff
|
|
188
|
+
|
|
189
|
+
### Standard Prompt (for Claude Code)
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
Implement the following feature autonomously from database to frontend.
|
|
193
|
+
|
|
194
|
+
<workflow>
|
|
195
|
+
1. /plan — Create implementation plan, wait for approval
|
|
196
|
+
2. After approval: /tdd (tests first, then code)
|
|
197
|
+
3. /verify after each phase
|
|
198
|
+
4. /e2e for critical user journeys
|
|
199
|
+
5. /code-review at the end
|
|
200
|
+
6. Do NOT commit — show the final git diff
|
|
201
|
+
</workflow>
|
|
202
|
+
|
|
203
|
+
<prd>
|
|
204
|
+
[INSERT COMPLETE PRD HERE]
|
|
205
|
+
</prd>
|
|
206
|
+
|
|
207
|
+
<context>
|
|
208
|
+
- Project: [project name/path]
|
|
209
|
+
- Supabase Project ID: [ID] (if applicable)
|
|
210
|
+
- Follow existing patterns in: [relevant files/directories]
|
|
211
|
+
</context>
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Ralph Loop Prompt (for full autonomy)
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
/ralph-loop Implement [feature name] per the PRD below.
|
|
218
|
+
|
|
219
|
+
<workflow>
|
|
220
|
+
Each iteration:
|
|
221
|
+
1. Check current state (git diff, test results)
|
|
222
|
+
2. Implement the next logical step
|
|
223
|
+
3. Run quality gates after every significant change
|
|
224
|
+
4. When ALL criteria pass: output <promise>[COMPLETION PROMISE]</promise>
|
|
225
|
+
</workflow>
|
|
226
|
+
|
|
227
|
+
<quality_gates>
|
|
228
|
+
[INSERT Quality Gates from PRD]
|
|
229
|
+
</quality_gates>
|
|
230
|
+
|
|
231
|
+
<autonomy_rules>
|
|
232
|
+
[INSERT Autonomy Rules from PRD]
|
|
233
|
+
</autonomy_rules>
|
|
234
|
+
|
|
235
|
+
<prd>
|
|
236
|
+
[INSERT COMPLETE PRD]
|
|
237
|
+
</prd>
|
|
238
|
+
|
|
239
|
+
--max-iterations [N] --completion-promise '[COMPLETION PROMISE]'
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### GSD Prompt (for GSD framework)
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
/gsd:new-project
|
|
246
|
+
|
|
247
|
+
[Paste the PRD when GSD asks for project description.
|
|
248
|
+
GSD will handle the rest: research, planning, execution, verification.]
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Max-Iterations Guide
|
|
254
|
+
|
|
255
|
+
| PRD Complexity | Suggested Max-Iterations | Rationale |
|
|
256
|
+
| ----------------- | ------------------------ | ------------------------------- |
|
|
257
|
+
| Bugfix | 10 | Find + Fix + Test |
|
|
258
|
+
| Small (1-3 AC) | 20 | Single endpoint, simple UI |
|
|
259
|
+
| Standard (4-8 AC) | 30 | DB + API + Frontend + Tests |
|
|
260
|
+
| Large (9+ AC) | 50 | Multi-domain, complex UI, E2E |
|
|
261
|
+
| Refactoring | 15 | Scoped changes, little new code |
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Completion Promise Examples
|
|
266
|
+
|
|
267
|
+
| Feature Type | Promise |
|
|
268
|
+
| ------------- | ----------------------------------------------------------------------------------------- |
|
|
269
|
+
| Standard | "All tests pass, build succeeds, 0 lint errors, no console.log in production code" |
|
|
270
|
+
| With E2E | "All unit tests pass, all e2e tests pass, build succeeds, 0 lint errors" |
|
|
271
|
+
| Bugfix | "Bug is fixed, regression test added and passing, build succeeds" |
|
|
272
|
+
| With Supabase | "Migration applied, RLS policies active, all tests pass, build succeeds, types generated" |
|
|
273
|
+
| Refactoring | "All tests pass, no dead code, build succeeds, 0 lint errors" |
|
|
274
|
+
|
|
275
|
+
> **Note:** Any PRD that includes DB changes (new tables, schema modifications) should include "types generated" in the completion promise. This ensures the type-safety chain (DB schema → generated types → Zod schemas → API → frontend) remains intact. See the "With Supabase" row above for an example.
|