bigpowers 2.1.3 → 2.3.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.
Files changed (164) hide show
  1. package/.pi/package.json +16 -0
  2. package/.pi/prompts/assess-impact.md +76 -0
  3. package/.pi/prompts/audit-code.md +156 -0
  4. package/.pi/prompts/build-epic.md +44 -0
  5. package/.pi/prompts/change-request.md +105 -0
  6. package/.pi/prompts/commit-message.md +135 -0
  7. package/.pi/prompts/compose-workflow.md +40 -0
  8. package/.pi/prompts/craft-skill.md +150 -0
  9. package/.pi/prompts/deepen-architecture.md +235 -0
  10. package/.pi/prompts/define-language.md +79 -0
  11. package/.pi/prompts/define-success.md +62 -0
  12. package/.pi/prompts/delegate-task.md +76 -0
  13. package/.pi/prompts/design-interface.md +96 -0
  14. package/.pi/prompts/develop-tdd.md +375 -0
  15. package/.pi/prompts/diagnose-root.md +23 -0
  16. package/.pi/prompts/dispatch-agents.md +83 -0
  17. package/.pi/prompts/edit-document.md +22 -0
  18. package/.pi/prompts/elaborate-spec.md +81 -0
  19. package/.pi/prompts/enforce-first.md +77 -0
  20. package/.pi/prompts/evolve-skill.md +38 -0
  21. package/.pi/prompts/execute-plan.md +54 -0
  22. package/.pi/prompts/fix-bug.md +36 -0
  23. package/.pi/prompts/grill-me.md +95 -0
  24. package/.pi/prompts/grill-with-docs.md +37 -0
  25. package/.pi/prompts/guard-git.md +212 -0
  26. package/.pi/prompts/hook-commits.md +93 -0
  27. package/.pi/prompts/inspect-quality.md +105 -0
  28. package/.pi/prompts/investigate-bug.md +117 -0
  29. package/.pi/prompts/kickoff-branch.md +99 -0
  30. package/.pi/prompts/map-codebase.md +70 -0
  31. package/.pi/prompts/migrate-spec.md +482 -0
  32. package/.pi/prompts/model-domain.md +227 -0
  33. package/.pi/prompts/orchestrate-project.md +161 -0
  34. package/.pi/prompts/organize-workspace.md +159 -0
  35. package/.pi/prompts/plan-refactor.md +77 -0
  36. package/.pi/prompts/plan-release.md +145 -0
  37. package/.pi/prompts/plan-work.md +161 -0
  38. package/.pi/prompts/release-branch.md +158 -0
  39. package/.pi/prompts/request-review.md +70 -0
  40. package/.pi/prompts/research-first.md +62 -0
  41. package/.pi/prompts/reset-baseline.md +20 -0
  42. package/.pi/prompts/respond-review.md +70 -0
  43. package/.pi/prompts/run-evals.md +56 -0
  44. package/.pi/prompts/run-planning.md +26 -0
  45. package/.pi/prompts/scope-work.md +23 -0
  46. package/.pi/prompts/search-skills.md +21 -0
  47. package/.pi/prompts/seed-conventions.md +132 -0
  48. package/.pi/prompts/session-state.md +146 -0
  49. package/.pi/prompts/setup-environment.md +23 -0
  50. package/.pi/prompts/simulate-agents.md +25 -0
  51. package/.pi/prompts/slice-tasks.md +23 -0
  52. package/.pi/prompts/spike-prototype.md +94 -0
  53. package/.pi/prompts/stocktake-skills.md +40 -0
  54. package/.pi/prompts/survey-context.md +129 -0
  55. package/.pi/prompts/terse-mode.md +37 -0
  56. package/.pi/prompts/trace-requirement.md +68 -0
  57. package/.pi/prompts/using-bigpowers.md +105 -0
  58. package/.pi/prompts/validate-fix.md +98 -0
  59. package/.pi/prompts/verify-work.md +125 -0
  60. package/.pi/prompts/visual-dashboard.md +51 -0
  61. package/.pi/prompts/wire-observability.md +92 -0
  62. package/.pi/prompts/write-document.md +244 -0
  63. package/.pi/skills/assess-impact/SKILL.md +77 -0
  64. package/.pi/skills/audit-code/SKILL.md +157 -0
  65. package/.pi/skills/build-epic/SKILL.md +45 -0
  66. package/.pi/skills/change-request/SKILL.md +106 -0
  67. package/.pi/skills/commit-message/SKILL.md +136 -0
  68. package/.pi/skills/compose-workflow/SKILL.md +41 -0
  69. package/.pi/skills/craft-skill/SKILL.md +151 -0
  70. package/.pi/skills/deepen-architecture/SKILL.md +236 -0
  71. package/.pi/skills/define-language/SKILL.md +80 -0
  72. package/.pi/skills/define-success/SKILL.md +63 -0
  73. package/.pi/skills/delegate-task/SKILL.md +77 -0
  74. package/.pi/skills/design-interface/SKILL.md +97 -0
  75. package/.pi/skills/develop-tdd/SKILL.md +376 -0
  76. package/.pi/skills/diagnose-root/SKILL.md +24 -0
  77. package/.pi/skills/dispatch-agents/SKILL.md +84 -0
  78. package/.pi/skills/edit-document/SKILL.md +23 -0
  79. package/.pi/skills/elaborate-spec/SKILL.md +82 -0
  80. package/.pi/skills/enforce-first/SKILL.md +78 -0
  81. package/.pi/skills/evolve-skill/SKILL.md +39 -0
  82. package/.pi/skills/execute-plan/SKILL.md +55 -0
  83. package/.pi/skills/fix-bug/SKILL.md +37 -0
  84. package/.pi/skills/grill-me/SKILL.md +96 -0
  85. package/.pi/skills/grill-with-docs/SKILL.md +38 -0
  86. package/.pi/skills/guard-git/SKILL.md +213 -0
  87. package/.pi/skills/hook-commits/SKILL.md +94 -0
  88. package/.pi/skills/inspect-quality/SKILL.md +106 -0
  89. package/.pi/skills/investigate-bug/SKILL.md +118 -0
  90. package/.pi/skills/kickoff-branch/SKILL.md +100 -0
  91. package/.pi/skills/map-codebase/SKILL.md +71 -0
  92. package/.pi/skills/migrate-spec/SKILL.md +483 -0
  93. package/.pi/skills/model-domain/SKILL.md +228 -0
  94. package/.pi/skills/orchestrate-project/SKILL.md +162 -0
  95. package/.pi/skills/organize-workspace/SKILL.md +160 -0
  96. package/.pi/skills/plan-refactor/SKILL.md +78 -0
  97. package/.pi/skills/plan-release/SKILL.md +146 -0
  98. package/.pi/skills/plan-work/SKILL.md +162 -0
  99. package/.pi/skills/release-branch/SKILL.md +159 -0
  100. package/.pi/skills/request-review/SKILL.md +71 -0
  101. package/.pi/skills/research-first/SKILL.md +63 -0
  102. package/.pi/skills/reset-baseline/SKILL.md +21 -0
  103. package/.pi/skills/respond-review/SKILL.md +71 -0
  104. package/.pi/skills/run-evals/SKILL.md +57 -0
  105. package/.pi/skills/run-planning/SKILL.md +27 -0
  106. package/.pi/skills/scope-work/SKILL.md +24 -0
  107. package/.pi/skills/search-skills/SKILL.md +22 -0
  108. package/.pi/skills/seed-conventions/SKILL.md +133 -0
  109. package/.pi/skills/session-state/SKILL.md +147 -0
  110. package/.pi/skills/setup-environment/SKILL.md +24 -0
  111. package/.pi/skills/simulate-agents/SKILL.md +26 -0
  112. package/.pi/skills/slice-tasks/SKILL.md +24 -0
  113. package/.pi/skills/spike-prototype/SKILL.md +95 -0
  114. package/.pi/skills/stocktake-skills/SKILL.md +41 -0
  115. package/.pi/skills/survey-context/SKILL.md +130 -0
  116. package/.pi/skills/terse-mode/SKILL.md +38 -0
  117. package/.pi/skills/trace-requirement/SKILL.md +69 -0
  118. package/.pi/skills/using-bigpowers/SKILL.md +106 -0
  119. package/.pi/skills/validate-fix/SKILL.md +99 -0
  120. package/.pi/skills/verify-work/SKILL.md +126 -0
  121. package/.pi/skills/visual-dashboard/SKILL.md +52 -0
  122. package/.pi/skills/wire-observability/SKILL.md +93 -0
  123. package/.pi/skills/write-document/SKILL.md +245 -0
  124. package/CHANGELOG.md +14 -0
  125. package/CLAUDE.md +1 -1
  126. package/CONVENTIONS.md +16 -10
  127. package/README.md +30 -4
  128. package/build-epic/SKILL.md +1 -1
  129. package/deepen-architecture/SKILL.md +2 -0
  130. package/define-language/SKILL.md +2 -0
  131. package/develop-tdd/REFERENCE.md +61 -0
  132. package/develop-tdd/SKILL.md +19 -119
  133. package/diagnose-root/SKILL.md +2 -0
  134. package/edit-document/SKILL.md +2 -0
  135. package/fix-bug/SKILL.md +3 -1
  136. package/grill-me/SKILL.md +3 -1
  137. package/grill-with-docs/SKILL.md +3 -1
  138. package/investigate-bug/SKILL.md +5 -11
  139. package/map-codebase/SKILL.md +3 -1
  140. package/migrate-spec/REFERENCE-GSD.md +4 -4
  141. package/migrate-spec/REFERENCE.md +33 -6
  142. package/migrate-spec/SKILL.md +1 -14
  143. package/model-domain/SKILL.md +2 -0
  144. package/orchestrate-project/REFERENCE.md +1 -1
  145. package/package.json +3 -2
  146. package/plan-release/SKILL.md +1 -1
  147. package/plan-work/REFERENCE.md +104 -0
  148. package/plan-work/SKILL.md +17 -151
  149. package/release-branch/REFERENCE.md +55 -0
  150. package/release-branch/SKILL.md +19 -117
  151. package/request-review/SKILL.md +1 -1
  152. package/run-planning/SKILL.md +3 -2
  153. package/scope-work/SKILL.md +3 -1
  154. package/scripts/audit-compliance.sh +15 -3
  155. package/scripts/check-skill-size.sh +79 -0
  156. package/scripts/generate-reference-tables.sh +64 -0
  157. package/scripts/project-survey.sh +2 -2
  158. package/scripts/sync-skills.sh +51 -3
  159. package/scripts/validate-doctrine.sh +143 -0
  160. package/seed-conventions/REFERENCE.md +63 -0
  161. package/seed-conventions/SKILL.md +23 -177
  162. package/slice-tasks/SKILL.md +3 -1
  163. package/survey-context/SKILL.md +3 -1
  164. package/write-document/SKILL.md +4 -2
