Skip to content

Commit c4dbe79

Browse files
franklywatsonclaude
andcommitted
docs: implement spec — L1 reframing, new patterns, Playwright, adoption guide
- Reframe L1 as "Closed Loop Design and Verification" with context harvesting and REPL fractal loop concept; split into overview + 7 sub-docs in L1-patterns/ - Add Pattern 2.6 (Enforcement Pipeline Composition), 2.7 (Phase Transition Validation), 3.8 (Session Lifecycle), 4.5 (CI Guardrails) - Extend TS stack-test example with Playwright browser tests (2 test files) - Slim migration-guide (1500 lines) to adoption-guide (145 lines) - Add L4 scope note disclaimer; reference implementations point to rig - Rename all claude-stack-utils references to rig - Fix all markdownlint errors (36 files, 0 errors including specs/) - Fix broken links in L0, L3, examples (guardrails, TS README) - Add specs/, glossary entries, FAQ, .claude/skills/ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ecd4258 commit c4dbe79

36 files changed

Lines changed: 3374 additions & 2197 deletions

.claude/skills/brain-plus/SKILL.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
name: brain+
3+
description: "Invoke BEFORE any design or feature work. Wraps superpowers:brainstorming with scout agent context harvesting, stack-first design considerations, and constitutional rule awareness. Asks questions one at a time to refine the design."
4+
argument-hint: "[feature description]"
5+
user-invocable: true
6+
---
7+
8+
# brain+ — Context-Aware Design
9+
10+
Wraps `superpowers:brainstorming`. Requires superpowers to be installed.
11+
12+
## Before You Begin
13+
14+
Invoke this skill BEFORE starting any design work. It adds three capabilities on top of the base brainstorming skill:
15+
16+
1. **Scout context** — automatically harvests codebase context
17+
2. **Stack-first design** — considers Docker, test infrastructure, and full-loop verification
18+
3. **Constitutional awareness** — loads project rules from CLAUDE.md
19+
20+
## Procedure
21+
22+
### Phase A: Harvest Context
23+
24+
1. Invoke the scout agent to map the current codebase:
25+
26+
```
27+
Agent(subagent_type="scout", prompt="Map the codebase structure for [feature area]. Focus on: existing patterns, related modules, test infrastructure, and entry points relevant to [feature].")
28+
```
29+
30+
2. Read the project's CLAUDE.md for constitutional rules.
31+
32+
3. Identify:
33+
- Existing patterns this feature should follow
34+
- Test infrastructure available (vitest, pytest, stack tests)
35+
- Modules that will be affected
36+
- Components that must NOT be mocked (constitutional rules)
37+
38+
### Phase B: Design (delegate to superpowers:brainstorming)
39+
40+
1. Invoke `superpowers:brainstorming` with the enriched context.
41+
42+
2. During brainstorming, add these stack-first considerations:
43+
- What Docker services does this feature need?
44+
- What are the full-loop assertions? (primary + second-order + third-order effects)
45+
- What test utilities need to exist before implementation?
46+
- Which components are protected from mocking?
47+
48+
3. Use positive framing in all design guidance:
49+
- "Use real database connections in tests" (not "don't mock the database")
50+
- "Write assertions that verify observable behavior" (not "don't test implementation details")
51+
- "Show command output before claiming done" (not "don't say tests pass without evidence")
52+
53+
### Phase C: Validate
54+
55+
1. Confirm the design addresses:
56+
- [ ] Feature purpose and scope
57+
- [ ] Affected modules identified
58+
- [ ] Testing strategy defined
59+
- [ ] Constitutional rules acknowledged
60+
- [ ] No mocks for protected components
61+
- [ ] Stack test user journey defined (if applicable)
62+
63+
## Output
64+
65+
Return the validated design with testing strategy to feed into `plan+`.
66+
67+
## Skill Chain
68+
69+
After completing brain+, the next step is:
70+
71+
- Invoke `/plan+` to create the implementation plan from this design

