haac-aikit 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/LICENSE +21 -0
- package/README.md +119 -0
- package/catalog/agents/backend.md +49 -0
- package/catalog/agents/devops.md +74 -0
- package/catalog/agents/frontend.md +49 -0
- package/catalog/agents/implementer.md +55 -0
- package/catalog/agents/mobile.md +48 -0
- package/catalog/agents/orchestrator.md +53 -0
- package/catalog/agents/planner.md +59 -0
- package/catalog/agents/researcher.md +62 -0
- package/catalog/agents/reviewer.md +70 -0
- package/catalog/agents/security-auditor.md +73 -0
- package/catalog/agents/tester.md +63 -0
- package/catalog/ci/agents-md-sync.yml +42 -0
- package/catalog/ci/ci.yml +24 -0
- package/catalog/ci/claude.yml +20 -0
- package/catalog/ci/secret-scan.yml +20 -0
- package/catalog/commands/commit-push-pr.md +21 -0
- package/catalog/commands/commit.md +17 -0
- package/catalog/commands/debug.md +17 -0
- package/catalog/commands/execute.md +13 -0
- package/catalog/commands/explore.md +26 -0
- package/catalog/commands/plan.md +19 -0
- package/catalog/commands/review.md +17 -0
- package/catalog/commands/security-review.md +33 -0
- package/catalog/commands/ship.md +21 -0
- package/catalog/commands/tdd.md +21 -0
- package/catalog/devcontainer/devcontainer.json +24 -0
- package/catalog/hooks/block-dangerous-bash.sh +30 -0
- package/catalog/hooks/block-force-push-main.sh +22 -0
- package/catalog/hooks/block-secrets-in-commits.sh +37 -0
- package/catalog/hooks/compaction-preservation.sh +29 -0
- package/catalog/hooks/file-guard.sh +30 -0
- package/catalog/hooks/format-on-save.sh +43 -0
- package/catalog/hooks/hooks.json +70 -0
- package/catalog/hooks/session-start-prime.sh +31 -0
- package/catalog/husky/commit-msg +4 -0
- package/catalog/husky/commitlint.config.js +8 -0
- package/catalog/husky/gitleaks.toml +10 -0
- package/catalog/husky/lintstagedrc.json +5 -0
- package/catalog/husky/pre-commit +4 -0
- package/catalog/husky/pre-push +18 -0
- package/catalog/mcp/mcp.json +19 -0
- package/catalog/plugin/plugin.json +10 -0
- package/catalog/rules/AGENTS.md.tmpl +46 -0
- package/catalog/rules/CLAUDE.md.shim +5 -0
- package/catalog/rules/GEMINI.md.shim +5 -0
- package/catalog/rules/aider-conventions.md +5 -0
- package/catalog/rules/aider.conf.yml +5 -0
- package/catalog/rules/copilot-instructions.md +6 -0
- package/catalog/rules/cursor-base.mdc +13 -0
- package/catalog/rules/windsurf-rules.md +7 -0
- package/catalog/settings/env.example +7 -0
- package/catalog/settings/settings.json +45 -0
- package/catalog/skills/tier1/brainstorming.md +39 -0
- package/catalog/skills/tier1/codebase-exploration.md +55 -0
- package/catalog/skills/tier1/executing-plans.md +34 -0
- package/catalog/skills/tier1/requesting-code-review.md +37 -0
- package/catalog/skills/tier1/systematic-debugging.md +50 -0
- package/catalog/skills/tier1/test-driven-development.md +44 -0
- package/catalog/skills/tier1/using-git-worktrees.md +43 -0
- package/catalog/skills/tier1/verification-before-completion.md +46 -0
- package/catalog/skills/tier1/writing-commits.md +52 -0
- package/catalog/skills/tier1/writing-plans.md +42 -0
- package/catalog/skills/tier2/claude-md-improver.md +42 -0
- package/catalog/skills/tier2/dependency-hygiene.md +52 -0
- package/catalog/skills/tier2/dispatching-parallel-agents.md +43 -0
- package/catalog/skills/tier2/finishing-a-development-branch.md +48 -0
- package/catalog/skills/tier2/receiving-code-review.md +49 -0
- package/catalog/skills/tier2/refactoring-simplify.md +40 -0
- package/catalog/skills/tier2/security-review.md +48 -0
- package/catalog/skills/tier2/writing-pull-requests.md +47 -0
- package/dist/cli.mjs +2161 -0
- package/dist/cli.mjs.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Auto-formats files after Edit/Write.
|
|
3
|
+
# Fires on PostToolUse(Edit|Write).
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
INPUT="$(cat)"
|
|
8
|
+
FILE_PATH="$(echo "$INPUT" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('file_path','') or d.get('path',''))" 2>/dev/null || echo "")"
|
|
9
|
+
|
|
10
|
+
if [[ -z "$FILE_PATH" ]]; then
|
|
11
|
+
exit 0
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
EXT="${FILE_PATH##*.}"
|
|
15
|
+
|
|
16
|
+
case "$EXT" in
|
|
17
|
+
ts|tsx|js|jsx|mjs|cjs)
|
|
18
|
+
if command -v biome &>/dev/null; then
|
|
19
|
+
biome format --write "$FILE_PATH" 2>/dev/null || true
|
|
20
|
+
elif command -v prettier &>/dev/null; then
|
|
21
|
+
prettier --write "$FILE_PATH" 2>/dev/null || true
|
|
22
|
+
fi
|
|
23
|
+
;;
|
|
24
|
+
py)
|
|
25
|
+
if command -v black &>/dev/null; then
|
|
26
|
+
black "$FILE_PATH" 2>/dev/null || true
|
|
27
|
+
elif command -v ruff &>/dev/null; then
|
|
28
|
+
ruff format "$FILE_PATH" 2>/dev/null || true
|
|
29
|
+
fi
|
|
30
|
+
;;
|
|
31
|
+
go)
|
|
32
|
+
if command -v gofmt &>/dev/null; then
|
|
33
|
+
gofmt -w "$FILE_PATH" 2>/dev/null || true
|
|
34
|
+
fi
|
|
35
|
+
;;
|
|
36
|
+
rs)
|
|
37
|
+
if command -v rustfmt &>/dev/null; then
|
|
38
|
+
rustfmt "$FILE_PATH" 2>/dev/null || true
|
|
39
|
+
fi
|
|
40
|
+
;;
|
|
41
|
+
esac
|
|
42
|
+
|
|
43
|
+
exit 0
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"PreToolUse": [
|
|
4
|
+
{
|
|
5
|
+
"matcher": "Bash",
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "bash .claude/hooks/block-dangerous-bash.sh",
|
|
10
|
+
"description": "Block destructive shell commands"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"type": "command",
|
|
14
|
+
"command": "bash .claude/hooks/block-force-push-main.sh",
|
|
15
|
+
"description": "Block force-push to protected branches"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"type": "command",
|
|
19
|
+
"command": "bash .claude/hooks/block-secrets-in-commits.sh",
|
|
20
|
+
"description": "Block commits containing likely secrets"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"matcher": "Read|Edit|Write",
|
|
26
|
+
"hooks": [
|
|
27
|
+
{
|
|
28
|
+
"type": "command",
|
|
29
|
+
"command": "bash .claude/hooks/file-guard.sh",
|
|
30
|
+
"description": "Block access to sensitive files"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
"PostToolUse": [
|
|
36
|
+
{
|
|
37
|
+
"matcher": "Edit|Write",
|
|
38
|
+
"hooks": [
|
|
39
|
+
{
|
|
40
|
+
"type": "command",
|
|
41
|
+
"command": "bash .claude/hooks/format-on-save.sh",
|
|
42
|
+
"description": "Auto-format after file write"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"SessionStart": [
|
|
48
|
+
{
|
|
49
|
+
"hooks": [
|
|
50
|
+
{
|
|
51
|
+
"type": "command",
|
|
52
|
+
"command": "bash .claude/hooks/session-start-prime.sh",
|
|
53
|
+
"description": "Print session context (branch, dirty state, TODOs)"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"PreCompact": [
|
|
59
|
+
{
|
|
60
|
+
"hooks": [
|
|
61
|
+
{
|
|
62
|
+
"type": "command",
|
|
63
|
+
"command": "bash .claude/hooks/compaction-preservation.sh",
|
|
64
|
+
"description": "Save working state before context compaction"
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Prints useful context at session start.
|
|
3
|
+
# Fires on SessionStart.
|
|
4
|
+
|
|
5
|
+
set -euo pipefail
|
|
6
|
+
|
|
7
|
+
echo "=== Session context ==="
|
|
8
|
+
|
|
9
|
+
# Current branch
|
|
10
|
+
BRANCH="$(git branch --show-current 2>/dev/null || echo 'not in a git repo')"
|
|
11
|
+
echo "Branch: $BRANCH"
|
|
12
|
+
|
|
13
|
+
# Uncommitted changes
|
|
14
|
+
DIRTY="$(git status --porcelain 2>/dev/null | wc -l | tr -d ' ')"
|
|
15
|
+
if [[ "$DIRTY" -gt 0 ]]; then
|
|
16
|
+
echo "Uncommitted changes: $DIRTY file(s)"
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
# Recent failing tests (Jest/Vitest)
|
|
20
|
+
if [[ -f ".last-test-result" ]]; then
|
|
21
|
+
echo "Last test run: $(cat .last-test-result)"
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
# TODO count
|
|
25
|
+
TODO_COUNT="$(grep -r 'TODO\|FIXME\|HACK' --include='*.ts' --include='*.js' --include='*.py' . 2>/dev/null | wc -l | tr -d ' ')"
|
|
26
|
+
if [[ "$TODO_COUNT" -gt 0 ]]; then
|
|
27
|
+
echo "TODOs in codebase: $TODO_COUNT"
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
echo "======================"
|
|
31
|
+
exit 0
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
. "$(dirname -- "$0")/_/husky.sh"
|
|
3
|
+
|
|
4
|
+
# Block force-push to protected branches
|
|
5
|
+
REMOTE="$1"
|
|
6
|
+
URL="$2"
|
|
7
|
+
|
|
8
|
+
while read local_ref local_sha remote_ref remote_sha; do
|
|
9
|
+
BRANCH="${remote_ref#refs/heads/}"
|
|
10
|
+
case "$BRANCH" in
|
|
11
|
+
main|master|develop|production|staging)
|
|
12
|
+
if git rev-parse --abbrev-ref HEAD | grep -q "^$BRANCH$"; then
|
|
13
|
+
echo "Error: direct push to '$BRANCH' is not allowed. Open a PR instead."
|
|
14
|
+
exit 1
|
|
15
|
+
fi
|
|
16
|
+
;;
|
|
17
|
+
esac
|
|
18
|
+
done
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"filesystem": {
|
|
4
|
+
"command": "npx",
|
|
5
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."],
|
|
6
|
+
"env": {}
|
|
7
|
+
},
|
|
8
|
+
"memory": {
|
|
9
|
+
"command": "npx",
|
|
10
|
+
"args": ["-y", "@modelcontextprotocol/server-memory"],
|
|
11
|
+
"env": {}
|
|
12
|
+
},
|
|
13
|
+
"fetch": {
|
|
14
|
+
"command": "npx",
|
|
15
|
+
"args": ["-y", "@modelcontextprotocol/server-fetch"],
|
|
16
|
+
"env": {}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{projectName}}-aikit",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "AI-agentic-coding setup for {{projectName}}",
|
|
5
|
+
"vendor": "haac-aikit",
|
|
6
|
+
"skills": ".claude/skills",
|
|
7
|
+
"agents": ".claude/agents",
|
|
8
|
+
"commands": ".claude/commands",
|
|
9
|
+
"hooks": ".claude/hooks/hooks.json"
|
|
10
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# {{projectName}}
|
|
2
|
+
|
|
3
|
+
<!-- BEGIN:haac-aikit -->
|
|
4
|
+
{{description}}
|
|
5
|
+
|
|
6
|
+
## Setup
|
|
7
|
+
TODO: Install dependencies (e.g., `npm install` / `pnpm install`)
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
- Build: TODO
|
|
11
|
+
- Dev: TODO
|
|
12
|
+
- Test: TODO
|
|
13
|
+
- Lint: TODO
|
|
14
|
+
|
|
15
|
+
## Code style
|
|
16
|
+
TODO: Rules not enforceable by linter (naming patterns, file-organisation conventions, etc.)
|
|
17
|
+
|
|
18
|
+
## Project layout
|
|
19
|
+
TODO: 3-5 bullets on where things live.
|
|
20
|
+
<!-- E.g.:
|
|
21
|
+
- src/ Application source
|
|
22
|
+
- src/lib/ Business logic (no UI imports)
|
|
23
|
+
- test/ Co-located unit tests
|
|
24
|
+
-->
|
|
25
|
+
|
|
26
|
+
## Testing
|
|
27
|
+
TODO: How to run a single test; framework quirks.
|
|
28
|
+
|
|
29
|
+
## Commit & PR conventions
|
|
30
|
+
- Conventional commits: `type(scope): description`
|
|
31
|
+
- Types: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`, `perf`
|
|
32
|
+
- PR title < 70 characters; body: Summary + Test Plan.
|
|
33
|
+
- Never force-push to `main`/`master`/`develop`.
|
|
34
|
+
|
|
35
|
+
## Security
|
|
36
|
+
Never read, write, or commit:
|
|
37
|
+
- `.env*`, `secrets/`, `.ssh/`, `.aws/`, `*.pem`, `id_rsa*`
|
|
38
|
+
|
|
39
|
+
Never force-push to `main`/`master`/`develop`.
|
|
40
|
+
|
|
41
|
+
TODO: Project-specific security notes.
|
|
42
|
+
|
|
43
|
+
## Gotchas
|
|
44
|
+
<!-- High-signal section. Add things the agent repeatedly gets wrong. -->
|
|
45
|
+
TODO
|
|
46
|
+
<!-- END:haac-aikit -->
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Base project rules — see AGENTS.md for full context
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<!-- BEGIN:haac-aikit -->
|
|
7
|
+
See [AGENTS.md](../AGENTS.md) for the authoritative project rules.
|
|
8
|
+
|
|
9
|
+
Key constraints:
|
|
10
|
+
- Follow commit conventions from AGENTS.md
|
|
11
|
+
- Never commit .env* or secrets/**
|
|
12
|
+
- Never force-push to main/master/develop
|
|
13
|
+
<!-- END:haac-aikit -->
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# OTel telemetry (optional — remove this file if you don't want telemetry)
|
|
2
|
+
# CLAUDE_CODE_ENABLE_TELEMETRY=1
|
|
3
|
+
# OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
|
|
4
|
+
# OTEL_SERVICE_NAME=my-project
|
|
5
|
+
|
|
6
|
+
# API keys (never commit real values — use secrets management)
|
|
7
|
+
# ANTHROPIC_API_KEY=
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
|
3
|
+
"permissions": {
|
|
4
|
+
"allow": [
|
|
5
|
+
"Bash(npm run *)",
|
|
6
|
+
"Bash(pnpm run *)",
|
|
7
|
+
"Bash(yarn run *)",
|
|
8
|
+
"Bash(bun run *)",
|
|
9
|
+
"Bash(git status)",
|
|
10
|
+
"Bash(git diff*)",
|
|
11
|
+
"Bash(git log*)",
|
|
12
|
+
"Bash(git branch*)",
|
|
13
|
+
"Read(./**)",
|
|
14
|
+
"Grep",
|
|
15
|
+
"Glob"
|
|
16
|
+
],
|
|
17
|
+
"deny": [
|
|
18
|
+
"Read(./.env*)",
|
|
19
|
+
"Read(./secrets/**)",
|
|
20
|
+
"Read(./.ssh/**)",
|
|
21
|
+
"Read(./.aws/**)",
|
|
22
|
+
"Write(./.env*)",
|
|
23
|
+
"Bash(rm -rf /)",
|
|
24
|
+
"Bash(rm -rf ~)",
|
|
25
|
+
"Bash(rm -rf *)",
|
|
26
|
+
"Bash(sudo *)",
|
|
27
|
+
"Bash(curl * | bash)",
|
|
28
|
+
"Bash(wget * | bash)",
|
|
29
|
+
"Bash(dd if=*)",
|
|
30
|
+
"Bash(mkfs*)",
|
|
31
|
+
"Bash(chmod -R 777 *)"
|
|
32
|
+
],
|
|
33
|
+
"ask": [
|
|
34
|
+
"Bash(git push *)",
|
|
35
|
+
"Bash(gh pr create*)",
|
|
36
|
+
"Bash(gh pr merge*)",
|
|
37
|
+
"Bash(npm publish*)",
|
|
38
|
+
"Bash(docker push*)"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"enableAllProjectMcpServers": false,
|
|
42
|
+
"enabledMcpjsonServers": ["filesystem", "memory", "fetch"],
|
|
43
|
+
"includeCoAuthoredBy": true,
|
|
44
|
+
"cleanupPeriodDays": 30
|
|
45
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: brainstorming
|
|
3
|
+
description: Use when a request is ambiguous, has multiple valid approaches, or involves a product/design decision. Clarifies requirements before writing any code or making irreversible changes. Prevents wasted implementation work caused by misunderstood intent.
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
source: obra/superpowers
|
|
6
|
+
license: MIT
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## When to use
|
|
10
|
+
- Request is vague ("make this better", "add auth", "refactor this")
|
|
11
|
+
- Multiple valid implementation approaches exist
|
|
12
|
+
- The task involves a non-trivial architectural decision
|
|
13
|
+
- You're unsure which of several files to modify
|
|
14
|
+
|
|
15
|
+
## Process
|
|
16
|
+
|
|
17
|
+
1. **State what you understand** — describe the goal in your own words (2-3 sentences).
|
|
18
|
+
|
|
19
|
+
2. **Surface your assumptions** — list them explicitly:
|
|
20
|
+
```
|
|
21
|
+
ASSUMPTIONS:
|
|
22
|
+
1. [assumption]
|
|
23
|
+
2. [assumption]
|
|
24
|
+
→ Correct me now or I'll proceed with these.
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
3. **Identify the key decision** — the one choice that, if wrong, invalidates all following work. Name it.
|
|
28
|
+
|
|
29
|
+
4. **Present 2-3 concrete approaches** (not more) — for each: one sentence on what it does, one on the main tradeoff. No implementation yet.
|
|
30
|
+
|
|
31
|
+
5. **Make a recommendation** — state which you'd pick and why. Then stop. Let the human choose.
|
|
32
|
+
|
|
33
|
+
6. **Confirm before implementing** — do not proceed until the human explicitly approves an approach.
|
|
34
|
+
|
|
35
|
+
## Anti-patterns to avoid
|
|
36
|
+
- Asking 5+ questions in sequence instead of synthesising a recommendation
|
|
37
|
+
- Starting implementation before requirements are clear
|
|
38
|
+
- Treating "do X" as unambiguous when X has multiple valid interpretations
|
|
39
|
+
- Presenting approaches without tradeoffs (forces the human to do the analysis)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codebase-exploration
|
|
3
|
+
description: Use when starting work in an unfamiliar codebase or module, before editing any code, or when asked to understand how something works. Read-only reconnaissance before any editing prevents breaking changes caused by misunderstood dependencies.
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
source: haac-aikit
|
|
6
|
+
license: MIT
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## When to use
|
|
10
|
+
- First session in a codebase
|
|
11
|
+
- Moving into a module you haven't touched before
|
|
12
|
+
- Before refactoring code you didn't write
|
|
13
|
+
- When the human asks "how does X work?"
|
|
14
|
+
|
|
15
|
+
## Exploration sequence
|
|
16
|
+
|
|
17
|
+
### 1. Orient (2-3 minutes max)
|
|
18
|
+
```bash
|
|
19
|
+
ls -la # top-level structure
|
|
20
|
+
cat package.json | head -30 # or Cargo.toml / go.mod / pyproject.toml
|
|
21
|
+
git log --oneline -10 # recent activity
|
|
22
|
+
git diff main...HEAD --stat # if on a feature branch
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 2. Find the entry points
|
|
26
|
+
- Web: `src/index.ts`, `app/layout.tsx`, `main.go`, `__main__.py`
|
|
27
|
+
- CLI: look for the `bin` field in package.json, or `cmd/` directory
|
|
28
|
+
- Library: `src/index.ts` exports
|
|
29
|
+
|
|
30
|
+
### 3. Trace the critical path
|
|
31
|
+
For the specific feature you need to touch:
|
|
32
|
+
1. Identify the triggering event (HTTP request, CLI invocation, UI interaction)
|
|
33
|
+
2. Follow the call chain: find the handler → service → data layer
|
|
34
|
+
3. Note each boundary: where does I/O happen? Where does auth happen?
|
|
35
|
+
|
|
36
|
+
### 4. Map dependencies
|
|
37
|
+
- What does the module you're editing import?
|
|
38
|
+
- What imports the module you're editing?
|
|
39
|
+
- Are there hidden consumers (dynamic imports, reflection, DI containers)?
|
|
40
|
+
|
|
41
|
+
### 5. Read tests before source
|
|
42
|
+
Tests reveal intent. Read the test file for the module first — it shows expected behaviour without having to infer it from implementation.
|
|
43
|
+
|
|
44
|
+
## Output format
|
|
45
|
+
```
|
|
46
|
+
Understanding:
|
|
47
|
+
- Entry: [file:line]
|
|
48
|
+
- Critical path: [A → B → C → D]
|
|
49
|
+
- Key dependencies: [list]
|
|
50
|
+
- Gotchas noticed: [anything surprising]
|
|
51
|
+
→ Ready to proceed / Need to clarify: [question]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Constraint
|
|
55
|
+
No file edits during exploration. If you discover something that needs fixing while exploring, note it but do not fix it yet — complete the exploration first.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: executing-plans
|
|
3
|
+
description: Use when executing an approved implementation plan. Ensures each step is verified before moving to the next, surfaces blockers early, and prevents compounding errors from unverified intermediate states.
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
source: obra/superpowers
|
|
6
|
+
license: MIT
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## When to use
|
|
10
|
+
- After a plan has been written and approved
|
|
11
|
+
- When the human says "execute", "go ahead", or "implement it"
|
|
12
|
+
- When running steps from a plan file
|
|
13
|
+
|
|
14
|
+
## Execution protocol
|
|
15
|
+
|
|
16
|
+
1. **Read the full plan** before starting. Identify which steps are sequential vs. parallelisable.
|
|
17
|
+
|
|
18
|
+
2. **Execute one step at a time** — do not batch multiple steps unless they are explicitly parallel.
|
|
19
|
+
|
|
20
|
+
3. **Verify after each step**:
|
|
21
|
+
- File changes: confirm the diff matches intent
|
|
22
|
+
- Code changes: run the relevant test / typecheck
|
|
23
|
+
- State changes: check the state (e.g. `git status`, output of a command)
|
|
24
|
+
|
|
25
|
+
4. **Report progress**: after each step, one line: `Step N done: [what changed]`.
|
|
26
|
+
|
|
27
|
+
5. **Pause on blocking issues**: if a step fails or reveals new information that invalidates subsequent steps, STOP. Report the situation and revised options. Do not barrel through.
|
|
28
|
+
|
|
29
|
+
6. **Final verification**: after the last step, run the full test suite and report: pass/fail count and any regressions.
|
|
30
|
+
|
|
31
|
+
## Do not
|
|
32
|
+
- Skip verification to save time — unverified steps compound
|
|
33
|
+
- Silently adapt from the approved plan — if the plan needs to change, say so
|
|
34
|
+
- Continue past a failed step without explicit human direction
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: requesting-code-review
|
|
3
|
+
description: Use when implementation is complete and ready for review. Dispatches a code-reviewer subagent with precise context about what changed, what was intentional, and what to focus on. Produces actionable review feedback rather than generic observations.
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
source: obra/superpowers
|
|
6
|
+
license: MIT
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## When to use
|
|
10
|
+
- After completing a feature, fix, or refactor
|
|
11
|
+
- Before creating a PR
|
|
12
|
+
- When the human says "review this"
|
|
13
|
+
|
|
14
|
+
## Review request format
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
Dispatching code-reviewer with context:
|
|
18
|
+
- Files changed: [list]
|
|
19
|
+
- What the change does: [1-2 sentences]
|
|
20
|
+
- Intentional tradeoffs: [list things reviewer might question but were deliberate]
|
|
21
|
+
- Focus areas: [specific concerns, or "general review"]
|
|
22
|
+
- Constraints: [test coverage requirement, performance budget, etc.]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## What to provide to the reviewer
|
|
26
|
+
|
|
27
|
+
1. **The diff** — `git diff main...HEAD` or the specific files
|
|
28
|
+
2. **The context** — why this change was made (not what it does — the diff shows that)
|
|
29
|
+
3. **Exclusions** — "ignore the formatting changes in X; those are auto-generated"
|
|
30
|
+
4. **Decision log** — "I chose approach A over B because..."
|
|
31
|
+
|
|
32
|
+
## What to do with review output
|
|
33
|
+
|
|
34
|
+
- For each finding: acknowledge, then either fix + confirm fix, or explain why it's intentional
|
|
35
|
+
- Do not mark a finding as resolved without making the change
|
|
36
|
+
- Do not argue with findings — if you disagree, say so once and defer to the human's judgment
|
|
37
|
+
- Implement all agreed-upon changes before claiming review is addressed
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: systematic-debugging
|
|
3
|
+
description: Use when investigating a bug, unexpected behaviour, test failure, or error message. Prevents shotgun debugging — random code changes hoping something fixes it. Uses hypothesis-driven root cause investigation to find the actual problem before touching code.
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
source: obra/superpowers
|
|
6
|
+
license: MIT
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## When to use
|
|
10
|
+
- A test is failing and you don't know why
|
|
11
|
+
- An error is thrown at runtime
|
|
12
|
+
- Behaviour is incorrect but no error is visible
|
|
13
|
+
- A previous fix attempt made things worse
|
|
14
|
+
|
|
15
|
+
## Protocol
|
|
16
|
+
|
|
17
|
+
### 1. Reproduce first
|
|
18
|
+
Before any code change, confirm you can reproduce the problem. If you can't reliably reproduce it, you can't verify a fix.
|
|
19
|
+
|
|
20
|
+
### 2. Form hypotheses (before reading code)
|
|
21
|
+
Write down 2-3 hypotheses:
|
|
22
|
+
```
|
|
23
|
+
HYPOTHESES:
|
|
24
|
+
H1: [cause] → evidence needed to confirm/refute: [specific thing to check]
|
|
25
|
+
H2: [cause] → evidence needed to confirm/refute: [specific thing to check]
|
|
26
|
+
H3: [cause] → evidence needed to confirm/refute: [specific thing to check]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 3. Test each hypothesis cheaply
|
|
30
|
+
Order by ease of testing. For each:
|
|
31
|
+
- Add a temporary log / assertion (not a permanent change)
|
|
32
|
+
- Run the test / trigger the behaviour
|
|
33
|
+
- Record: confirmed / refuted
|
|
34
|
+
|
|
35
|
+
### 4. Narrow to root cause
|
|
36
|
+
A root cause explains all symptoms. Keep eliminating hypotheses until one remains. If no hypothesis explains the full picture, generate new ones.
|
|
37
|
+
|
|
38
|
+
### 5. Fix only the root cause
|
|
39
|
+
Write the minimal change that addresses the root cause. Do not "clean up" adjacent code unless directly related. Do not fix symptoms while the root cause remains.
|
|
40
|
+
|
|
41
|
+
### 6. Verify the fix
|
|
42
|
+
- The original reproduction no longer triggers the problem
|
|
43
|
+
- All existing tests pass
|
|
44
|
+
- Write a regression test that would have caught this bug originally
|
|
45
|
+
|
|
46
|
+
## Anti-patterns
|
|
47
|
+
- Changing code without a hypothesis
|
|
48
|
+
- "Trying things" sequentially until something works
|
|
49
|
+
- Fixing the symptom (swallowing an exception) rather than the cause
|
|
50
|
+
- Not writing a regression test — the bug will return
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-driven-development
|
|
3
|
+
description: Use when implementing new behaviour, fixing a confirmed bug, or when the human asks for TDD. Enforces the red-green-refactor loop to ensure every behaviour is tested before implementation, preventing untested code from entering the codebase.
|
|
4
|
+
version: "1.0.0"
|
|
5
|
+
source: obra/superpowers
|
|
6
|
+
license: MIT
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## When to use
|
|
10
|
+
- Any new function, method, or module
|
|
11
|
+
- Bug fixes (write the failing regression test first)
|
|
12
|
+
- When "add tests" would be harder after implementation
|
|
13
|
+
|
|
14
|
+
## The loop
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
RED → Write a failing test that describes the exact behaviour needed
|
|
18
|
+
GREEN → Write the minimal implementation to make the test pass
|
|
19
|
+
CHECK → Run the test; confirm it passes and only it (no new breakage)
|
|
20
|
+
REFACTOR → Clean up without changing behaviour; re-run tests after each change
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## RED — writing a good failing test
|
|
24
|
+
|
|
25
|
+
- Name it: `it('should [verb] [noun] when [condition]', ...)`
|
|
26
|
+
- Assert on the observable output, not the internal implementation
|
|
27
|
+
- One behaviour per test — if you're using "and" in the name, split it
|
|
28
|
+
- Run it: confirm it fails for the right reason (not a compile error or import failure)
|
|
29
|
+
|
|
30
|
+
## GREEN — minimal implementation
|
|
31
|
+
|
|
32
|
+
- Write only enough code to pass the test — no extra features
|
|
33
|
+
- It's OK if the code is ugly; refactor comes next
|
|
34
|
+
- Do not modify the test to make it pass
|
|
35
|
+
|
|
36
|
+
## REFACTOR
|
|
37
|
+
|
|
38
|
+
- Remove duplication
|
|
39
|
+
- Improve naming
|
|
40
|
+
- Extract helpers only when the abstraction is obvious
|
|
41
|
+
- Each refactor step: change → run tests → if green, continue; if red, revert
|
|
42
|
+
|
|
43
|
+
## Definition of done
|
|
44
|
+
All tests pass. No test has been modified to accommodate implementation. No production code exists without a covering test.
|