bigpowers 1.0.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 (96) hide show
  1. package/.gitmessage +5 -0
  2. package/.releaserc.json +17 -0
  3. package/CHANGELOG.md +61 -0
  4. package/CLAUDE.md +61 -0
  5. package/CONVENTIONS.md +140 -0
  6. package/GEMINI.md +53 -0
  7. package/LICENSE +21 -0
  8. package/README.md +116 -0
  9. package/RELEASE.md +108 -0
  10. package/SKILL-INDEX.md +146 -0
  11. package/assess-impact/SKILL.md +76 -0
  12. package/audit-code/HEURISTICS.md +43 -0
  13. package/audit-code/SKILL.md +81 -0
  14. package/bin/bigpowers.js +27 -0
  15. package/change-request/REFERENCE.md +60 -0
  16. package/change-request/SKILL.md +42 -0
  17. package/commit-message/REFERENCE.md +81 -0
  18. package/commit-message/SKILL.md +39 -0
  19. package/countable-story-format.md +293 -0
  20. package/craft-skill/REFERENCE.md +88 -0
  21. package/craft-skill/SKILL.md +55 -0
  22. package/deepen-architecture/DEEPENING.md +37 -0
  23. package/deepen-architecture/INTERFACE-DESIGN.md +44 -0
  24. package/deepen-architecture/LANGUAGE.md +53 -0
  25. package/deepen-architecture/SKILL.md +76 -0
  26. package/define-language/SKILL.md +75 -0
  27. package/define-success/SKILL.md +60 -0
  28. package/delegate-task/SKILL.md +70 -0
  29. package/design-interface/SKILL.md +94 -0
  30. package/develop-tdd/SKILL.md +160 -0
  31. package/develop-tdd/deep-modules.md +33 -0
  32. package/develop-tdd/interface-design.md +31 -0
  33. package/develop-tdd/mocking.md +59 -0
  34. package/develop-tdd/refactoring.md +10 -0
  35. package/develop-tdd/tests.md +71 -0
  36. package/dispatch-agents/SKILL.md +72 -0
  37. package/edit-document/SKILL.md +14 -0
  38. package/elaborate-spec/SKILL.md +79 -0
  39. package/enforce-first/SKILL.md +75 -0
  40. package/execute-plan/SKILL.md +84 -0
  41. package/grill-me/REFERENCE.md +63 -0
  42. package/grill-me/SKILL.md +25 -0
  43. package/guard-git/REFERENCE.md +136 -0
  44. package/guard-git/SKILL.md +39 -0
  45. package/guard-git/scripts/block-dangerous-git.sh +41 -0
  46. package/guard-git/scripts/lib/git-guardrails-core.sh +29 -0
  47. package/hook-commits/SKILL.md +91 -0
  48. package/hooks/pre-tool-use.sh +130 -0
  49. package/index.js +6 -0
  50. package/inspect-quality/SKILL.md +101 -0
  51. package/investigate-bug/SKILL.md +111 -0
  52. package/kickoff-branch/SKILL.md +87 -0
  53. package/map-codebase/SKILL.md +66 -0
  54. package/migrate-spec/REFERENCE-GSD.md +137 -0
  55. package/migrate-spec/REFERENCE.md +186 -0
  56. package/migrate-spec/SKILL.md +150 -0
  57. package/model-domain/ADR-FORMAT.md +47 -0
  58. package/model-domain/CONTEXT-FORMAT.md +77 -0
  59. package/model-domain/SKILL.md +82 -0
  60. package/opencode.json +4 -0
  61. package/orchestrate-project/REFERENCE.md +89 -0
  62. package/orchestrate-project/SKILL.md +59 -0
  63. package/organize-workspace/REFERENCE.md +80 -0
  64. package/organize-workspace/SKILL.md +74 -0
  65. package/package.json +45 -0
  66. package/plan-refactor/SKILL.md +75 -0
  67. package/plan-release/SKILL.md +75 -0
  68. package/plan-work/SKILL.md +124 -0
  69. package/playwright.config.ts +56 -0
  70. package/release-branch/SKILL.md +116 -0
  71. package/request-review/SKILL.md +70 -0
  72. package/respond-review/SKILL.md +68 -0
  73. package/scripts/audit-compliance.sh +256 -0
  74. package/scripts/cleanup-worktrees.sh +44 -0
  75. package/scripts/install-cursor-skills-local.sh +13 -0
  76. package/scripts/install-cursor-skills.sh +34 -0
  77. package/scripts/install.sh +240 -0
  78. package/scripts/project-survey.sh +54 -0
  79. package/scripts/sync-skills.sh +110 -0
  80. package/seed-conventions/SKILL.md +185 -0
  81. package/session-state/SKILL.md +69 -0
  82. package/skills-lock.json +157 -0
  83. package/spike-prototype/SKILL.md +92 -0
  84. package/survey-context/SKILL.md +93 -0
  85. package/terse-mode/SKILL.md +35 -0
  86. package/trace-requirement/SKILL.md +68 -0
  87. package/using-bigpowers/SKILL.md +65 -0
  88. package/validate-fix/SKILL.md +93 -0
  89. package/visual-dashboard/SKILL.md +49 -0
  90. package/visual-dashboard/scripts/frame-template.html +189 -0
  91. package/visual-dashboard/scripts/helper.js +83 -0
  92. package/visual-dashboard/scripts/server.cjs +345 -0
  93. package/visual-dashboard/scripts/start-server.sh +121 -0
  94. package/visual-dashboard/scripts/stop-server.sh +46 -0
  95. package/wire-observability/SKILL.md +90 -0
  96. package/write-document/SKILL.md +63 -0