.claude/skills/plan-plus/SKILL.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
name: plan+
3+
description: "Invoke AFTER brain+ design is approved. Wraps superpowers:writing-plans with constitutional rules, testing strategy per task, and mock policy. Creates bite-sized implementation plans."
4+
argument-hint: "[plan description]"
5+
user-invocable: true
6+
---
7+
8+
# plan+ — Disciplined Planning
9+
10+
Wraps `superpowers:writing-plans`. Requires superpowers to be installed.
11+
12+
## Before You Begin
13+
14+
This skill runs after `brain+` has produced a validated design. It creates the implementation plan with testing discipline baked into every task.
15+
16+
## Procedure
17+
18+
### Phase A: Load Context
19+
20+
1. Read the design output from `brain+` (from the current session or saved spec).
21+
22+
2. Load constitutional rules from CLAUDE.md. Add a **Constitutional Compliance** section to the plan:
23+
24+
```
25+
## Constitutional Rules for This Plan
26+
- Use real [database/payment/logger] connections — never mock protected components
27+
- Show command output before claiming done
28+
- Every source file change requires corresponding test changes
29+
- Full-loop assertions: verify primary + second-order + third-order effects
30+
```
31+
32+
3. Identify the mock policy for this plan:
33+
34+
```
35+
## Mock Policy
36+
Protected (never mock): [list from constitutional rules]
37+
Allowed: [external third-party services not yet containerized]
38+
```
39+
40+
### Phase B: Create Plan (delegate to superpowers:writing-plans)
41+
42+
1. Invoke `superpowers:writing-plans` with the enriched context.
43+
44+
2. For each task in the plan, ensure it includes:
45+
- **Test strategy**: which tests cover this task's requirements
46+
- **Mock check**: does this task need to interact with protected components?
47+
- **Evidence criteria**: what output proves this task is done
48+
49+
3. Every task must follow the pattern:
50+
51+
```
52+
### Task N: [Name]
53+
**Files:** [exact paths]
54+
**Test strategy:** [which tests, scoped to this task]
55+
**Mock check:** [are protected components involved?]
56+
- [ ] Step 1: Write failing test
57+
- [ ] Step 2: Verify it fails
58+
- [ ] Step 3: Write minimal implementation
59+
- [ ] Step 4: Verify it passes
60+
- [ ] Step 5: Commit
61+
```
62+
63+
### Phase C: Validate Plan
64+
65+
1. Confirm the plan:
66+
- [ ] Every task has a test strategy
67+
- [ ] No task mocks a protected component
68+
- [ ] Plan references exact file paths (no TBDs)
69+
- [ ] Evidence criteria defined for each task
70+
- [ ] Constitutional rules section present
71+
72+
## Output
73+
74+
Save the plan to `docs/plans/` and feed into `tdd+` for implementation.
75+
76+
## Skill Chain
77+
78+
After completing plan+, the next step is:
79+
80+
- Invoke `/tdd+` to implement the plan task-by-task with RED-GREEN-REFACTOR
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
name: review+
3+
description: "Invoke AFTER verify+ passes. Wraps superpowers:requesting-code-review with constitutional compliance checklist, stale test validation, and reviewer agent invocation. Two-stage review: spec compliance + code quality."
4+
argument-hint: "[plan file path]"
5+
user-invocable: true
6+
---
7+
8+
# review+ — Compliance Review
9+
10+
Wraps `superpowers:requesting-code-review`. Requires superpowers to be installed.
11+
12+
## Procedure
13+
14+
### Phase A: Gather Review Context
15+
16+
1. Load the plan from `docs/plans/`.
17+
18+
2. Get the list of files changed since the plan was created:
19+
20+
```
21+
git diff --name-only [plan-commit]..HEAD
22+
```
23+
24+
3. Invoke the scout agent to get current codebase state for comparison:
25+
26+
```
27+
Agent(subagent_type="scout", prompt="Get current state of these files: [changed files list]. For each file, report: symbol count, key exports, test coverage status.")
28+
```
29+
30+
### Phase B: Spec Compliance Review
31+
32+
1. For each task in the plan:
33+
- Check: was the task implemented? (file exists, code present)
34+
- Check: does the implementation match the plan's specification?
35+
- Check: are the specified tests present and passing?
36+
- Check: were any plan tasks skipped or significantly changed?
37+
38+
2. Check stale test status:
39+
- For each changed source file, verify a corresponding test file was also changed
40+
- Flag any source edits without test updates as stale test violations
41+
42+
3. Check constitutional compliance:
43+
- [ ] No protected components are mocked in any test file
44+
- [ ] All claims of success are backed by command output
45+
- [ ] Full-loop assertions present where applicable
46+
- [ ] No conditional test assertions (`if (condition) assert(...)`)
47+
- [ ] No empty test bodies
48+
- No `.skip` without documented reason
49+
50+
### Phase C: Code Quality Review (delegate to superpowers:requesting-code-review)
51+
52+
1. Invoke `superpowers:requesting-code-review` with the gathered context.
53+
54+
2. Check code quality:
55+
- Files are focused (one clear responsibility per file)
56+
- Interfaces are well-defined
57+
- No unnecessary abstractions
58+
- No speculative generalization
59+
- Positive framing in code comments and error messages
60+
61+
### Phase D: Review Report
62+
63+
1. Produce a two-stage review report:
64+
65+
```
66+
## Review Report
67+
68+
### Stage 1: Spec Compliance
69+
- [ ] All plan tasks implemented
70+
- [ ] Implementation matches plan specification
71+
- [ ] No stale test violations
72+
- [ ] Constitutional rules followed
73+
74+
### Stage 2: Code Quality
75+
- [ ] Files are focused and well-structured
76+
- [ ] Interfaces are clean
77+
- [ ] No unnecessary complexity
78+
- [ ] Positive framing throughout
79+
80+
### Verdict
81+
PASS / FAIL with specific items to address
82+
```
83+
84+
2. If PASS: the implementation is complete. Proceed to integration.
85+
If FAIL: list specific items, return to tdd+ to fix, then re-run verify+ and review+.
86+
87+
## Skill Chain
88+
89+
After review+ passes:
90+
91+
- The implementation is complete
92+
- Proceed to merge/PR decision (superpowers:finishing-a-development-branch)

