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,105 @@
1
+ ---
2
+ 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".
3
+ ---
4
+
5
+
6
+ # Inspect Quality
7
+ > **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.
8
+
9
+
10
+ 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.
11
+
12
+ ## For each issue the user raises
13
+
14
+ ### 1. Listen and lightly clarify
15
+
16
+ Let the user describe the problem in their own words. Ask **at most 2–3 short clarifying questions** focused on:
17
+
18
+ - What they expected vs what actually happened
19
+ - Steps to reproduce (if not obvious)
20
+ - Whether it's consistent or intermittent
21
+
22
+ Do NOT over-interview. If the description is clear enough to log, move on.
23
+
24
+ ### 2. Explore the codebase in the background
25
+
26
+ Kick off an Agent (subagent_type=Explore) to understand the relevant area. The goal is NOT to find a fix — it's to:
27
+
28
+ - Learn the domain language used in that area (check `specs/UBIQUITOUS_LANGUAGE.md` if present)
29
+ - Understand what the feature is supposed to do
30
+ - Identify the user-facing behavior boundary
31
+
32
+ ### 3. Assess scope: single issue or breakdown?
33
+
34
+ Break down when:
35
+
36
+ - The fix spans multiple independent areas
37
+ - There are clearly separable concerns that could be worked on in parallel
38
+ - The user describes something with multiple distinct failure modes
39
+
40
+ Keep as a single issue when:
41
+
42
+ - It's one behavior that's wrong in one place
43
+ - The symptoms are all caused by the same root behavior
44
+
45
+ ### 4. Log to specs/bugs/registry.yaml
46
+
47
+ Append the issue to `specs/bugs/registry.yaml`. Create the `specs/bugs/` directory if it doesn't exist.
48
+
49
+ #### registry.yaml format
50
+
51
+ The file maintains a Markdown table with the following columns (derived from structured audit practice):
52
+
53
+ | Field | Description |
54
+ |-------|-------------|
55
+ | `bug_id` | `BUG-YYYY-MM-DDTHHMMSS` |
56
+ | `date` | `YYYY-MM-DD` |
57
+ | `severity` | `critical` / `high` / `medium` / `low` |
58
+ | `priority` | `p0` / `p1` / `p2` / `p3` |
59
+ | `scope` | kebab-case area (e.g. `auth`, `checkout`) |
60
+ | `what_happened` | actual behavior (user-facing terms) |
61
+ | `what_expected` | expected behavior |
62
+ | `steps_to_reproduce` | numbered steps |
63
+ | `root_cause` | one-line hypothesis |
64
+ | `files_changed` | filled in after fix |
65
+ | `approach` | filled in after fix |
66
+ | `risk_level` | `low` / `medium` / `high` |
67
+ | `new_tests` | count (filled in after fix) |
68
+ | `type_check` | `pass` / `fail` (filled in after fix) |
69
+ | `lint` | `pass` / `fail` (filled in after fix) |
70
+ | `commit_type` | `fix` / `fix!` / `feat` (filled in after fix) |
71
+ | `release_type` | `patch` / `minor` / `major` (filled in after fix) |
72
+ | `commit_message` | Conventional Commits message (filled in after fix) |
73
+ | `follow_ups` | semicolon-separated follow-up items |
74
+ | `file` | path to detailed `specs/bugs/BUG-*.md` (filled in by investigate-bug) |
75
+ | `status` | `open` / `in-progress` / `fixed` / `wont-fix` |
76
+
77
+ When a bug is fixed (via `validate-fix`), update the relevant row with the resolution fields.
78
+
79
+ #### Issue body (for context below the table)
80
+
81
+ For each bug, also append a detail section:
82
+
83
+ ```markdown
84
+ ### BUG-YYYY-MM-DDTHHMMSS: [short title]
85
+
86
+ **What happened:** [actual behavior, plain language]
87
+ **What I expected:** [expected behavior]
88
+ **Steps to reproduce:**
89
+ 1. [Step 1]
90
+ 2. [Step 2]
91
+
92
+ **Additional context:** [domain-language observations, no file paths]
93
+ ```
94
+
95
+ #### Rules for all entries
96
+
97
+ - **bug_id** uses full timestamp: `BUG-YYYY-MM-DDTHHMMSS` — matches the individual bug file name in `specs/bugs/`
98
+ - **No file paths or line numbers** — these go stale
99
+ - **Use the project's domain language** (check `specs/UBIQUITOUS_LANGUAGE.md` if it exists)
100
+ - **Describe behaviors, not code** — "the sync service fails to apply the patch" not "applyPatch() throws"
101
+ - **Reproduction steps are mandatory** — if you can't determine them, ask the user
102
+
103
+ ### 5. Continue the session
104
+
105
+ 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,117 @@
1
+ ---
2
+ 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.
3
+ ---
4
+
5
+
6
+ # Investigate Bug
7
+
8
+ **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.
9
+
10
+ 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.
11
+
12
+ ## Process
13
+
14
+ ### 0. Read previous bug history
15
+
16
+ Before starting diagnosis:
17
+
18
+ 1. Read `specs/bugs/registry.yaml` (if it exists) — check for prior bugs in the same `scope` or with similar symptoms.
19
+ 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.
20
+ 3. Note in your investigation whether this is a recurrence, a related issue, or novel.
21
+
22
+ ### 1. Capture the problem
23
+
24
+ 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?"
25
+
26
+ Do NOT ask follow-up questions yet. Start investigating immediately.
27
+
28
+ ### 2. Explore and diagnose (4-phase RCA)
29
+
30
+ 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.
31
+
32
+ Also look at:
33
+ - Recent changes to affected files (`git log --oneline <file>`)
34
+ - Existing tests (what's tested, what's missing)
35
+ - Similar patterns elsewhere in the codebase that work correctly
36
+
37
+ > **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.
38
+
39
+ ### 3. Identify the fix approach
40
+
41
+ Based on your investigation, determine:
42
+
43
+ - The minimal change needed to fix the root cause
44
+ - Which modules/interfaces are affected
45
+ - What behaviors need to be verified via tests
46
+ - Whether this is a regression, missing feature, or design flaw
47
+ - Risk level: Low / Medium / High
48
+
49
+ ### 4. Design TDD fix plan
50
+
51
+ Create a concrete, ordered list of RED-GREEN cycles. Each cycle is one vertical slice:
52
+
53
+ - **RED**: Describe a specific test that captures the broken/missing behavior
54
+ - **GREEN**: Describe the minimal code change to make that test pass
55
+
56
+ Rules:
57
+ - Tests verify behavior through public interfaces, not implementation details
58
+ - One test at a time, vertical slices (NOT all tests first, then all code)
59
+ - Each test should survive internal refactors
60
+ - Include a final refactor step if needed
61
+ - **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.
62
+
63
+ ### 5. Write the bug file
64
+
65
+ Save the investigation and fix plan to `specs/bugs/BUG-NNN-slug.md`. Create the `specs/bugs/` directory if it doesn't exist.
66
+
67
+ 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.
68
+
69
+ <diagnosis-template>
70
+
71
+ # BUG-YYYY-MM-DDTHHMMSS: [short title]
72
+
73
+ ## Problem
74
+
75
+ A clear description of the bug or issue, including:
76
+ - What happens (actual behavior)
77
+ - What should happen (expected behavior)
78
+ - How to reproduce (if applicable)
79
+
80
+ ## Root Cause Analysis
81
+
82
+ Describe what you found during investigation:
83
+ - The code path involved
84
+ - Why the current code fails
85
+ - Any contributing factors
86
+ - Risk level: Low / Medium / High
87
+
88
+ Do NOT include specific file paths, line numbers, or implementation details that couple to current code layout. Describe modules, behaviors, and contracts instead.
89
+
90
+ ## TDD Fix Plan
91
+
92
+ A numbered list of RED-GREEN cycles:
93
+
94
+ 1. **RED**: Write a test that [describes expected behavior]
95
+ **GREEN**: [Minimal change to make it pass]
96
+ **verify**: [runnable command]
97
+
98
+ 2. **RED**: Write a test that [describes next behavior]
99
+ **GREEN**: [Minimal change to make it pass]
100
+ **verify**: [runnable command]
101
+
102
+ **REFACTOR**: [Any cleanup needed after all tests pass]
103
+
104
+ ## Acceptance Criteria
105
+
106
+ - [ ] Criterion 1
107
+ - [ ] Criterion 2
108
+ - [ ] All new tests pass
109
+ - [ ] Existing tests still pass
110
+
111
+ ## Resolution
112
+
113
+ <!-- filled in by validate-fix -->
114
+
115
+ </diagnosis-template>
116
+
117
+ 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,99 @@
1
+ ---
2
+ 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".
3
+ ---
4
+
5
+
6
+ # Kickoff Branch
7
+
8
+ > **HARD GATE** — Direct work on `main` or `master` is PROHIBITED. Every task MUST start with this skill to create a feature branch or worktree.
9
+ >
10
+ > **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.
11
+
12
+ 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.
13
+
14
+ ## Process
15
+
16
+ ### 1. Confirm task name
17
+
18
+ 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).
19
+
20
+ ### 2. Anchor on default branch (main or master)
21
+
22
+ > **HARD GATE** — Kickoff MUST start from an updated, clean default branch in the **primary** repository root (not a linked worktree).
23
+
24
+ ```bash
25
+ # Detect default branch
26
+ DEFAULT=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo main)
27
+
28
+ git checkout "$DEFAULT"
29
+ git pull --ff-only origin "$DEFAULT" # skip if no remote
30
+ git status # working tree MUST be clean
31
+ git log --oneline -5
32
+ ```
33
+
34
+ If working tree is dirty, ask the user to stash or commit first. If not on `$DEFAULT` after checkout, stop and fix before continuing.
35
+
36
+ ### 3. Pre-flight & Conflict Resolution
37
+
38
+ Before creating the worktree, verify the target environment is clean:
39
+
40
+ ```bash
41
+ # 1. Check for existing directory
42
+ ls -d ../<task-slug> 2>/dev/null
43
+
44
+ # 2. Check for existing branch
45
+ git branch --list <task-slug>
46
+
47
+ # 3. Check for "ghost" worktrees (metadata exists but directory is gone)
48
+ git worktree list | grep "<task-slug>"
49
+ ```
50
+
51
+ **Handling Conflicts:**
52
+ - **Directory exists:** If `../<task-slug>` already exists, ask the user if they want to use it or delete it.
53
+ - **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.
54
+ - **Ghost worktree:** If `git worktree list` shows the path but the directory is missing, run `git worktree prune` to clear the stale metadata.
55
+
56
+ ### 4. Create worktree + branch
57
+
58
+ ```bash
59
+ # From the main repo root (not another worktree)
60
+ git worktree add ../<task-slug> -b <task-slug>
61
+ cd ../<task-slug>
62
+ ```
63
+
64
+ If the user prefers a branch without a worktree:
65
+ ```bash
66
+ git checkout -b <task-slug>
67
+ ```
68
+
69
+ ### 4. Verify clean baseline
70
+
71
+ Run the full test suite and confirm it passes before writing any code:
72
+
73
+ ```bash
74
+ # Use the project's test command from CLAUDE.md or package.json
75
+ npm test # or: pytest, go test ./..., cargo test, etc.
76
+ ```
77
+
78
+ - [ ] All tests pass
79
+ - [ ] No type errors (`npm run typecheck` or equivalent)
80
+ - [ ] No lint errors (`npm run lint` or equivalent)
81
+
82
+ If the baseline is broken, **stop and tell the user**. Do not proceed with development on a broken baseline.
83
+
84
+ ### 5. Confirm readiness
85
+
86
+ Report the baseline result:
87
+ ```
88
+ ✓ Baseline clean: 42 tests passed, 0 failed
89
+ Branch: <task-slug>
90
+ Worktree: ../<task-slug>
91
+ Ready to develop.
92
+ ```
93
+
94
+ Suggest next skill: `develop-tdd` to start the TDD loop, or `execute-plan` if `specs/release-plan.yaml + epic capsule directories` already exists.
95
+
96
+ ## Handoff
97
+
98
+ Gate: READY -> next: develop-tdd
99
+ Writes: state.yaml handoff.next_skill = develop-tdd
@@ -0,0 +1,70 @@
1
+ ---
2
+ description: "Derives the tech-stack doc from scratch by scanning the codebase — analyzes stack, architecture, and gray areas (error handling, API shapes) and persists findings into specs/tech-architecture/tech-stack.md. Run when the tech doc doesn't exist yet; use survey-context to consume it once it does."
3
+ ---
4
+
5
+
6
+ # Map Codebase
7
+
8
+ Perform a deep architectural and structural analysis of the codebase. Unlike `survey-context` which identifies "where we are", `map-codebase` identifies "what we are dealing with" and "how things are done".
9
+
10
+ > **Use this vs survey-context:** `map-codebase` BUILDS the tech-stack doc by scanning the codebase from scratch. `survey-context` READS existing specs/tech-architecture docs without re-deriving them. Run `map-codebase` when `specs/tech-architecture/tech-stack.md` doesn't exist yet; run `survey-context` when it does.
11
+
12
+ > **HARD GATE** — Cold analysis only. Do NOT assume architectural patterns without reading the code. If the codebase structure surprises you, call out the delta.
13
+
14
+ ## Process
15
+
16
+ ### 1. Identify Core Stack & Dependencies
17
+ - Scan `package.json`, `Cargo.toml`, `requirements.txt`, etc.
18
+ - Identify primary framework, runtime, and critical libraries (ORM, Auth, State, UI).
19
+ - Note version constraints and any deprecated or unusual dependencies.
20
+
21
+ ### 2. Map High-Level Architecture
22
+ - Identify the entry points (CLI, Web, API).
23
+ - Map the primary data flow (e.g., Controller → Service → Repository).
24
+ - Identify where business logic lives vs. where I/O lives.
25
+ - Look for established patterns (e.g., hexagonal, layered, feature-folders).
26
+
27
+ ### 3. Analyze "Gray Areas" (The "How")
28
+ Search for patterns and anti-patterns in these categories:
29
+ - **Error Handling:** Are exceptions caught early or bubbled? Is there a global error handler? Are error messages structured?
30
+ - **API Shapes:** Is it REST, GraphQL, or RPC? What is the casing (camelCase, snake_case)? How are responses structured?
31
+ - **Type Safety:** Is it strictly typed? Are there many `any` or `unsafe` blocks? Are interfaces used for DIP?
32
+ - **Observability:** Is there structured logging? Are there health checks? Where do logs go?
33
+ - **Testing:** What is the test coverage strategy? Are mocks used? Where do tests live?
34
+
35
+ ### 4. Identify Planning "Signals"
36
+ Look for signals that will influence upcoming plans:
37
+ - **Consistency Gaps:** "Half the project uses async/await, the other half uses Promises."
38
+ - **Debt Hotspots:** "The `AuthManager` is 1500 lines and handles both JWT and session logic."
39
+ - **Integration Points:** "We need to talk to the Stripe API, but there's no wrapper yet."
40
+ - **Conventions:** "The team always uses functional components over classes."
41
+
42
+ ### 5. Persist to specs/tech-architecture/tech-stack.md
43
+ Compile all findings into `specs/tech-architecture/tech-stack.md`. This file serves as the project's "Long-Term Memory".
44
+
45
+ ```markdown
46
+ # Project Context
47
+
48
+ ## Stack
49
+ - [Framework/Language]
50
+ - [Key Libraries]
51
+
52
+ ## Architecture
53
+ - [Pattern Description]
54
+ - [Data Flow]
55
+
56
+ ## Conventions (Observed)
57
+ - [Error Handling Pattern]
58
+ - [API Design]
59
+ - [Type System]
60
+
61
+ ## Signals / Active Considerations
62
+ - [Gap 1]
63
+ - [Hotspot 2]
64
+ ```
65
+
66
+ ## When to Use
67
+ - When first joining a project.
68
+ - Before a major refactor or architectural change.
69
+ - When `survey-context` reveals a lack of domain knowledge.
70
+ - To refresh `specs/tech-architecture/tech-stack.md` after significant changes.