bigpowers 2.2.0 → 2.4.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 (147) 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/README.md +27 -1
  126. package/deepen-architecture/SKILL.md +2 -0
  127. package/define-language/SKILL.md +2 -0
  128. package/diagnose-root/SKILL.md +2 -0
  129. package/edit-document/SKILL.md +2 -0
  130. package/fix-bug/SKILL.md +3 -1
  131. package/grill-me/SKILL.md +3 -1
  132. package/grill-with-docs/SKILL.md +3 -1
  133. package/investigate-bug/SKILL.md +5 -11
  134. package/map-codebase/SKILL.md +3 -1
  135. package/model-domain/SKILL.md +2 -0
  136. package/package.json +11 -2
  137. package/plan-release/SKILL.md +1 -1
  138. package/plan-work/SKILL.md +3 -1
  139. package/release-branch/SKILL.md +4 -2
  140. package/run-planning/SKILL.md +3 -2
  141. package/scope-work/SKILL.md +3 -1
  142. package/scripts/sync-skills.sh +48 -3
  143. package/scripts/validate-doctrine.sh +24 -9
  144. package/seed-conventions/SKILL.md +2 -0
  145. package/slice-tasks/SKILL.md +3 -1
  146. package/survey-context/SKILL.md +3 -1
  147. package/write-document/SKILL.md +2 -0