.claude/skills/savings/SKILL.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
name: savings
3+
description: "Report rtk and jcodemunch token savings for the current session."
4+
argument-hint: ""
5+
user-invocable: true
6+
---
7+
8+
# savings — Session Savings Report
9+
10+
Report token savings from rtk and jcodemunch usage during this session.
11+
12+
## Procedure
13+
14+
1. Run `rtk gain --format json` to get current savings data. If rtk is not
15+
available, skip rtk reporting.
16+
2. Run `cat .rig-session.json 2>/dev/null` to read the session baseline and
17+
counters written by the hooks. If the file does not exist, report all-time
18+
totals instead of session deltas.
19+
3. Compute the session delta: `current total_saved - baseline totalSaved`.
20+
4. Format and print the report (see Output Format below). Do NOT write any
21+
explanatory text before or after the report — output ONLY the report lines.
22+
23+
## Output Format
24+
25+
With session data (baseline + delta available):
26+
27+
```
28+
[rig] Session Savings
29+
rtk: 6.4M saved (42 calls, +340K this session)
30+
jcodemunch: 28 queries
31+
```
32+
33+
Without session data (all-time totals only):
34+
35+
```
36+
[rig] Session Savings (all-time)
37+
rtk: 6.4M saved (3114 commands, 9.0% avg savings)
38+
```
39+
40+
If rtk is not installed:
41+
42+
```
43+
[rig] Session Savings
44+
rtk: not installed
45+
```
46+
47+
## Formatting Rules
48+
49+
- Format token counts: >=1M as `X.XM`, >=1K as `XK`, else raw number.
50+
- Round percentages to 1 decimal.
51+
- Output the report and nothing else.