@@ -0,0 +1,213 @@
1
+ ---
2
+ name: guard-git
3
+ description: "Block dangerous git commands (push, force push, reset --hard, clean, branch -D, checkout/restore .) and enforce Conventional Commits & Branch Protection before an AI agent runs them. Installs hook scripts for Claude Code, Cursor, Cursor CLI, and Gemini CLI; documents Google Antigravity Terminal deny lists. Use when the user wants git safety hooks, to block git push or destructive git in agents, or to mirror the same policy across AI coding tools."
4
+ ---
5
+
6
+
7
+ # Guard Git
8
+ > **HARD GATE** — **HARD GATE** — Before committing, verify: branch is not main/master, author is correct, git user is configured. Bad commits are hard to fix.
9
+
10
+
11
+ Installs a shared hook that blocks destructive git operations and enforces workflow discipline. **Requires `jq` on the agent's PATH** when the hook runs.
12
+
13
+ ## What gets blocked/enforced
14
+
15
+ - **Safety**: `git push --force`, `git reset --hard`, `git clean -f`, `git branch -D`, `git checkout .`, `git restore .`.
16
+ - **Discipline**: Blocks direct commits or pushes to protected branches (`main`, `master`) unless `GIT_BIGPOWERS_LAND=1` (set only by `scripts/land-branch.sh`).
17
+ - **Allows**: `git push origin <feature-branch>` for backup/CI; solo land push to `main` only inside `land-branch.sh`.
18
+ - **Standardization**: Enforces [Conventional Commits](https://www.conventionalcommits.org/) for all `git commit` commands.
19
+ - **Secrets**: Blocks commits containing common secret patterns (`sk-`, `ghp_`, `AKIA`, `xoxb-`, `-----BEGIN` private keys) — see [REFERENCE.md](REFERENCE.md).
20
+
21
+ ## Quick start
22
+
23
+ 1. **Scope**: ask project-only vs global (paths differ per product).
24
+ 2. **Copy the hook bundle** from the root [hooks/](hooks/) directory to the client's hooks directory.
25
+ 3. **Run `chmod +x`** on `pre-tool-use.sh`.
26
+ 4. **Merge** the hook snippet from [REFERENCE.md](REFERENCE.md) into the right settings file — do not wipe unrelated keys.
27
+ 5. **Verify** with the tests in [REFERENCE.md](REFERENCE.md).
28
+
29
+ | Client | Mechanism | Config |
30
+ |--------|-----------|--------|
31
+ | Claude Code | `PreToolUse` (Bash) | `.claude/settings.json` or `~/.claude/settings.json` |
32
+ | Cursor / Cursor CLI | `beforeShellExecution` | `.cursor/hooks.json` or `~/.cursor/hooks.json` |
33
+ | Gemini CLI | `BeforeTool` + `run_shell_command` | `.gemini/settings.json` or `~/.gemini/settings.json` |
34
+ | Google Antigravity | Built-in Terminal **Deny list** | Settings UI (no shell hook) |
35
+
36
+ **Modes (env on the hook command):** `GIT_GUARDRAILS_MODE` is `claude` (default) or `cursor` → stderr + exit `2` on block. Set `gemini` for Gemini CLI → JSON `decision` on stdout.
37
+
38
+ ## Customization
39
+
40
+ To add or remove patterns or protected branches, edit `pre-tool-use.sh`.
41
+
42
+ ## Advanced
43
+
44
+ Full JSON examples, merge rules, Antigravity deny-list entries, and test commands: [REFERENCE.md](REFERENCE.md).
45
+
46
+ ---
47
+
48
+ # Git guardrails — reference
49
+
50
+ ## Secret patterns (audit + pre-commit)
51
+
52
+ Agents must not commit files containing:
53
+
54
+ - `sk-` (OpenAI API keys)
55
+ - `ghp_` / `gho_` (GitHub tokens)
56
+ - `AKIA` (AWS access key id)
57
+ - `xoxb-` (Slack bot tokens)
58
+ - `-----BEGIN` private keys
59
+
60
+ Use `audit-code` supply-chain checklist before commit. Consider `git-secrets` or custom pre-commit hook in target projects.
61
+
62
+ ## Copy layout
63
+
64
+ The main script is `pre-tool-use.sh`.
65
+
66
+ ```text
67
+ <hooks-dir>/pre-tool-use.sh
68
+ ```
69
+
70
+ Example project locations:
71
+
72
+ - Claude: `.claude/hooks/`
73
+ - Cursor: `.cursor/hooks/`
74
+ - Gemini: `.gemini/hooks/`
75
+
76
+ Use the same layout for user-level hooks (`~/.claude/hooks`, `~/.cursor/hooks`, `~/.gemini/hooks`).
77
+
78
+ ---
79
+
80
+ ## Claude Code
81
+
82
+ Hook command does **not** need `GIT_GUARDRAILS_MODE` (defaults to `claude`).
83
+
84
+ **Project** (`.claude/settings.json`):
85
+
86
+ ```json
87
+ {
88
+ "hooks": {
89
+ "PreToolUse": [
90
+ {
91
+ "matcher": "Bash",
92
+ "hooks": [
93
+ {
94
+ "type": "command",
95
+ "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/pre-tool-use.sh"
96
+ }
97
+ ]
98
+ }
99
+ ]
100
+ }
101
+ }
102
+ ```
103
+
104
+ ---
105
+
106
+ ## Cursor and Cursor CLI
107
+
108
+ Use `beforeShellExecution`. Set `GIT_GUARDRAILS_MODE=cursor`.
109
+
110
+ **Project** (`.cursor/hooks.json`):
111
+
112
+ ```json
113
+ {
114
+ "version": 1,
115
+ "hooks": {
116
+ "beforeShellExecution": [
117
+ {
118
+ "command": "GIT_GUARDRAILS_MODE=cursor .cursor/hooks/pre-tool-use.sh",
119
+ "matcher": "git"
120
+ }
121
+ ]
122
+ }
123
+ }
124
+ ```
125
+
126
+ ---
127
+
128
+ ## Gemini CLI
129
+
130
+ Use `BeforeTool` with matcher `run_shell_command`. Set **`GIT_GUARDRAILS_MODE=gemini`**.
131
+
132
+ **Project** (`.gemini/settings.json`):
133
+
134
+ ```json
135
+ {
136
+ "hooks": {
137
+ "BeforeTool": [
138
+ {
139
+ "matcher": "run_shell_command",
140
+ "hooks": [
141
+ {
142
+ "name": "git-guardrails",
143
+ "type": "command",
144
+ "command": "GIT_GUARDRAILS_MODE=gemini \"$GEMINI_PROJECT_DIR\"/.gemini/hooks/pre-tool-use.sh",
145
+ "timeout": 5000
146
+ }
147
+ ]
148
+ }
149
+ ]
150
+ }
151
+ }
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Google Antigravity
157
+
158
+ Add **Deny list** entries in **Antigravity → Settings → Terminal**:
159
+
160
+ - `git push --force`
161
+ - `git push origin main`
162
+ - `git push origin master`
163
+ - `git reset --hard`
164
+ - `git clean`
165
+ - `git branch -D`
166
+ - `git checkout .`
167
+ - `git restore .`
168
+
169
+ ---
170
+
171
+ ## Verify (local tests)
172
+
173
+ **1. Block push to main without land mode (Claude mode):**
174
+ ```bash
175
+ echo '{"tool_input":{"command":"git push origin main"}}' | ./pre-tool-use.sh
176
+ # Expected: exit 2, protected branch message
177
+ ```
178
+
179
+ **2. Allow push to main with GIT_BIGPOWERS_LAND=1:**
180
+ ```bash
181
+ GIT_BIGPOWERS_LAND=1 echo '{"tool_input":{"command":"git push origin main"}}' | ./pre-tool-use.sh
182
+ # Expected: exit 0 (when on main)
183
+ ```
184
+
185
+ **3. Allow push to feature branch:**
186
+ ```bash
187
+ echo '{"tool_input":{"command":"git push -u origin feat/my-task"}}' | ./pre-tool-use.sh
188
+ # Expected: exit 0
189
+ ```
190
+
191
+ **4. Conventional Commits (Gemini mode):**
192
+ ```bash
193
+ echo '{"tool_input":{"command":"git commit -m \"bad message\""}}' | GIT_GUARDRAILS_MODE=gemini ./pre-tool-use.sh
194
+ # Expected: exit 0, {"decision":"deny", "reason":"..."}
195
+ ```
196
+
197
+ **5. Protected Branch commit (Cursor mode):**
198
+ ```bash
199
+ # Run on 'main' branch
200
+ echo '{"command":"git commit -m \"feat: valid message\""}' | GIT_GUARDRAILS_MODE=cursor ./pre-tool-use.sh
201
+ # Expected: exit 2, "Direct commits to protected branch 'main' are forbidden"
202
+ ```
203
+
204
+ **6. Land script exists:**
205
+ ```bash
206
+ test -x scripts/land-branch.sh && echo OK
207
+ ```
208
+
209
+ **7. Allow (Gemini mode):**
210
+ ```bash
211
+ echo '{"tool_input":{"command":"git status"}}' | GIT_GUARDRAILS_MODE=gemini ./pre-tool-use.sh
212
+ # Expected: exit 0, {"decision":"allow"}
213
+ ```
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: hook-commits
3
+ description: "Set up pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing."
4
+ ---
5
+
6
+
7
+ # Hook Commits
8
+ > **HARD GATE** — **HARD GATE** — Pre-commit and commit-msg hooks must run before any commit lands. Skipping hooks (`--no-verify`) is forbidden unless explicitly authorized for a specific commit and documented.
9
+
10
+
11
+ ## What This Sets Up
12
+
13
+ - **Husky** pre-commit hook
14
+ - **lint-staged** running Prettier on all staged files
15
+ - **Prettier** config (if missing)
16
+ - **typecheck** and **test** scripts in the pre-commit hook
17
+
18
+ ## Steps
19
+
20
+ ### 1. Detect package manager
21
+
22
+ Check for `package-lock.json` (npm), `pnpm-lock.yaml` (pnpm), `yarn.lock` (yarn), `bun.lockb` (bun). Use whichever is present. Default to npm if unclear.
23
+
24
+ ### 2. Install dependencies
25
+
26
+ Install as devDependencies:
27
+
28
+ ```
29
+ husky lint-staged prettier
30
+ ```
31
+
32
+ ### 3. Initialize Husky
33
+
34
+ ```bash
35
+ npx husky init
36
+ ```
37
+
38
+ This creates `.husky/` dir and adds `prepare: "husky"` to package.json.
39
+
40
+ ### 4. Create `.husky/pre-commit`
41
+
42
+ Write this file (no shebang needed for Husky v9+):
43
+
44
+ ```
45
+ npx lint-staged
46
+ npm run typecheck
47
+ npm run test
48
+ ```
49
+
50
+ **Adapt**: Replace `npm` with detected package manager. If repo has no `typecheck` or `test` script in package.json, omit those lines and tell the user.
51
+
52
+ ### 5. Create `.lintstagedrc`
53
+
54
+ ```json
55
+ {
56
+ "*": "prettier --ignore-unknown --write"
57
+ }
58
+ ```
59
+
60
+ ### 6. Create `.prettierrc` (if missing)
61
+
62
+ Only create if no Prettier config exists. Use these defaults:
63
+
64
+ ```json
65
+ {
66
+ "useTabs": false,
67
+ "tabWidth": 2,
68
+ "printWidth": 80,
69
+ "singleQuote": false,
70
+ "trailingComma": "es5",
71
+ "semi": true,
72
+ "arrowParens": "always"
73
+ }
74
+ ```
75
+
76
+ ### 7. Verify
77
+
78
+ - [ ] `.husky/pre-commit` exists and is executable
79
+ - [ ] `.lintstagedrc` exists
80
+ - [ ] `prepare` script in package.json is `"husky"`
81
+ - [ ] `prettier` config exists
82
+ - [ ] Run `npx lint-staged` to verify it works
83
+
84
+ ### 8. Commit
85
+
86
+ Stage all changed/created files and commit with message: `chore: add pre-commit hooks (husky + lint-staged + prettier)`
87
+
88
+ This will run through the new pre-commit hooks — a good smoke test that everything works.
89
+
90
+ ## Notes
91
+
92
+ - Husky v9+ doesn't need shebangs in hook files
93
+ - `prettier --ignore-unknown` skips files Prettier can't parse (images, etc.)
94
+ - The pre-commit runs lint-staged first (fast, staged-only), then full typecheck and tests
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: inspect-quality
3
+ description: "Interactive QA session where user reports bugs or issues conversationally, and the agent logs them to specs/bugs/registry.yaml with a structured audit schema. Explores the codebase in the background for context and domain language. Use when user wants to report bugs, do QA, or mentions "QA session"."
4
+ ---
5
+
6
+
7
+ # Inspect Quality
8
+ > **HARD GATE** — **HARD GATE** — Quality metrics (coverage, lint, cyclomatic complexity, security scans) must be monitored. If a metric degrades, surface it as a blocker. Do NOT accept regressions.
9
+
10
+
11
+ Run an interactive QA session. The user describes problems they're encountering. You clarify, explore the codebase for context, and log each issue to `specs/bugs/registry.yaml` with a structured, durable format.
12
+
13
+ ## For each issue the user raises
14
+
15
+ ### 1. Listen and lightly clarify
16
+
17
+ Let the user describe the problem in their own words. Ask **at most 2–3 short clarifying questions** focused on:
18
+
19
+ - What they expected vs what actually happened
20
+ - Steps to reproduce (if not obvious)
21
+ - Whether it's consistent or intermittent
22
+
23
+ Do NOT over-interview. If the description is clear enough to log, move on.
24
+
25
+ ### 2. Explore the codebase in the background
26
+
27
+ Kick off an Agent (subagent_type=Explore) to understand the relevant area. The goal is NOT to find a fix — it's to:
28
+
29
+ - Learn the domain language used in that area (check `specs/UBIQUITOUS_LANGUAGE.md` if present)
30
+ - Understand what the feature is supposed to do
31
+ - Identify the user-facing behavior boundary
32
+
33
+ ### 3. Assess scope: single issue or breakdown?
34
+
35
+ Break down when:
36
+
37
+ - The fix spans multiple independent areas
38
+ - There are clearly separable concerns that could be worked on in parallel
39
+ - The user describes something with multiple distinct failure modes
40
+
41
+ Keep as a single issue when:
42
+
43
+ - It's one behavior that's wrong in one place
44
+ - The symptoms are all caused by the same root behavior
45
+
46
+ ### 4. Log to specs/bugs/registry.yaml
47
+
48
+ Append the issue to `specs/bugs/registry.yaml`. Create the `specs/bugs/` directory if it doesn't exist.
49
+
50
+ #### registry.yaml format
51
+
52
+ The file maintains a Markdown table with the following columns (derived from structured audit practice):
53
+
54
+ | Field | Description |
55
+ |-------|-------------|
56
+ | `bug_id` | `BUG-YYYY-MM-DDTHHMMSS` |
57
+ | `date` | `YYYY-MM-DD` |
58
+ | `severity` | `critical` / `high` / `medium` / `low` |
59
+ | `priority` | `p0` / `p1` / `p2` / `p3` |
60
+ | `scope` | kebab-case area (e.g. `auth`, `checkout`) |
61
+ | `what_happened` | actual behavior (user-facing terms) |
62
+ | `what_expected` | expected behavior |
63
+ | `steps_to_reproduce` | numbered steps |
64
+ | `root_cause` | one-line hypothesis |
65
+ | `files_changed` | filled in after fix |
66
+ | `approach` | filled in after fix |
67
+ | `risk_level` | `low` / `medium` / `high` |
68
+ | `new_tests` | count (filled in after fix) |
69
+ | `type_check` | `pass` / `fail` (filled in after fix) |
70
+ | `lint` | `pass` / `fail` (filled in after fix) |
71
+ | `commit_type` | `fix` / `fix!` / `feat` (filled in after fix) |
72
+ | `release_type` | `patch` / `minor` / `major` (filled in after fix) |
73
+ | `commit_message` | Conventional Commits message (filled in after fix) |
74
+ | `follow_ups` | semicolon-separated follow-up items |
75
+ | `file` | path to detailed `specs/bugs/BUG-*.md` (filled in by investigate-bug) |
76
+ | `status` | `open` / `in-progress` / `fixed` / `wont-fix` |
77
+
78
+ When a bug is fixed (via `validate-fix`), update the relevant row with the resolution fields.
79
+
80
+ #### Issue body (for context below the table)
81
+
82
+ For each bug, also append a detail section:
83
+
84
+ ```markdown
85
+ ### BUG-YYYY-MM-DDTHHMMSS: [short title]
86
+
87
+ **What happened:** [actual behavior, plain language]
88
+ **What I expected:** [expected behavior]
89
+ **Steps to reproduce:**
90
+ 1. [Step 1]
91
+ 2. [Step 2]
92
+
93
+ **Additional context:** [domain-language observations, no file paths]
94
+ ```
95
+
96
+ #### Rules for all entries
97
+
98
+ - **bug_id** uses full timestamp: `BUG-YYYY-MM-DDTHHMMSS` — matches the individual bug file name in `specs/bugs/`
99
+ - **No file paths or line numbers** — these go stale
100
+ - **Use the project's domain language** (check `specs/UBIQUITOUS_LANGUAGE.md` if it exists)
101
+ - **Describe behaviors, not code** — "the sync service fails to apply the patch" not "applyPatch() throws"
102
+ - **Reproduction steps are mandatory** — if you can't determine them, ask the user
103
+
104
+ ### 5. Continue the session
105
+
106
+ After logging, ask: "Next issue, or are we done?" Keep going until the user says done. Each issue is independent — don't batch them.
@@ -0,0 +1,118 @@
1
+ ---
2
+ name: investigate-bug
3
+ description: "Investigate a bug or issue by exploring the codebase to find root cause, then write a TDD-based fix plan to specs/bugs/BUG-*.md. Use when user reports a bug, wants to investigate a problem, mentions "triage", or wants to plan a fix."
4
+ ---
5
+
6
+
7
+ # Investigate Bug
8
+
9
+ **Boundary**: End-to-end bug entry point — history check → RCA (via `diagnose-root`) → fix approach → TDD plan → bug file. Delegates the 4-phase RCA to `diagnose-root`; does not re-implement it.
10
+
11
+ Investigate a reported problem, find its root cause, and write a TDD fix plan to `specs/bugs/BUG-*.md`. This is a mostly hands-off workflow — minimize questions to the user.
12
+
13
+ ## Process
14
+
15
+ ### 0. Read previous bug history
16
+
17
+ Before starting diagnosis:
18
+
19
+ 1. Read `specs/bugs/registry.yaml` (if it exists) — check for prior bugs in the same `scope` or with similar symptoms.
20
+ 2. If a relevant prior bug is found, read the corresponding `specs/bugs/BUG-*.md` file to understand previous root cause analysis and fix approach.
21
+ 3. Note in your investigation whether this is a recurrence, a related issue, or novel.
22
+
23
+ ### 1. Capture the problem
24
+
25
+ Get a brief description of the issue from the user. If they haven't provided one, ask ONE question: "What's the problem you're seeing?"
26
+
27
+ Do NOT ask follow-up questions yet. Start investigating immediately.
28
+
29
+ ### 2. Explore and diagnose (4-phase RCA)
30
+
31
+ Run the 4-phase root-cause analysis via the `diagnose-root` skill (Reproduce → Isolate → Hypothesize → Verify). That skill is the canonical RCA engine — do not re-implement the phases here.
32
+
33
+ Also look at:
34
+ - Recent changes to affected files (`git log --oneline <file>`)
35
+ - Existing tests (what's tested, what's missing)
36
+ - Similar patterns elsewhere in the codebase that work correctly
37
+
38
+ > **HARD GATE** — Do NOT proceed to Step 3 (Fix Approach) until `diagnose-root` Phase 4 produces a verified root cause. "It probably is X" is not verified.
39
+
40
+ ### 3. Identify the fix approach
41
+
42
+ Based on your investigation, determine:
43
+
44
+ - The minimal change needed to fix the root cause
45
+ - Which modules/interfaces are affected
46
+ - What behaviors need to be verified via tests
47
+ - Whether this is a regression, missing feature, or design flaw
48
+ - Risk level: Low / Medium / High
49
+
50
+ ### 4. Design TDD fix plan
51
+
52
+ Create a concrete, ordered list of RED-GREEN cycles. Each cycle is one vertical slice:
53
+
54
+ - **RED**: Describe a specific test that captures the broken/missing behavior
55
+ - **GREEN**: Describe the minimal code change to make that test pass
56
+
57
+ Rules:
58
+ - Tests verify behavior through public interfaces, not implementation details
59
+ - One test at a time, vertical slices (NOT all tests first, then all code)
60
+ - Each test should survive internal refactors
61
+ - Include a final refactor step if needed
62
+ - **Durability**: Only suggest fixes that would survive radical codebase changes. Tests assert on observable outcomes (API responses, UI state, user-visible effects), not internal state.
63
+
64
+ ### 5. Write the bug file
65
+
66
+ Save the investigation and fix plan to `specs/bugs/BUG-NNN-slug.md`. Create the `specs/bugs/` directory if it doesn't exist.
67
+
68
+ After writing, append a row to `specs/bugs/registry.yaml` with: bug_id (same timestamp), date, severity, priority, scope, summary, and file path. Create `specs/bugs/registry.yaml` if it doesn't exist.
69
+
70
+ <diagnosis-template>
71
+
72
+ # BUG-YYYY-MM-DDTHHMMSS: [short title]
73
+
74
+ ## Problem
75
+
76
+ A clear description of the bug or issue, including:
77
+ - What happens (actual behavior)
78
+ - What should happen (expected behavior)
79
+ - How to reproduce (if applicable)
80
+
81
+ ## Root Cause Analysis
82
+
83
+ Describe what you found during investigation:
84
+ - The code path involved
85
+ - Why the current code fails
86
+ - Any contributing factors
87
+ - Risk level: Low / Medium / High
88
+
89
+ Do NOT include specific file paths, line numbers, or implementation details that couple to current code layout. Describe modules, behaviors, and contracts instead.
90
+
91
+ ## TDD Fix Plan
92
+
93
+ A numbered list of RED-GREEN cycles:
94
+
95
+ 1. **RED**: Write a test that [describes expected behavior]
96
+ **GREEN**: [Minimal change to make it pass]
97
+ **verify**: [runnable command]
98
+
99
+ 2. **RED**: Write a test that [describes next behavior]
100
+ **GREEN**: [Minimal change to make it pass]
101
+ **verify**: [runnable command]
102
+
103
+ **REFACTOR**: [Any cleanup needed after all tests pass]
104
+
105
+ ## Acceptance Criteria
106
+
107
+ - [ ] Criterion 1
108
+ - [ ] Criterion 2
109
+ - [ ] All new tests pass
110
+ - [ ] Existing tests still pass
111
+
112
+ ## Resolution
113
+
114
+ <!-- filled in by validate-fix -->
115
+
116
+ </diagnosis-template>
117
+
118
+ After writing the bug file, print a one-line summary of the root cause and suggest running `kickoff-branch` next to create a fix branch.
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: kickoff-branch
3
+ description: "Create a git worktree and feature branch, then verify a clean test baseline before any code is written. Use when starting a new feature or task, when user wants to work in isolation from main, or mentions "start a branch" or "new worktree"."
4
+ ---
5
+
6
+
7
+ # Kickoff Branch
8
+
9
+ > **HARD GATE** — Direct work on `main` or `master` is PROHIBITED. Every task MUST start with this skill to create a feature branch or worktree.
10
+ >
11
+ > **HARD GATE** — Do NOT proceed with development until a clean test baseline is verified. If the current base branch is failing tests, stop and fix the baseline before creating a new worktree.
12
+
13
+ Create an isolated working environment before touching any code. A clean baseline proves tests pass before you start — so any failure you see later was caused by your changes, not pre-existing issues.
14
+
15
+ ## Process
16
+
17
+ ### 1. Confirm task name
18
+
19
+ Ask if not already known: "What's the name of this feature or task?" Use it as the branch name slug (kebab-case, max 40 chars).
20
+
21
+ ### 2. Anchor on default branch (main or master)
22
+
23
+ > **HARD GATE** — Kickoff MUST start from an updated, clean default branch in the **primary** repository root (not a linked worktree).
24
+
25
+ ```bash
26
+ # Detect default branch
27
+ DEFAULT=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo main)
28
+
29
+ git checkout "$DEFAULT"
30
+ git pull --ff-only origin "$DEFAULT" # skip if no remote
31
+ git status # working tree MUST be clean
32
+ git log --oneline -5
33
+ ```
34
+
35
+ If working tree is dirty, ask the user to stash or commit first. If not on `$DEFAULT` after checkout, stop and fix before continuing.
36
+
37
+ ### 3. Pre-flight & Conflict Resolution
38
+
39
+ Before creating the worktree, verify the target environment is clean:
40
+
41
+ ```bash
42
+ # 1. Check for existing directory
43
+ ls -d ../<task-slug> 2>/dev/null
44
+
45
+ # 2. Check for existing branch
46
+ git branch --list <task-slug>
47
+
48
+ # 3. Check for "ghost" worktrees (metadata exists but directory is gone)
49
+ git worktree list | grep "<task-slug>"
50
+ ```
51
+
52
+ **Handling Conflicts:**
53
+ - **Directory exists:** If `../<task-slug>` already exists, ask the user if they want to use it or delete it.
54
+ - **Branch exists:** If the branch exists but no worktree is attached, ask to use the existing branch (`git worktree add ../<task-slug> <task-slug>`) or delete it.
55
+ - **Ghost worktree:** If `git worktree list` shows the path but the directory is missing, run `git worktree prune` to clear the stale metadata.
56
+
57
+ ### 4. Create worktree + branch
58
+
59
+ ```bash
60
+ # From the main repo root (not another worktree)
61
+ git worktree add ../<task-slug> -b <task-slug>
62
+ cd ../<task-slug>
63
+ ```
64
+
65
+ If the user prefers a branch without a worktree:
66
+ ```bash
67
+ git checkout -b <task-slug>
68
+ ```
69
+
70
+ ### 4. Verify clean baseline
71
+
72
+ Run the full test suite and confirm it passes before writing any code:
73
+
74
+ ```bash
75
+ # Use the project's test command from CLAUDE.md or package.json
76
+ npm test # or: pytest, go test ./..., cargo test, etc.
77
+ ```
78
+
79
+ - [ ] All tests pass
80
+ - [ ] No type errors (`npm run typecheck` or equivalent)
81
+ - [ ] No lint errors (`npm run lint` or equivalent)
82
+
83
+ If the baseline is broken, **stop and tell the user**. Do not proceed with development on a broken baseline.
84
+
85
+ ### 5. Confirm readiness
86
+
87
+ Report the baseline result:
88
+ ```
89
+ ✓ Baseline clean: 42 tests passed, 0 failed
90
+ Branch: <task-slug>
91
+ Worktree: ../<task-slug>
92
+ Ready to develop.
93
+ ```
94
+
95
+ Suggest next skill: `develop-tdd` to start the TDD loop, or `execute-plan` if `specs/release-plan.yaml + epic capsule directories` already exists.
96
+
97
+ ## Handoff
98
+
99
+ Gate: READY -> next: develop-tdd
100
+ Writes: state.yaml handoff.next_skill = develop-tdd