@@ -0,0 +1,77 @@
1
+ ---
2
+ description: Apply the F.I.R.S.T test quality rubric (Fast, Independent, Repeatable, Self-Validating, Timely) to a test suite or individual tests. Use when develop-tdd is writing tests, when test quality needs to be checked, or when user mentions F.I.R.S.T or "test quality".
3
+ ---
4
+
5
+
6
+ # Enforce FIRST
7
+ > **HARD GATE** — **HARD GATE** — Before shipping, ALL enforcement checks must pass: lint, typecheck, tests, coverage gates. Do NOT disable or skip checks to get to green.
8
+
9
+
10
+ Apply the F.I.R.S.T rubric (Uncle Bob, Clean Code Chapter 9) to evaluate and improve tests.
11
+
12
+ This skill is typically invoked internally by `develop-tdd` during the test-writing phase. It can also be run standalone on an existing test suite.
13
+
14
+ ## The F.I.R.S.T Rubric
15
+
16
+ ### F — Fast
17
+
18
+ Tests must run quickly. Slow tests don't get run. They don't get trusted.
19
+
20
+ - [ ] No real network calls (use fakes/stubs for external I/O)
21
+ - [ ] No real database (use in-memory or transaction-rollback strategies)
22
+ - [ ] No `sleep` or arbitrary timeouts in test code
23
+ - [ ] The full suite runs in under 30 seconds (target; adjust to project size)
24
+
25
+ **Fix:** Replace slow I/O with named fake classes. Never inline anonymous stubs.
26
+
27
+ ### I — Independent
28
+
29
+ Tests must not depend on each other. Running in any order must produce the same result.
30
+
31
+ - [ ] No shared mutable state between tests
32
+ - [ ] Each test sets up its own data and tears it down
33
+ - [ ] No test assumes another test ran first
34
+ - [ ] Tests can be run individually (e.g. `npm test -- mytest.test.ts`) and pass
35
+
36
+ **Fix:** Move setup into `beforeEach`. Use factory functions to build test data.
37
+
38
+ ### R — Repeatable
39
+
40
+ Tests must pass consistently in any environment.
41
+
42
+ - [ ] No dependency on machine-specific paths, ports, or environment variables (unless explicitly injected)
43
+ - [ ] No dependency on current time without mocking the clock
44
+ - [ ] No flakiness — a test that sometimes fails is worse than no test
45
+ - [ ] Tests pass on CI the same way they pass locally
46
+
47
+ **Fix:** Inject time, randomness, and environment as parameters. Pin seeds for anything random.
48
+
49
+ ### S — Self-Validating
50
+
51
+ Tests must report pass or fail automatically. No human inspection required.
52
+
53
+ - [ ] Tests use assertions (`expect`, `assert`, etc.) — not just `console.log`
54
+ - [ ] Failure messages are descriptive enough to diagnose without reading the test body
55
+ - [ ] No tests that "pass" by default when the feature is broken
56
+
57
+ **Fix:** Add assertion messages. Use matchers that describe the expected behavior.
58
+
59
+ ### T — Timely
60
+
61
+ Tests must be written at the right time — before or immediately with the code they test.
62
+
63
+ - [ ] Tests are written in the same commit as the code (or the commit before, if TDD)
64
+ - [ ] No "I'll add tests later" patterns
65
+ - [ ] Bug fixes include a regression test that would have caught the bug
66
+
67
+ **Fix:** Run `develop-tdd` — it enforces the timely principle by design.
68
+
69
+ ## Applying the rubric
70
+
71
+ For each failing criterion:
72
+ 1. Identify which tests violate it
73
+ 2. Describe the fix
74
+ 3. Apply the fix
75
+ 4. Re-run the suite to confirm it still passes
76
+
77
+ Report: "F.I.R.S.T audit complete. X criteria passed, Y fixed."
@@ -0,0 +1,38 @@
1
+ ---
2
+ description: Benchmark-gated skill evolution — consume bigpowers-benchmark report, propose plan-work change, edit skill via craft-skill, re-run benchmark, record ADR. Use when a skill underperforms on benchmark or stocktake finds systemic gap.model: opus
3
+ ---
4
+
5
+
6
+ # Evolve Skill
7
+
8
+ > **HARD GATE** — No skill change ships without benchmark score ≥ pre-change baseline. Learning is measured and versioned — never implicit.
9
+
10
+ ## Loop
11
+
12
+ 1. Run `bigpowers-benchmark` (external repo); save report path in state.yaml.
13
+ 2. Identify target skill + measurable gap from report.
14
+ 3. `plan-work` — minimal change proposal with verify commands.
15
+ 4. Edit via `craft-skill` / direct SKILL.md edit; run `sync-skills.sh`.
16
+ 5. Re-run benchmark; compare scores.
17
+ 6. Record decision in `specs/adr/` + `session-state`; revert if regression.
18
+
19
+ ## Verify
20
+
21
+ → verify: benchmark report shows post-change score ≥ baseline (document paths in state.yaml)
22
+
23
+ See [REFERENCE.md](REFERENCE.md) for ADR template.
24
+
25
+ ---
26
+
27
+ # Evolve Skill — ADR snippet
28
+
29
+ ```markdown
30
+ ## ADR-XXXX: Evolve <skill-name>
31
+
32
+ **Status:** Accepted
33
+ **Benchmark:** before X% / after Y%
34
+ **Change:** one-sentence summary
35
+ **Evidence:** path/to/benchmark-report.md
36
+ ```
37
+
38
+ Benchmark repo: `/Users/danielvm/Developer/bigpowers-benchmark/`
@@ -0,0 +1,54 @@
1
+ ---
2
+ description: Batch-execute tasks from the active epic capsule sequentially, with a human checkpoint after each step. Use when user has an approved plan and wants step-by-step oversight.
3
+ ---
4
+
5
+
6
+ # Execute Plan
7
+
8
+ Execute tasks from the **active epic** (`specs/epics/eNN-slug/epic.yaml` story `tasks[]`) one at a time, showing evidence after each step before proceeding.
9
+
10
+ > **HARD GATE** — Do NOT proceed if on `main` or `master`. Run `kickoff-branch` first.
11
+ >
12
+ > **HARD GATE** — Active epic must exist with runnable `verify` on each task. If missing, run `plan-release` then `plan-work` or `build-epic`.
13
+
14
+ ## Process
15
+
16
+ ### 1. Read the plan
17
+
18
+ Read `specs/state.yaml` (`active_epic`, `active_story`) and the matching `specs/epics/*/epic.yaml`. Parse `depends-on` in task descriptions for execution waves.
19
+
20
+ > **CONTEXT ISOLATION** — Spawn each skill with a **fresh context window**. Pass decisions only through `specs/state.yaml` `handoff` — never rely on prior chat history.
21
+
22
+ Confirm with the user: step count, skip/reorder, stop-after step.
23
+
24
+ ### 2. Execute step by step
25
+
26
+ For each task in the active story:
27
+
28
+ **a. Announce** — task `desc` and `verify` command.
29
+
30
+ **b. Execute** — code or `delegate-task` / `dispatch-agents` for waves.
31
+
32
+ **c. Run verify** — must be green before advancing.
33
+
34
+ **d. Log** — non-obvious decisions in `specs/state.yaml` under `decisions[]` or `handoff` block.
35
+
36
+ **e. Checkpoint** — ask to proceed unless autonomous mode requested.
37
+
38
+ **f. Story UAT** — after last task, run manual verification script from story notes or `verify-work`.
39
+
40
+ On verify failure: fix and re-run; never advance on red.
41
+
42
+ Update `specs/execution-status.yaml` when a story/epic completes (`bash scripts/sync-status-from-epics.sh` or direct edit).
43
+
44
+ ### 3. Blockers
45
+
46
+ Report blocker; ask skip/adapt/stop; update epic capsule if plan changes.
47
+
48
+ ### 4. Final report
49
+
50
+ Suggest: `verify-work` → `run-evals` → `audit-code` → `simulate-agents` → `commit-message` → `release-branch`
51
+
52
+ ## Rules
53
+
54
+ - **Loop until behavioral correctness is verified**: if a verify command passes but the observed behavior is still wrong, return to step 1 and run the execution cycle again.
@@ -0,0 +1,36 @@
1
+ ---
2
+ description: Bug fix orchestrator — active_flow fix_bug; reads specs/bugs/BUG-*.md; chains investigate-bug, develop-tdd, validate-fix. Use when user reports a defect.
3
+ ---
4
+
5
+
6
+ # Fix Bug
7
+
8
+ **Boundary**: Orchestrator flow — chains `investigate-bug` (entry point + RCA via `diagnose-root`) → `develop-tdd` → `validate-fix`. Does not implement RCA or write bug files directly.
9
+
10
+ Orchestrates **fix_bug** flow without mixing epic build state.
11
+
12
+ > **HARD GATE** — Set `specs/state.yaml` `active_flow: fix_bug`.
13
+
14
+ ## Process
15
+
16
+ 1. If no `specs/bugs/BUG-*.md`, run `investigate-bug` first — it handles history check, RCA (via `diagnose-root`), fix approach, and writes the bug file.
17
+ 2. `develop-tdd` against the bug file's verify steps.
18
+ 3. `validate-fix` — re-run failing test, full suite, lint.
19
+ 4. `bash scripts/sync-bugs-registry.sh` — refresh `specs/bugs/registry.yaml`.
20
+ 5. Clear `active_flow` or return to `build_epic` when done.
21
+
22
+ ## Bug file SoT
23
+
24
+ One markdown file per bug with frontmatter:
25
+
26
+ ```yaml
27
+ bug_id: BUG-001
28
+ status: open
29
+ severity: high
30
+ scope: api
31
+ title: Short title
32
+ ```
33
+
34
+ ## Verify
35
+
36
+ → verify: `test -d specs/bugs && bash scripts/sync-bugs-registry.sh`
@@ -0,0 +1,95 @@
1
+ ---
2
+ description: Interactive assumption-surfacing Q&A that stress-tests a plan through relentless questioning until every decision is resolved. Use when user wants to challenge a plan, validate decisions from conversation/context, or mentions "grill me". For doc-grounded variant, use grill-with-docs.
3
+ ---
4
+
5
+
6
+ # Grill Me
7
+
8
+ > **Use this vs grill-with-docs:** `grill-me` surfaces assumptions from the conversation and context alone — no documentation fetching. Use `grill-with-docs` (the doc-grounded variant) when the plan relies on a specific library or external API and every challenge must cite a real doc URL.
9
+
10
+ Two modes. Default is **Design**. Switch to **Docs** by saying "grill me with docs" or when the plan relies on a specific library or external API.
11
+
12
+ > **HARD GATE** — Do NOT accept a design until every hard decision has been stress-tested. "Seems right" is not a decision. Grilling must identify and resolve tensions before build begins.
13
+
14
+ ## Design mode (default)
15
+
16
+ Interview relentlessly about every aspect of this plan until reaching shared understanding. Walk each branch of the design tree, resolving dependencies between decisions one-by-one. For each question, provide your recommended answer. Ask one question at a time.
17
+
18
+ If a question can be answered by exploring the codebase, explore it instead.
19
+
20
+ ## Docs mode
21
+
22
+ Ground every challenge in real documentation — no assumption about a library's behavior goes unchecked. See [REFERENCE.md](REFERENCE.md) for the full process.
23
+
24
+ Short form:
25
+ 1. List every external library, third-party API, and framework behavior relied upon.
26
+ 2. Fetch the actual docs for each (`WebFetch` the official API reference).
27
+ 3. Challenge each plan assumption against the real docs: correct method signature? right version? deprecated?
28
+ 4. Report confirmed ✓, corrected ✗ (with the real behavior), and uncertain → `spike-prototype`.
29
+ 5. Update the plan for each confirmed discrepancy.
30
+
31
+ ---
32
+
33
+ # Docs Mode — Full Process
34
+
35
+ Triggered by "grill me with docs" or when a plan depends on a specific library or external API.
36
+
37
+ **Why this matters:** AI agents hallucinate API methods, argument orders, and behaviors. Every assumption about an external dependency must be validated against the actual docs before code is written.
38
+
39
+ ## Step 1 — Identify the dependencies
40
+
41
+ From the plan or conversation, list:
42
+ - Every external library being used
43
+ - Every third-party API being called
44
+ - Every framework behavior being relied upon
45
+
46
+ Ask: "Which of these are you most confident about? Which are you less sure of?"
47
+
48
+ ## Step 2 — Fetch the relevant docs
49
+
50
+ For each dependency, fetch the actual documentation:
51
+
52
+ ```
53
+ WebFetch the official docs for [library/API]
54
+ ```
55
+
56
+ Prioritize:
57
+ - The API reference for the specific method being used
58
+ - The changelog for the version in use (breaking changes)
59
+ - Migration guides if upgrading from a previous version
60
+ - Known gotchas / FAQ sections
61
+
62
+ ## Step 3 — Challenge each assumption
63
+
64
+ For every assumption in the plan, find the corresponding doc section and ask:
65
+
66
+ - "Does the real API actually work this way? Show me the doc."
67
+ - "Is this method available in the version you're using?"
68
+ - "Does this argument order match the actual signature?"
69
+ - "Are there rate limits, quotas, or timeout behaviors that affect this design?"
70
+ - "Is this marked as deprecated in the current version?"
71
+
72
+ Ask one question at a time. For each challenge, cite the specific URL and section.
73
+
74
+ ## Step 4 — Surface hallucinations
75
+
76
+ When an assumption doesn't match the docs:
77
+
78
+ > "Your plan uses `library.doThing(a, b)` but the [docs](URL) show the signature is `doThing(config: {a, b})` with a config object. This will fail at runtime."
79
+
80
+ Document each discrepancy clearly.
81
+
82
+ ## Step 5 — Update the plan
83
+
84
+ For each confirmed discrepancy, recommend a concrete fix:
85
+ - Correct method signature
86
+ - Correct argument order
87
+ - Alternative approach that matches what the library actually supports
88
+ - Whether a spike (`spike-prototype`) is needed to validate a remaining uncertainty
89
+
90
+ ## Step 6 — Sign off
91
+
92
+ When all major assumptions have been validated against docs, report:
93
+ - Which assumptions were confirmed ✓
94
+ - Which were corrected ✗ + what the correct approach is
95
+ - Which remain uncertain → recommend `spike-prototype`
@@ -0,0 +1,37 @@
1
+ ---
2
+ description: Doc-grounded variant of grill-me — stress-tests plan assumptions by fetching and citing real library or API documentation. Every challenge must cite a real URL. Use when the plan depends on a specific library or external API.model: opus
3
+ ---
4
+
5
+
6
+ # Grill With Docs
7
+
8
+ > **Use this vs grill-me:** `grill-with-docs` is the doc-grounded variant of `grill-me`. Use it when the plan relies on external libraries or APIs and every challenge must be grounded in and cite a real documentation URL. Use `grill-me` for context-only assumption surfacing without fetching docs.
9
+
10
+ > **HARD GATE** — Every challenge must cite a real documentation URL. No hallucinated APIs.
11
+
12
+ ## Process
13
+
14
+ 1. Read the plan or design under test (`specs/release-plan.yaml + epic shards`, INTERFACE-OPTIONS.md, etc.).
15
+ 2. List assumptions that depend on external libraries or APIs.
16
+ 3. For each assumption: fetch or quote official docs; challenge with "docs say X, plan says Y."
17
+ 4. Resolve or update the plan inline; unresolved items block `plan-work`.
18
+
19
+ ## Docs mode rules
20
+
21
+ - Cite URL + quoted snippet (method name, parameter, version).
22
+ - If docs contradict the plan, plan loses until updated.
23
+ - Prefer official docs over blog posts.
24
+
25
+ ## Verify
26
+
27
+ → verify: dialogue log contains at least one `https://` doc URL per challenged assumption
28
+
29
+ See [REFERENCE.md](REFERENCE.md) for question templates.
30
+
31
+ ---
32
+
33
+ # Grill With Docs — Question templates
34
+
35
+ - "Docs at [URL] show signature `foo(bar?: Baz)`. Your plan calls `foo(bar, baz)` — which is correct?"
36
+ - "The changelog at [URL] deprecates X in v3. Your plan still uses X — migrate or pin version?"
37
+ - "Error handling in [URL] throws `NetworkError`. Your plan catches `Error` only — is that sufficient?"
@@ -0,0 +1,212 @@
1
+ ---
2
+ 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.
3
+ ---
4
+
5
+
6
+ # Guard Git
7
+ > **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.
8
+
9
+
10
+ Installs a shared hook that blocks destructive git operations and enforces workflow discipline. **Requires `jq` on the agent's PATH** when the hook runs.
11
+
12
+ ## What gets blocked/enforced
13
+
14
+ - **Safety**: `git push --force`, `git reset --hard`, `git clean -f`, `git branch -D`, `git checkout .`, `git restore .`.
15
+ - **Discipline**: Blocks direct commits or pushes to protected branches (`main`, `master`) unless `GIT_BIGPOWERS_LAND=1` (set only by `scripts/land-branch.sh`).
16
+ - **Allows**: `git push origin <feature-branch>` for backup/CI; solo land push to `main` only inside `land-branch.sh`.
17
+ - **Standardization**: Enforces [Conventional Commits](https://www.conventionalcommits.org/) for all `git commit` commands.
18
+ - **Secrets**: Blocks commits containing common secret patterns (`sk-`, `ghp_`, `AKIA`, `xoxb-`, `-----BEGIN` private keys) — see [REFERENCE.md](REFERENCE.md).
19
+
20
+ ## Quick start
21
+
22
+ 1. **Scope**: ask project-only vs global (paths differ per product).
23
+ 2. **Copy the hook bundle** from the root [hooks/](hooks/) directory to the client's hooks directory.
24
+ 3. **Run `chmod +x`** on `pre-tool-use.sh`.
25
+ 4. **Merge** the hook snippet from [REFERENCE.md](REFERENCE.md) into the right settings file — do not wipe unrelated keys.
26
+ 5. **Verify** with the tests in [REFERENCE.md](REFERENCE.md).
27
+
28
+ | Client | Mechanism | Config |
29
+ |--------|-----------|--------|
30
+ | Claude Code | `PreToolUse` (Bash) | `.claude/settings.json` or `~/.claude/settings.json` |
31
+ | Cursor / Cursor CLI | `beforeShellExecution` | `.cursor/hooks.json` or `~/.cursor/hooks.json` |
32
+ | Gemini CLI | `BeforeTool` + `run_shell_command` | `.gemini/settings.json` or `~/.gemini/settings.json` |
33
+ | Google Antigravity | Built-in Terminal **Deny list** | Settings UI (no shell hook) |
34
+
35
+ **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.
36
+
37
+ ## Customization
38
+
39
+ To add or remove patterns or protected branches, edit `pre-tool-use.sh`.
40
+
41
+ ## Advanced
42
+
43
+ Full JSON examples, merge rules, Antigravity deny-list entries, and test commands: [REFERENCE.md](REFERENCE.md).
44
+
45
+ ---
46
+
47
+ # Git guardrails — reference
48
+
49
+ ## Secret patterns (audit + pre-commit)
50
+
51
+ Agents must not commit files containing:
52
+
53
+ - `sk-` (OpenAI API keys)
54
+ - `ghp_` / `gho_` (GitHub tokens)
55
+ - `AKIA` (AWS access key id)
56
+ - `xoxb-` (Slack bot tokens)
57
+ - `-----BEGIN` private keys
58
+
59
+ Use `audit-code` supply-chain checklist before commit. Consider `git-secrets` or custom pre-commit hook in target projects.
60
+
61
+ ## Copy layout
62
+
63
+ The main script is `pre-tool-use.sh`.
64
+
65
+ ```text
66
+ <hooks-dir>/pre-tool-use.sh
67
+ ```
68
+
69
+ Example project locations:
70
+
71
+ - Claude: `.claude/hooks/`
72
+ - Cursor: `.cursor/hooks/`
73
+ - Gemini: `.gemini/hooks/`
74
+
75
+ Use the same layout for user-level hooks (`~/.claude/hooks`, `~/.cursor/hooks`, `~/.gemini/hooks`).
76
+
77
+ ---
78
+
79
+ ## Claude Code
80
+
81
+ Hook command does **not** need `GIT_GUARDRAILS_MODE` (defaults to `claude`).
82
+
83
+ **Project** (`.claude/settings.json`):
84
+
85
+ ```json
86
+ {
87
+ "hooks": {
88
+ "PreToolUse": [
89
+ {
90
+ "matcher": "Bash",
91
+ "hooks": [
92
+ {
93
+ "type": "command",
94
+ "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/pre-tool-use.sh"
95
+ }
96
+ ]
97
+ }
98
+ ]
99
+ }
100
+ }
101
+ ```
102
+
103
+ ---
104
+
105
+ ## Cursor and Cursor CLI
106
+
107
+ Use `beforeShellExecution`. Set `GIT_GUARDRAILS_MODE=cursor`.
108
+
109
+ **Project** (`.cursor/hooks.json`):
110
+
111
+ ```json
112
+ {
113
+ "version": 1,
114
+ "hooks": {
115
+ "beforeShellExecution": [
116
+ {
117
+ "command": "GIT_GUARDRAILS_MODE=cursor .cursor/hooks/pre-tool-use.sh",
118
+ "matcher": "git"
119
+ }
120
+ ]
121
+ }
122
+ }
123
+ ```
124
+
125
+ ---
126
+
127
+ ## Gemini CLI
128
+
129
+ Use `BeforeTool` with matcher `run_shell_command`. Set **`GIT_GUARDRAILS_MODE=gemini`**.
130
+
131
+ **Project** (`.gemini/settings.json`):
132
+
133
+ ```json
134
+ {
135
+ "hooks": {
136
+ "BeforeTool": [
137
+ {
138
+ "matcher": "run_shell_command",
139
+ "hooks": [
140
+ {
141
+ "name": "git-guardrails",
142
+ "type": "command",
143
+ "command": "GIT_GUARDRAILS_MODE=gemini \"$GEMINI_PROJECT_DIR\"/.gemini/hooks/pre-tool-use.sh",
144
+ "timeout": 5000
145
+ }
146
+ ]
147
+ }
148
+ ]
149
+ }
150
+ }
151
+ ```
152
+
153
+ ---
154
+
155
+ ## Google Antigravity
156
+
157
+ Add **Deny list** entries in **Antigravity → Settings → Terminal**:
158
+
159
+ - `git push --force`
160
+ - `git push origin main`
161
+ - `git push origin master`
162
+ - `git reset --hard`
163
+ - `git clean`
164
+ - `git branch -D`
165
+ - `git checkout .`
166
+ - `git restore .`
167
+
168
+ ---
169
+
170
+ ## Verify (local tests)
171
+
172
+ **1. Block push to main without land mode (Claude mode):**
173
+ ```bash
174
+ echo '{"tool_input":{"command":"git push origin main"}}' | ./pre-tool-use.sh
175
+ # Expected: exit 2, protected branch message
176
+ ```
177
+
178
+ **2. Allow push to main with GIT_BIGPOWERS_LAND=1:**
179
+ ```bash
180
+ GIT_BIGPOWERS_LAND=1 echo '{"tool_input":{"command":"git push origin main"}}' | ./pre-tool-use.sh
181
+ # Expected: exit 0 (when on main)
182
+ ```
183
+
184
+ **3. Allow push to feature branch:**
185
+ ```bash
186
+ echo '{"tool_input":{"command":"git push -u origin feat/my-task"}}' | ./pre-tool-use.sh
187
+ # Expected: exit 0
188
+ ```
189
+
190
+ **4. Conventional Commits (Gemini mode):**
191
+ ```bash
192
+ echo '{"tool_input":{"command":"git commit -m \"bad message\""}}' | GIT_GUARDRAILS_MODE=gemini ./pre-tool-use.sh
193
+ # Expected: exit 0, {"decision":"deny", "reason":"..."}
194
+ ```
195
+
196
+ **5. Protected Branch commit (Cursor mode):**
197
+ ```bash
198
+ # Run on 'main' branch
199
+ echo '{"command":"git commit -m \"feat: valid message\""}' | GIT_GUARDRAILS_MODE=cursor ./pre-tool-use.sh
200
+ # Expected: exit 2, "Direct commits to protected branch 'main' are forbidden"
201
+ ```
202
+
203
+ **6. Land script exists:**
204
+ ```bash
205
+ test -x scripts/land-branch.sh && echo OK
206
+ ```
207
+
208
+ **7. Allow (Gemini mode):**
209
+ ```bash
210
+ echo '{"tool_input":{"command":"git status"}}' | GIT_GUARDRAILS_MODE=gemini ./pre-tool-use.sh
211
+ # Expected: exit 0, {"decision":"allow"}
212
+ ```
@@ -0,0 +1,93 @@
1
+ ---
2
+ 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.
3
+ ---
4
+
5
+
6
+ # Hook Commits
7
+ > **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.
8
+
9
+
10
+ ## What This Sets Up
11
+
12
+ - **Husky** pre-commit hook
13
+ - **lint-staged** running Prettier on all staged files
14
+ - **Prettier** config (if missing)
15
+ - **typecheck** and **test** scripts in the pre-commit hook
16
+
17
+ ## Steps
18
+
19
+ ### 1. Detect package manager
20
+
21
+ 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.
22
+
23
+ ### 2. Install dependencies
24
+
25
+ Install as devDependencies:
26
+
27
+ ```
28
+ husky lint-staged prettier
29
+ ```
30
+
31
+ ### 3. Initialize Husky
32
+
33
+ ```bash
34
+ npx husky init
35
+ ```
36
+
37
+ This creates `.husky/` dir and adds `prepare: "husky"` to package.json.
38
+
39
+ ### 4. Create `.husky/pre-commit`
40
+
41
+ Write this file (no shebang needed for Husky v9+):
42
+
43
+ ```
44
+ npx lint-staged
45
+ npm run typecheck
46
+ npm run test
47
+ ```
48
+
49
+ **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.
50
+
51
+ ### 5. Create `.lintstagedrc`
52
+
53
+ ```json
54
+ {
55
+ "*": "prettier --ignore-unknown --write"
56
+ }
57
+ ```
58
+
59
+ ### 6. Create `.prettierrc` (if missing)
60
+
61
+ Only create if no Prettier config exists. Use these defaults:
62
+
63
+ ```json
64
+ {
65
+ "useTabs": false,
66
+ "tabWidth": 2,
67
+ "printWidth": 80,
68
+ "singleQuote": false,
69
+ "trailingComma": "es5",
70
+ "semi": true,
71
+ "arrowParens": "always"
72
+ }
73
+ ```
74
+
75
+ ### 7. Verify
76
+
77
+ - [ ] `.husky/pre-commit` exists and is executable
78
+ - [ ] `.lintstagedrc` exists
79
+ - [ ] `prepare` script in package.json is `"husky"`
80
+ - [ ] `prettier` config exists
81
+ - [ ] Run `npx lint-staged` to verify it works
82
+
83
+ ### 8. Commit
84
+
85
+ Stage all changed/created files and commit with message: `chore: add pre-commit hooks (husky + lint-staged + prettier)`
86
+
87
+ This will run through the new pre-commit hooks — a good smoke test that everything works.
88
+
89
+ ## Notes
90
+
91
+ - Husky v9+ doesn't need shebangs in hook files
92
+ - `prettier --ignore-unknown` skips files Prettier can't parse (images, etc.)
93
+ - The pre-commit runs lint-staged first (fast, staged-only), then full typecheck and tests