.claude/skills/tdd-plus/SKILL.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
name: tdd+
3+
description: "Invoke AFTER plan+ is approved. Wraps superpowers:test-driven-development with full-loop assertions, no-mock enforcement, zero-defect, stale test detection, and scoped test runs. Implements plan tasks with RED-GREEN-REFACTOR discipline."
4+
argument-hint: "[plan file path or task range]"
5+
user-invocable: true
6+
---
7+
8+
# tdd+ — Disciplined Implementation
9+
10+
Wraps `superpowers:test-driven-development`. Requires superpowers to be installed.
11+
12+
**This skill activates tdd+ phase in the enforcement layer.** During this phase:
13+
14+
- Full test suite runs are redirected (use scoped tests only)
15+
- Stale test warnings fire when source edits lack test updates
16+
- Constitutional no-mock rules are enforced
17+
18+
## Procedure
19+
20+
### Phase A: Setup
21+
22+
1. Announce phase entry:
23+
24+
```
25+
Now using tdd+ skill. Enforcement layer active:
26+
- Test scope: scoped runs only (full suite reserved for verify+)
27+
- Stale tests: warnings when source edited without test updates
28+
- Zero-defect: every failure must be fixed before proceeding
29+
```
30+
31+
2. Load the plan from `docs/plans/`.
32+
33+
3. Identify the task(s) to implement.
34+
35+
### Phase B: Implement Each Task (delegate to superpowers:test-driven-development)
36+
37+
1. For each task in the plan, follow RED-GREEN-REFACTOR:
38+
39+
**RED — Write the failing test first:**
40+
- Write a test that captures the task's requirement
41+
- Use full-loop assertions where applicable:
42+
- Primary: does the function return the expected value?
43+
- Second-order: did the side effect occur? (state change, log entry, event)
44+
- Third-order: is the system still consistent? (no orphan records, no leaked connections)
45+
- Run the test: it MUST fail (if it passes immediately, the test is wrong)
46+
- Show the failure output
47+
48+
**GREEN — Write minimal code to make the test pass:**
49+
- Write the smallest possible implementation
50+
- Do not add features not in the plan
51+
- Run the scoped test: `npx vitest run tests/path/to/specific.test.ts`
52+
- Show the passing output
53+
54+
**REFACTOR — Clean up while tests pass:**
55+
- Improve code structure without changing behavior
56+
- Run scoped tests after each refactoring step
57+
- Commit after each completed task
58+
59+
2. After each source file edit, check:
60+
- Was the corresponding test file also updated?
61+
- If not, the enforcement layer will emit a stale test warning
62+
- Address it before proceeding to the next task
63+
64+
### Phase C: Task Completion
65+
66+
1. After each task, verify:
67+
- [ ] Test was written first and shown to fail
68+
- [ ] Implementation makes the test pass
69+
- [ ] Scoped test run passes (not full suite)
70+
- [ ] No constitutional rules violated
71+
- [ ] Commit made with descriptive message
72+
73+
2. Proceed to next task or exit tdd+ phase when all plan tasks complete.
74+
75+
## Test Scope Rules
76+
77+
During tdd+ phase, the enforcement layer redirects:
78+
79+
- `npx vitest run` (full suite) → advise to run scoped tests only
80+
- `pytest` (full suite) → advise to run specific test file
81+
82+
Use scoped commands:
83+
84+
```
85+
npx vitest run tests/router/resolver.test.ts
86+
pytest tests/test_config.py::test_load_config
87+
```
88+
89+
Full suite runs happen during `verify+` phase, not here.
90+
91+
## Skill Chain
92+
93+
After completing all plan tasks with tdd+:
94+
95+
- Invoke `/verify+` to run full suite and verify against plan acceptance criteria

0 commit comments

Comments
 (0)