@@ -0,0 +1,91 @@
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
+ # Hook Commits
7
+
8
+ ## What This Sets Up
9
+
10
+ - **Husky** pre-commit hook
11
+ - **lint-staged** running Prettier on all staged files
12
+ - **Prettier** config (if missing)
13
+ - **typecheck** and **test** scripts in the pre-commit hook
14
+
15
+ ## Steps
16
+
17
+ ### 1. Detect package manager
18
+
19
+ 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.
20
+
21
+ ### 2. Install dependencies
22
+
23
+ Install as devDependencies:
24
+
25
+ ```
26
+ husky lint-staged prettier
27
+ ```
28
+
29
+ ### 3. Initialize Husky
30
+
31
+ ```bash
32
+ npx husky init
33
+ ```
34
+
35
+ This creates `.husky/` dir and adds `prepare: "husky"` to package.json.
36
+
37
+ ### 4. Create `.husky/pre-commit`
38
+
39
+ Write this file (no shebang needed for Husky v9+):
40
+
41
+ ```
42
+ npx lint-staged
43
+ npm run typecheck
44
+ npm run test
45
+ ```
46
+
47
+ **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.
48
+
49
+ ### 5. Create `.lintstagedrc`
50
+
51
+ ```json
52
+ {
53
+ "*": "prettier --ignore-unknown --write"
54
+ }
55
+ ```
56
+
57
+ ### 6. Create `.prettierrc` (if missing)
58
+
59
+ Only create if no Prettier config exists. Use these defaults:
60
+
61
+ ```json
62
+ {
63
+ "useTabs": false,
64
+ "tabWidth": 2,
65
+ "printWidth": 80,
66
+ "singleQuote": false,
67
+ "trailingComma": "es5",
68
+ "semi": true,
69
+ "arrowParens": "always"
70
+ }
71
+ ```
72
+
73
+ ### 7. Verify
74
+
75
+ - [ ] `.husky/pre-commit` exists and is executable
76
+ - [ ] `.lintstagedrc` exists
77
+ - [ ] `prepare` script in package.json is `"husky"`
78
+ - [ ] `prettier` config exists
79
+ - [ ] Run `npx lint-staged` to verify it works
80
+
81
+ ### 8. Commit
82
+
83
+ Stage all changed/created files and commit with message: `chore: add pre-commit hooks (husky + lint-staged + prettier)`
84
+
85
+ This will run through the new pre-commit hooks — a good smoke test that everything works.
86
+
87
+ ## Notes
88
+
89
+ - Husky v9+ doesn't need shebangs in hook files
90
+ - `prettier --ignore-unknown` skips files Prettier can't parse (images, etc.)
91
+ - The pre-commit runs lint-staged first (fast, staged-only), then full typecheck and tests
@@ -0,0 +1,130 @@
1
+ #!/usr/bin/env bash
2
+ # bigpowers — pre-tool-use.sh
3
+ # Harness-agnostic Git Safety Hook for Claude Code, Cursor, and Gemini CLI.
4
+ # Enforces:
5
+ # 1. Block dangerous commands (push, reset --hard, etc.)
6
+ # 2. Enforce Conventional Commits for 'git commit'
7
+ # 3. Block direct commits/pushes to protected branches (main, master)
8
+
9
+ set -euo pipefail
10
+
11
+ # Configuration
12
+ PROTECTED_BRANCHES=("main" "master")
13
+ DANGEROUS_PATTERNS=(
14
+ "git push"
15
+ "git reset --hard"
16
+ "git clean -fd"
17
+ "git clean -f"
18
+ "git branch -D"
19
+ "git checkout \\."
20
+ "git restore \\."
21
+ "push --force"
22
+ "reset --hard"
23
+ )
24
+ CONVENTIONAL_COMMITS_REGEX='^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?!?:[[:space:]].+'
25
+
26
+ # Detect mode from environment (for Gemini/Claude/Cursor parity)
27
+ # GIT_GUARDRAILS_MODE: claude (default) | cursor | gemini
28
+ MODE="${GIT_GUARDRAILS_MODE:-claude}"
29
+
30
+ # Read input from stdin
31
+ INPUT=$(cat)
32
+
33
+ # Extract command using jq (standard in bigpowers)
34
+ COMMAND=$(echo "$INPUT" | jq -r '.command // .tool_input.command // empty')
35
+
36
+ if [ -z "$COMMAND" ]; then
37
+ [ "$MODE" = "gemini" ] && echo '{"decision":"allow"}'
38
+ exit 0
39
+ fi
40
+
41
+ # 1. Check for dangerous patterns
42
+ for p in "${DANGEROUS_PATTERNS[@]}"; do
43
+ if echo "$COMMAND" | grep -qE "$p"; then
44
+ REASON="BLOCKED: '$COMMAND' matches dangerous pattern '$p'. Use a safer approach or ask the user."
45
+ if [ "$MODE" = "gemini" ]; then
46
+ jq -nc --arg reason "$REASON" '{decision: "deny", reason: $reason}'
47
+ else
48
+ echo "$REASON" >&2
49
+ exit 2
50
+ fi
51
+ exit 0
52
+ fi
53
+ done
54
+
55
+ # 2. Check for git commit / git push
56
+ if [[ "$COMMAND" =~ git[[:space:]]+commit ]] || [[ "$COMMAND" =~ git[[:space:]]+push ]]; then
57
+ CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown")
58
+
59
+ # Branch protection
60
+ if [[ "$COMMAND" =~ git[[:space:]]+push ]]; then
61
+ for b in "${PROTECTED_BRANCHES[@]}"; do
62
+ if [[ "$COMMAND" =~ [[:space:]]+$b ]] || [[ "$CURRENT_BRANCH" == "$b" ]]; then
63
+ REASON="BLOCKED: Direct push to protected branch '$b' is forbidden. Use a feature branch and PR."
64
+ if [ "$MODE" = "gemini" ]; then
65
+ jq -nc --arg reason "$REASON" '{decision: "deny", reason: $reason}'
66
+ else
67
+ echo "$REASON" >&2
68
+ exit 2
69
+ fi
70
+ exit 0
71
+ fi
72
+ done
73
+ fi
74
+
75
+ # Conventional Commits for 'git commit'
76
+ if [[ "$COMMAND" =~ git[[:space:]]+commit ]]; then
77
+ # Extract message from -m flag
78
+ MSG=""
79
+ if [[ "$COMMAND" =~ -m[[:space:]]+\"([^\"]+)\" ]]; then
80
+ MSG="${BASH_REMATCH[1]}"
81
+ elif [[ "$COMMAND" =~ -m[[:space:]]+\'([^\']+)\' ]]; then
82
+ MSG="${BASH_REMATCH[1]}"
83
+ fi
84
+
85
+ if [ -n "$MSG" ]; then
86
+ SUBJECT=$(echo "$MSG" | head -n 1)
87
+ if [[ ! "$SUBJECT" =~ $CONVENTIONAL_COMMITS_REGEX ]]; then
88
+ REASON="BLOCKED: Commit message must follow Conventional Commits: <type>(<scope>): <subject>. Valid types: feat, fix, docs, style, refactor, perf, test, build, ci, chore."
89
+ if [ "$MODE" = "gemini" ]; then
90
+ jq -nc --arg reason "$REASON" '{decision: "deny", reason: $reason}'
91
+ else
92
+ echo "$REASON" >&2
93
+ exit 2
94
+ fi
95
+ exit 0
96
+ fi
97
+
98
+ if [ ${#SUBJECT} -gt 72 ]; then
99
+ REASON="BLOCKED: Commit subject line must be 72 characters or less."
100
+ if [ "$MODE" = "gemini" ]; then
101
+ jq -nc --arg reason "$REASON" '{decision: "deny", reason: $reason}'
102
+ else
103
+ echo "$REASON" >&2
104
+ exit 2
105
+ fi
106
+ exit 0
107
+ fi
108
+ fi
109
+
110
+ # Block direct commits to main
111
+ for b in "${PROTECTED_BRANCHES[@]}"; do
112
+ if [[ "$CURRENT_BRANCH" == "$b" ]]; then
113
+ REASON="BLOCKED: Direct commits to protected branch '$b' are forbidden. Use kickoff-branch to start a feature branch."
114
+ if [ "$MODE" = "gemini" ]; then
115
+ jq -nc --arg reason "$REASON" '{decision: "deny", reason: $reason}'
116
+ else
117
+ echo "$REASON" >&2
118
+ exit 2
119
+ fi
120
+ exit 0
121
+ fi
122
+ done
123
+ fi
124
+ fi
125
+
126
+ # Allow everything else
127
+ if [ "$MODE" = "gemini" ]; then
128
+ echo '{"decision":"allow"}'
129
+ fi
130
+ exit 0
package/index.js ADDED
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ name: 'bigpowers',
5
+ version: require('./package.json').version,
6
+ };
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: inspect-quality
3
+ description: Interactive QA session where user reports bugs or issues conversationally, and the agent logs them to specs/BUG-LOG.md 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
+ # Inspect Quality
7
+
8
+ 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/BUG-LOG.md` with a structured, durable format.
9
+
10
+ ## For each issue the user raises
11
+
12
+ ### 1. Listen and lightly clarify
13
+
14
+ Let the user describe the problem in their own words. Ask **at most 2–3 short clarifying questions** focused on:
15
+
16
+ - What they expected vs what actually happened
17
+ - Steps to reproduce (if not obvious)
18
+ - Whether it's consistent or intermittent
19
+
20
+ Do NOT over-interview. If the description is clear enough to log, move on.
21
+
22
+ ### 2. Explore the codebase in the background
23
+
24
+ Kick off an Agent (subagent_type=Explore) to understand the relevant area. The goal is NOT to find a fix — it's to:
25
+
26
+ - Learn the domain language used in that area (check `specs/UBIQUITOUS_LANGUAGE.md` if present)
27
+ - Understand what the feature is supposed to do
28
+ - Identify the user-facing behavior boundary
29
+
30
+ ### 3. Assess scope: single issue or breakdown?
31
+
32
+ Break down when:
33
+
34
+ - The fix spans multiple independent areas
35
+ - There are clearly separable concerns that could be worked on in parallel
36
+ - The user describes something with multiple distinct failure modes
37
+
38
+ Keep as a single issue when:
39
+
40
+ - It's one behavior that's wrong in one place
41
+ - The symptoms are all caused by the same root behavior
42
+
43
+ ### 4. Log to specs/BUG-LOG.md
44
+
45
+ Append the issue to `specs/BUG-LOG.md`. Create the file and `specs/` directory if they don't exist.
46
+
47
+ #### BUG-LOG.md format
48
+
49
+ The file maintains a Markdown table with the following columns (derived from structured audit practice):
50
+
51
+ | Field | Description |
52
+ |-------|-------------|
53
+ | `bug_id` | `BUG-YYYY-MM-DD-NNN` |
54
+ | `date` | `YYYY-MM-DD` |
55
+ | `severity` | `critical` / `high` / `medium` / `low` |
56
+ | `priority` | `p0` / `p1` / `p2` / `p3` |
57
+ | `scope` | kebab-case area (e.g. `auth`, `checkout`) |
58
+ | `what_happened` | actual behavior (user-facing terms) |
59
+ | `what_expected` | expected behavior |
60
+ | `steps_to_reproduce` | numbered steps |
61
+ | `root_cause` | one-line hypothesis |
62
+ | `files_changed` | filled in after fix |
63
+ | `approach` | filled in after fix |
64
+ | `risk_level` | `low` / `medium` / `high` |
65
+ | `new_tests` | count (filled in after fix) |
66
+ | `type_check` | `pass` / `fail` (filled in after fix) |
67
+ | `lint` | `pass` / `fail` (filled in after fix) |
68
+ | `commit_type` | `fix` / `fix!` / `feat` (filled in after fix) |
69
+ | `release_type` | `patch` / `minor` / `major` (filled in after fix) |
70
+ | `commit_message` | Conventional Commits message (filled in after fix) |
71
+ | `follow_ups` | semicolon-separated follow-up items |
72
+ | `status` | `open` / `in-progress` / `fixed` / `wont-fix` |
73
+
74
+ When a bug is fixed (via `validate-fix`), update the relevant row with the resolution fields.
75
+
76
+ #### Issue body (for context below the table)
77
+
78
+ For each bug, also append a detail section:
79
+
80
+ ```markdown
81
+ ### BUG-YYYY-MM-DD-NNN: [short title]
82
+
83
+ **What happened:** [actual behavior, plain language]
84
+ **What I expected:** [expected behavior]
85
+ **Steps to reproduce:**
86
+ 1. [Step 1]
87
+ 2. [Step 2]
88
+
89
+ **Additional context:** [domain-language observations, no file paths]
90
+ ```
91
+
92
+ #### Rules for all entries
93
+
94
+ - **No file paths or line numbers** — these go stale
95
+ - **Use the project's domain language** (check `specs/UBIQUITOUS_LANGUAGE.md` if it exists)
96
+ - **Describe behaviors, not code** — "the sync service fails to apply the patch" not "applyPatch() throws"
97
+ - **Reproduction steps are mandatory** — if you can't determine them, ask the user
98
+
99
+ ### 5. Continue the session
100
+
101
+ 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,111 @@
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/DIAGNOSIS.md. Use when user reports a bug, wants to investigate a problem, mentions "triage", or wants to plan a fix.
4
+ ---
5
+
6
+ # Investigate Bug
7
+
8
+ Investigate a reported problem, find its root cause, and write a TDD fix plan to `specs/DIAGNOSIS.md`. This is a mostly hands-off workflow — minimize questions to the user.
9
+
10
+ ## Process
11
+
12
+ ### 1. Capture the problem
13
+
14
+ 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?"
15
+
16
+ Do NOT ask follow-up questions yet. Start investigating immediately.
17
+
18
+ ### 2. Explore and diagnose (4-phase RCA)
19
+
20
+ Use the Agent tool with subagent_type=Explore to investigate the codebase. Run these phases in order:
21
+
22
+ **Phase 1 — Reproduce**: Confirm the failure is consistent. Document exact inputs, environment, and observed vs. expected output. Do not proceed until you can reproduce reliably.
23
+
24
+ **Phase 2 — Isolate**: Trace the code path from entry point to failure. Binary-search the call stack to find which layer first produces wrong output. Target: a single function or module where the wrong behavior first appears.
25
+
26
+ **Phase 3 — Hypothesize**: Write a falsifiable hypothesis: "The bug occurs because [condition] causes [behavior] instead of [expected]." Generate at least 2 alternatives. Rank by probability.
27
+
28
+ **Phase 4 — Verify**: Add a targeted assertion or log that fires if your top hypothesis is correct. Run the reproduction case. If confirmed, document the root cause. If not, return to Phase 3 with new evidence.
29
+
30
+ > **HARD GATE** — Do NOT proceed to Step 3 (Fix Approach) until Phase 4 produces a verified root cause. "It probably is X" is not verified.
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
+ ### 3. Identify the fix approach
38
+
39
+ Based on your investigation, determine:
40
+
41
+ - The minimal change needed to fix the root cause
42
+ - Which modules/interfaces are affected
43
+ - What behaviors need to be verified via tests
44
+ - Whether this is a regression, missing feature, or design flaw
45
+ - Risk level: Low / Medium / High
46
+
47
+ ### 4. Design TDD fix plan
48
+
49
+ Create a concrete, ordered list of RED-GREEN cycles. Each cycle is one vertical slice:
50
+
51
+ - **RED**: Describe a specific test that captures the broken/missing behavior
52
+ - **GREEN**: Describe the minimal code change to make that test pass
53
+
54
+ Rules:
55
+ - Tests verify behavior through public interfaces, not implementation details
56
+ - One test at a time, vertical slices (NOT all tests first, then all code)
57
+ - Each test should survive internal refactors
58
+ - Include a final refactor step if needed
59
+ - **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.
60
+
61
+ ### 5. Write specs/DIAGNOSIS.md
62
+
63
+ Save the investigation and fix plan to `specs/DIAGNOSIS.md`. Create the `specs/` directory if it doesn't exist.
64
+
65
+ <diagnosis-template>
66
+
67
+ ## Problem
68
+
69
+ A clear description of the bug or issue, including:
70
+ - What happens (actual behavior)
71
+ - What should happen (expected behavior)
72
+ - How to reproduce (if applicable)
73
+
74
+ ## Root Cause Analysis
75
+
76
+ Describe what you found during investigation:
77
+ - The code path involved
78
+ - Why the current code fails
79
+ - Any contributing factors
80
+ - Risk level: Low / Medium / High
81
+
82
+ Do NOT include specific file paths, line numbers, or implementation details that couple to current code layout. Describe modules, behaviors, and contracts instead.
83
+
84
+ ## TDD Fix Plan
85
+
86
+ A numbered list of RED-GREEN cycles:
87
+
88
+ 1. **RED**: Write a test that [describes expected behavior]
89
+ **GREEN**: [Minimal change to make it pass]
90
+ **verify**: [runnable command]
91
+
92
+ 2. **RED**: Write a test that [describes next behavior]
93
+ **GREEN**: [Minimal change to make it pass]
94
+ **verify**: [runnable command]
95
+
96
+ **REFACTOR**: [Any cleanup needed after all tests pass]
97
+
98
+ ## Acceptance Criteria
99
+
100
+ - [ ] Criterion 1
101
+ - [ ] Criterion 2
102
+ - [ ] All new tests pass
103
+ - [ ] Existing tests still pass
104
+
105
+ ## Resolution
106
+
107
+ <!-- filled in by validate-fix -->
108
+
109
+ </diagnosis-template>
110
+
111
+ After writing `specs/DIAGNOSIS.md`, print a one-line summary of the root cause and suggest running `kickoff-branch` next to create a fix branch.
@@ -0,0 +1,87 @@
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
+ # 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. Check current state
21
+
22
+ ```bash
23
+ git status # ensure working tree is clean
24
+ git log --oneline -5 # confirm you're on the right base branch
25
+ ```
26
+
27
+ If working tree is dirty, ask the user to stash or commit first.
28
+
29
+ ### 3. Pre-flight & Conflict Resolution
30
+
31
+ Before creating the worktree, verify the target environment is clean:
32
+
33
+ ```bash
34
+ # 1. Check for existing directory
35
+ ls -d ../<task-slug> 2>/dev/null
36
+
37
+ # 2. Check for existing branch
38
+ git branch --list <task-slug>
39
+
40
+ # 3. Check for "ghost" worktrees (metadata exists but directory is gone)
41
+ git worktree list | grep "<task-slug>"
42
+ ```
43
+
44
+ **Handling Conflicts:**
45
+ - **Directory exists:** If `../<task-slug>` already exists, ask the user if they want to use it or delete it.
46
+ - **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.
47
+ - **Ghost worktree:** If `git worktree list` shows the path but the directory is missing, run `git worktree prune` to clear the stale metadata.
48
+
49
+ ### 4. Create worktree + branch
50
+
51
+ ```bash
52
+ # From the main repo root (not another worktree)
53
+ git worktree add ../<task-slug> -b <task-slug>
54
+ cd ../<task-slug>
55
+ ```
56
+
57
+ If the user prefers a branch without a worktree:
58
+ ```bash
59
+ git checkout -b <task-slug>
60
+ ```
61
+
62
+ ### 4. Verify clean baseline
63
+
64
+ Run the full test suite and confirm it passes before writing any code:
65
+
66
+ ```bash
67
+ # Use the project's test command from CLAUDE.md or package.json
68
+ npm test # or: pytest, go test ./..., cargo test, etc.
69
+ ```
70
+
71
+ - [ ] All tests pass
72
+ - [ ] No type errors (`npm run typecheck` or equivalent)
73
+ - [ ] No lint errors (`npm run lint` or equivalent)
74
+
75
+ If the baseline is broken, **stop and tell the user**. Do not proceed with development on a broken baseline.
76
+
77
+ ### 5. Confirm readiness
78
+
79
+ Report the baseline result:
80
+ ```
81
+ ✓ Baseline clean: 42 tests passed, 0 failed
82
+ Branch: <task-slug>
83
+ Worktree: ../<task-slug>
84
+ Ready to develop.
85
+ ```
86
+
87
+ Suggest next skill: `develop-tdd` to start the TDD loop, or `execute-plan` if a specs/PLAN.md already exists.
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: map-codebase
3
+ description: "High-fidelity codebase surveying — analyzes stack, architecture, and gray areas (error handling, API shapes) and persists them into specs/CONTEXT.md. Goes beyond survey-context by identifying 'signals' for planning."
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
+ ## Process
11
+
12
+ ### 1. Identify Core Stack & Dependencies
13
+ - Scan `package.json`, `Cargo.toml`, `requirements.txt`, etc.
14
+ - Identify primary framework, runtime, and critical libraries (ORM, Auth, State, UI).
15
+ - Note version constraints and any deprecated or unusual dependencies.
16
+
17
+ ### 2. Map High-Level Architecture
18
+ - Identify the entry points (CLI, Web, API).
19
+ - Map the primary data flow (e.g., Controller → Service → Repository).
20
+ - Identify where business logic lives vs. where I/O lives.
21
+ - Look for established patterns (e.g., hexagonal, layered, feature-folders).
22
+
23
+ ### 3. Analyze "Gray Areas" (The "How")
24
+ Search for patterns and anti-patterns in these categories:
25
+ - **Error Handling:** Are exceptions caught early or bubbled? Is there a global error handler? Are error messages structured?
26
+ - **API Shapes:** Is it REST, GraphQL, or RPC? What is the casing (camelCase, snake_case)? How are responses structured?
27
+ - **Type Safety:** Is it strictly typed? Are there many `any` or `unsafe` blocks? Are interfaces used for DIP?
28
+ - **Observability:** Is there structured logging? Are there health checks? Where do logs go?
29
+ - **Testing:** What is the test coverage strategy? Are mocks used? Where do tests live?
30
+
31
+ ### 4. Identify Planning "Signals"
32
+ Look for signals that will influence upcoming plans:
33
+ - **Consistency Gaps:** "Half the project uses async/await, the other half uses Promises."
34
+ - **Debt Hotspots:** "The `AuthManager` is 1500 lines and handles both JWT and session logic."
35
+ - **Integration Points:** "We need to talk to the Stripe API, but there's no wrapper yet."
36
+ - **Conventions:** "The team always uses functional components over classes."
37
+
38
+ ### 5. Persist to specs/CONTEXT.md
39
+ Compile all findings into `specs/CONTEXT.md`. This file serves as the project's "Long-Term Memory".
40
+
41
+ ```markdown
42
+ # Project Context
43
+
44
+ ## Stack
45
+ - [Framework/Language]
46
+ - [Key Libraries]
47
+
48
+ ## Architecture
49
+ - [Pattern Description]
50
+ - [Data Flow]
51
+
52
+ ## Conventions (Observed)
53
+ - [Error Handling Pattern]
54
+ - [API Design]
55
+ - [Type System]
56
+
57
+ ## Signals / Active Considerations
58
+ - [Gap 1]
59
+ - [Hotspot 2]
60
+ ```
61
+
62
+ ## When to Use
63
+ - When first joining a project.
64
+ - Before a major refactor or architectural change.
65
+ - When `survey-context` reveals a lack of domain knowledge.
66
+ - To refresh `specs/CONTEXT.md` after significant changes.