safeword 0.8.4 → 0.8.5

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 (31) hide show
  1. package/dist/{check-OUVIK2O6.js → check-QZ3ZAHZY.js} +3 -3
  2. package/dist/{chunk-SIK3BC7F.js → chunk-62YXVEKM.js} +27 -9
  3. package/dist/{chunk-SIK3BC7F.js.map → chunk-62YXVEKM.js.map} +1 -1
  4. package/dist/{chunk-TP334635.js → chunk-SIEJPWQA.js} +2 -2
  5. package/dist/{chunk-QYCKBF57.js → chunk-VZPFU4YI.js} +2 -2
  6. package/dist/cli.js +6 -6
  7. package/dist/{diff-ASRWAPYJ.js → diff-YXUSIILN.js} +3 -3
  8. package/dist/{reset-4G5DEEMY.js → reset-HQXT7SCI.js} +3 -3
  9. package/dist/{setup-URK77YMR.js → setup-JX476EH3.js} +3 -3
  10. package/dist/sync-A7VWZKQD.js +9 -0
  11. package/dist/{upgrade-IDR2ZALG.js → upgrade-45E6255Q.js} +4 -4
  12. package/package.json +15 -14
  13. package/templates/cursor/rules/safeword-brainstorming.mdc +198 -0
  14. package/templates/cursor/rules/safeword-debugging.mdc +202 -0
  15. package/templates/cursor/rules/safeword-enforcing-tdd.mdc +207 -0
  16. package/templates/cursor/rules/safeword-quality-reviewer.mdc +158 -0
  17. package/templates/cursor/rules/safeword-refactoring.mdc +175 -0
  18. package/templates/scripts/lint-md.sh +0 -0
  19. package/templates/skills/safeword-brainstorming/SKILL.md +210 -0
  20. package/templates/skills/{safeword-systematic-debugger → safeword-debugging}/SKILL.md +1 -71
  21. package/templates/skills/{safeword-tdd-enforcer → safeword-enforcing-tdd}/SKILL.md +17 -17
  22. package/templates/skills/safeword-quality-reviewer/SKILL.md +17 -67
  23. package/dist/sync-AOKWEHCY.js +0 -9
  24. /package/dist/{check-OUVIK2O6.js.map → check-QZ3ZAHZY.js.map} +0 -0
  25. /package/dist/{chunk-TP334635.js.map → chunk-SIEJPWQA.js.map} +0 -0
  26. /package/dist/{chunk-QYCKBF57.js.map → chunk-VZPFU4YI.js.map} +0 -0
  27. /package/dist/{diff-ASRWAPYJ.js.map → diff-YXUSIILN.js.map} +0 -0
  28. /package/dist/{reset-4G5DEEMY.js.map → reset-HQXT7SCI.js.map} +0 -0
  29. /package/dist/{setup-URK77YMR.js.map → setup-JX476EH3.js.map} +0 -0
  30. /package/dist/{sync-AOKWEHCY.js.map → sync-A7VWZKQD.js.map} +0 -0
  31. /package/dist/{upgrade-IDR2ZALG.js.map → upgrade-45E6255Q.js.map} +0 -0
@@ -0,0 +1,158 @@
1
+ ---
2
+ description: Deep code quality review with web research. Use when user explicitly requests verification against latest docs ('double check against latest', 'verify versions', 'check security'), needs deeper analysis beyond automatic hook, or is working on projects without SAFEWORD.md/CLAUDE.md. Fetches current documentation, checks latest versions, and provides deep analysis (performance, security, alternatives).
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Quality Reviewer
7
+
8
+ Deep quality review with web research to verify code against the latest ecosystem state.
9
+
10
+ **Primary differentiator**: Web research to verify against current versions, documentation, and best practices.
11
+
12
+ **Triggers**:
13
+
14
+ - **Explicit web research request**: "double check against latest docs", "verify we're using latest version", "check for security issues"
15
+ - **Deep dive needed**: User wants analysis beyond automatic hook (performance, architecture alternatives, trade-offs)
16
+ - **No SAFEWORD.md/CLAUDE.md**: Projects without context files (automatic hook won't run, manual review needed)
17
+ - **Pre-change review**: User wants review before making changes (automatic hook only triggers after changes)
18
+ - **Model-invoked**: Claude determines web research would be valuable
19
+
20
+ **Relationship to automatic quality hook**:
21
+
22
+ - **Automatic hook**: Fast quality check using existing knowledge + project context (guaranteed, runs on every change)
23
+ - **This skill**: Deep review with web research when verification against current ecosystem is needed (on-demand, 2-3 min)
24
+
25
+ ## Review Protocol
26
+
27
+ ### 1. Identify What Changed
28
+
29
+ Understand context:
30
+
31
+ - What files were just modified?
32
+ - What problem is being solved?
33
+ - What was the implementation approach?
34
+
35
+ ### 2. Read Project Standards
36
+
37
+ ```bash
38
+ ls CLAUDE.md SAFEWORD.md ARCHITECTURE.md .claude/
39
+ ```
40
+
41
+ Read relevant standards:
42
+
43
+ - `CLAUDE.md` or `SAFEWORD.md` - Project-specific guidelines
44
+ - `ARCHITECTURE.md` - Architectural principles
45
+ - `@./.safeword/guides/code-philosophy.md` - Core coding principles
46
+
47
+ ### 3. Evaluate Correctness
48
+
49
+ **Will it work?**
50
+
51
+ - Does the logic make sense?
52
+ - Are there obvious bugs?
53
+
54
+ **Edge cases:**
55
+
56
+ - Empty inputs, null/undefined, boundary conditions (0, -1, max)?
57
+ - Concurrent access, network failures?
58
+
59
+ **Error handling:**
60
+
61
+ - Are errors caught appropriately?
62
+ - Helpful error messages?
63
+ - Cleanup handled (resources, connections)?
64
+
65
+ **Logic errors:**
66
+
67
+ - Off-by-one errors, race conditions, wrong assumptions?
68
+
69
+ ### 4. Evaluate Anti-Bloat
70
+
71
+ - Are all dependencies necessary? Could we use stdlib/built-ins?
72
+ - Are abstractions solving real problems or imaginary ones?
73
+ - YAGNI: Is this feature actually needed now?
74
+
75
+ ### 5. Evaluate Elegance
76
+
77
+ - Is the code easy to understand?
78
+ - Are names clear and descriptive?
79
+ - Is the intent obvious?
80
+ - Will this be easy to change later?
81
+
82
+ ### 6. Check Standards Compliance
83
+
84
+ **Project standards** (from CLAUDE.md/SAFEWORD.md/ARCHITECTURE.md):
85
+
86
+ - Does it follow established patterns?
87
+ - Does it violate any documented principles?
88
+
89
+ **Library best practices:**
90
+
91
+ - Are we using libraries correctly?
92
+ - Are we following official documentation?
93
+
94
+ ### 7. Verify Latest Versions
95
+
96
+ **CRITICAL**: This is your main differentiator from automatic hook. ALWAYS check versions.
97
+
98
+ Search for:
99
+ - "[library name] latest stable version 2025"
100
+ - "[library name] security vulnerabilities"
101
+
102
+ **Flag if outdated:**
103
+
104
+ - Major versions behind → WARN (e.g., React 17 when 19 is stable)
105
+ - Minor versions behind → NOTE (e.g., React 19.0.0 when 19.1.0 is stable)
106
+ - Security vulnerabilities → CRITICAL (must upgrade)
107
+ - Using latest → Confirm
108
+
109
+ ### 8. Verify Latest Documentation
110
+
111
+ **CRITICAL**: This is your main differentiator from automatic hook. ALWAYS verify against current docs.
112
+
113
+ Fetch documentation from official sources:
114
+ - https://react.dev (for React)
115
+ - https://vitejs.dev (for Vite)
116
+
117
+ **Look for:**
118
+
119
+ - Are we using deprecated APIs?
120
+ - Are there newer, better patterns?
121
+ - Did the library's recommendations change since training data?
122
+
123
+ ## Output Format
124
+
125
+ **Simple question** ("is it correct?"):
126
+
127
+ ```text
128
+ **Correctness:** ✓ Logic is sound, edge cases handled, no obvious errors.
129
+ ```
130
+
131
+ **Full review** ("double check and critique"):
132
+
133
+ ```markdown
134
+ ## Quality Review
135
+
136
+ **Correctness:** [✓/⚠️/❌] [Brief assessment]
137
+ **Anti-Bloat:** [✓/⚠️/❌] [Brief assessment]
138
+ **Elegance:** [✓/⚠️/❌] [Brief assessment]
139
+ **Standards:** [✓/⚠️/❌] [Brief assessment]
140
+ **Versions:** [✓/⚠️/❌] [Latest version check with WebSearch]
141
+ **Documentation:** [✓/⚠️/❌] [Current docs check with WebFetch]
142
+
143
+ **Verdict:** [APPROVE / REQUEST CHANGES / NEEDS DISCUSSION]
144
+
145
+ **Critical issues:** [List or "None"]
146
+ **Suggested improvements:** [List or "None"]
147
+ ```
148
+
149
+ ## Critical Reminders
150
+
151
+ 1. **Primary value: Web research** - Verify against current ecosystem (versions, docs, security)
152
+ 2. **Complement automatic hook** - Hook does fast check with existing knowledge, you do deep dive with web research
153
+ 3. **Explicit triggers matter** - "double check against latest docs", "verify versions", "check security" = invoke web research
154
+ 4. **Always check latest docs** - Verify patterns are current, not outdated
155
+ 5. **Always verify versions** - Flag outdated dependencies
156
+ 6. **Be thorough but concise** - Cover all areas but keep explanations brief
157
+ 7. **Provide actionable feedback** - Specific line numbers, concrete suggestions
158
+ 8. **Clear verdict** - Always end with APPROVE/REQUEST CHANGES/NEEDS DISCUSSION
@@ -0,0 +1,175 @@
1
+ ---
2
+ description: Systematic refactoring with small-step discipline. Use when user says 'refactor', 'clean up', 'restructure', 'extract', 'rename', 'simplify', or mentions code smells. Enforces one change → test → commit cycle. For structural improvements, NOT style/formatting (use /lint). NOT for adding features or fixing bugs.
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Refactoring
7
+
8
+ Improve code structure without changing behavior. One small step at a time.
9
+
10
+ **Iron Law:** ONE REFACTORING → TEST → COMMIT. Never batch changes.
11
+
12
+ ## When to Use
13
+
14
+ Answer IN ORDER. Stop at first match:
15
+
16
+ 1. User says "refactor", "clean up", "restructure"? → Use this skill
17
+ 2. User asks to "extract", "rename", "simplify"? → Use this skill
18
+ 3. Code smell identified? → Use this skill
19
+ 4. User wants to add feature or fix bug? → Skip (use tdd-enforcer)
20
+ 5. User wants formatting/style fixes? → Skip (use /lint)
21
+
22
+ **Code smells** (common triggers):
23
+
24
+ - Duplicated code (same logic in multiple places)
25
+ - Long function (>30 lines, doing too much)
26
+ - Magic numbers/strings (unexplained literals)
27
+ - Deep nesting (>3 levels of indentation)
28
+ - Dead code (unused functions, unreachable branches)
29
+ - Poor naming (unclear what something does)
30
+
31
+ ---
32
+
33
+ ## Phase 1: ASSESS
34
+
35
+ **Is this actually refactoring?**
36
+
37
+ | User Intent | Action |
38
+ | ------------------- | ----------------------------------------------- |
39
+ | "Make this cleaner" | ✓ Refactoring |
40
+ | "Add validation" | ✗ New behavior → tdd-enforcer |
41
+ | "Fix this bug" | ✗ Bug fix → tdd-enforcer or systematic-debugger |
42
+ | "Format this code" | ✗ Style → /lint |
43
+
44
+ **If not refactoring:** Explain and suggest correct approach.
45
+
46
+ ---
47
+
48
+ ## Phase 2: PROTECT
49
+
50
+ **Does the code have tests?**
51
+
52
+ | Coverage | Action |
53
+ | ---------------- | --------------------------------------------- |
54
+ | Well-tested | Skip to Phase 3 |
55
+ | Partial coverage | Add characterization tests for untested parts |
56
+ | No tests | Add characterization tests first |
57
+
58
+ ### Characterization Tests
59
+
60
+ Capture current behavior before refactoring:
61
+
62
+ ```typescript
63
+ // Characterization test - captures ACTUAL behavior
64
+ it('processOrder returns current behavior', () => {
65
+ const result = processOrder({ items: [], user: null });
66
+ // Whatever it returns NOW is the expected value
67
+ expect(result).toEqual({ status: 'empty', total: 0 });
68
+ });
69
+ ```
70
+
71
+ **Purpose:** Safety net, not specification. Test what the code DOES, not what it SHOULD do.
72
+
73
+ ---
74
+
75
+ ## Phase 3: REFACTOR
76
+
77
+ **Iron Law:** ONE refactoring at a time. Run tests after EVERY change.
78
+
79
+ ### Refactoring Catalog
80
+
81
+ **Tier 1 - Always Safe** (no behavior change possible):
82
+
83
+ | Smell | Refactoring | Example |
84
+ | -------------------- | -------------------- | -------------------------------------- |
85
+ | Unclear name | **Rename** | `d` → `discountAmount` |
86
+ | Long function | **Extract Function** | Pull 10 lines into `calculateTax()` |
87
+ | Unnecessary variable | **Inline Variable** | Remove `temp = x; return temp;` |
88
+ | Misplaced code | **Move Function** | Move `validate()` to `Validator` class |
89
+
90
+ **Tier 2 - Safe with Tests** (low risk if tests exist):
91
+
92
+ | Smell | Refactoring | Example |
93
+ | ------------------- | ------------------------- | ------------------------------------------------- |
94
+ | Repeated expression | **Extract Variable** | `order.items.length > 0` → `const hasItems = ...` |
95
+ | Complex conditional | **Decompose Conditional** | Extract `if` branches to named functions |
96
+ | Nested conditionals | **Guard Clauses** | Early returns instead of deep nesting |
97
+ | Magic literal | **Replace Magic Literal** | `0.2` → `VIP_DISCOUNT_RATE` |
98
+ | Unused code | **Remove Dead Code** | Delete unreachable branches |
99
+
100
+ **Tier 3 - Requires Care** (higher risk, break into smaller steps):
101
+
102
+ | Smell | Refactoring | Caution |
103
+ | -------------------------- | ------------------------------ | ------------------------------------------- |
104
+ | God class | **Extract Class** | Do incrementally, move one method at a time |
105
+ | Type-checking conditionals | **Replace with Polymorphism** | Requires class hierarchy |
106
+ | Too many parameters | **Introduce Parameter Object** | Changes function signature |
107
+
108
+ **Tie-breaker:** If multiple refactorings apply, choose smallest scope first (Rename < Extract Variable < Extract Function < Extract Class).
109
+
110
+ ---
111
+
112
+ ## Phase 4: VERIFY
113
+
114
+ After each refactoring:
115
+
116
+ 1. **Run tests** - Must pass
117
+ 2. **If tests pass:** Commit with `refactor: [what changed]`
118
+ 3. **If tests fail:** Revert immediately
119
+
120
+ ### Revert Protocol
121
+
122
+ ```bash
123
+ git checkout -- <changed-files>
124
+ ```
125
+
126
+ **After revert:**
127
+
128
+ - Was the refactoring too large? → Try smaller step
129
+ - Did it accidentally change behavior? → Reconsider approach
130
+ - DO NOT attempt to "fix" a failed refactoring
131
+
132
+ ### After 2 Failed Attempts
133
+
134
+ **STOP.** Ask user:
135
+
136
+ > "I've attempted this refactoring twice and tests keep failing. This suggests either:
137
+ >
138
+ > 1. The refactoring is too large (need smaller steps)
139
+ > 2. The code has hidden dependencies
140
+ > 3. Tests are brittle
141
+ >
142
+ > How would you like to proceed?"
143
+
144
+ ---
145
+
146
+ ## Phase 5: ITERATE
147
+
148
+ ```text
149
+ More refactoring needed?
150
+ ├─ Yes → Return to Phase 3 (one more refactoring)
151
+ └─ No → Done
152
+ └─ Report: "Refactoring complete. Changes: [summary]"
153
+ ```
154
+
155
+ ---
156
+
157
+ ## Anti-Patterns
158
+
159
+ | Don't | Do |
160
+ | ------------------------------- | ------------------------------------- |
161
+ | Batch multiple refactorings | One refactoring → test → commit |
162
+ | "Fix" a failed refactoring | Revert, then try smaller step |
163
+ | Refactor without tests | Add characterization tests first |
164
+ | Change behavior during refactor | That's a feature/fix, not refactoring |
165
+ | Skip the commit | Commit after every green test |
166
+
167
+ ---
168
+
169
+ ## Key Takeaways
170
+
171
+ 1. **One change at a time** - Never batch refactorings
172
+ 2. **Tests before refactoring** - No safety net = no refactoring
173
+ 3. **Revert on failure** - Don't fix, revert and retry smaller
174
+ 4. **Commit after each success** - `refactor: [description]`
175
+ 5. **Smallest scope first** - Rename < Extract < Move < Restructure
File without changes
@@ -0,0 +1,210 @@
1
+ ---
2
+ name: brainstorming
3
+ description: Use before implementation when refining rough ideas into specs. Guides collaborative design through Socratic questioning, alternative exploration, and incremental validation. Triggers: 'brainstorm', 'design', 'explore options', 'figure out', 'think through', 'what approach'.
4
+ allowed-tools: '*'
5
+ ---
6
+
7
+ # Brainstorming Ideas Into Specs
8
+
9
+ Turn rough ideas into validated specs through Socratic dialogue.
10
+
11
+ **Iron Law:** ONE QUESTION AT A TIME. EXPLORE ALTERNATIVES BEFORE DECIDING.
12
+
13
+ ## When to Use
14
+
15
+ Answer IN ORDER. Stop at first match:
16
+
17
+ 1. Rough idea needs refinement? → Use this skill
18
+ 2. Multiple approaches possible? → Use this skill
19
+ 3. Unclear requirements? → Use this skill
20
+ 4. Clear task, obvious approach? → Skip (use enforcing-tdd directly)
21
+ 5. Pure research/investigation? → Skip
22
+
23
+ ---
24
+
25
+ ## Phase 1: CONTEXT
26
+
27
+ **Purpose:** Understand what exists before asking questions.
28
+
29
+ **Protocol:**
30
+
31
+ 1. Check project state (files, recent commits, existing specs)
32
+ 2. Review relevant docs in `.safeword/planning/`
33
+ 3. Identify constraints and patterns already established
34
+
35
+ **Exit Criteria:**
36
+
37
+ - [ ] Reviewed relevant codebase areas
38
+ - [ ] Checked existing specs/designs
39
+ - [ ] Ready to ask informed questions
40
+
41
+ ---
42
+
43
+ ## Phase 2: QUESTION
44
+
45
+ **Iron Law:** ONE QUESTION PER MESSAGE
46
+
47
+ **Protocol:**
48
+
49
+ 1. Ask one focused question
50
+ 2. Prefer multiple choice (2-4 options) when possible
51
+ 3. Open-ended is fine for exploratory topics
52
+ 4. Focus on: purpose, constraints, success criteria, scope
53
+
54
+ **Question Types (in order of preference):**
55
+
56
+ | Type | When | Example |
57
+ | --------------- | ----------------------- | ---------------------------------------------------- |
58
+ | Multiple choice | Clear options exist | "Should this be (A) real-time or (B) polling-based?" |
59
+ | Yes/No | Binary decision | "Do we need offline support?" |
60
+ | Bounded open | Need specifics | "What's the max number of items to display?" |
61
+ | Open-ended | Exploring problem space | "What problem are you trying to solve?" |
62
+
63
+ **Exit Criteria:**
64
+
65
+ - [ ] Understand the core problem/goal
66
+ - [ ] Know key constraints
67
+ - [ ] Have success criteria
68
+ - [ ] Scope boundaries are clear
69
+
70
+ ---
71
+
72
+ ## Phase 3: ALTERNATIVES
73
+
74
+ **Iron Law:** ALWAYS PRESENT 2-3 OPTIONS BEFORE DECIDING
75
+
76
+ **Protocol:**
77
+
78
+ 1. Present 2-3 approaches with trade-offs
79
+ 2. Lead with your recommendation and why
80
+ 3. Be explicit about what each gives up
81
+ 4. Let user choose (or suggest hybrid)
82
+
83
+ **Format:**
84
+
85
+ ```text
86
+ I'd recommend Option A because [reason].
87
+
88
+ **Option A: [Name]**
89
+ - Approach: [how it works]
90
+ - Pros: [benefits]
91
+ - Cons: [drawbacks]
92
+
93
+ **Option B: [Name]**
94
+ - Approach: [how it works]
95
+ - Pros: [benefits]
96
+ - Cons: [drawbacks]
97
+
98
+ **Option C: [Name]** (if applicable)
99
+ - Approach: [how it works]
100
+ - Pros: [benefits]
101
+ - Cons: [drawbacks]
102
+
103
+ Which direction feels right?
104
+ ```
105
+
106
+ **Exit Criteria:**
107
+
108
+ - [ ] Presented 2-3 viable approaches
109
+ - [ ] Gave clear recommendation with reasoning
110
+ - [ ] User selected approach (or hybrid)
111
+
112
+ ---
113
+
114
+ ## Phase 4: DESIGN
115
+
116
+ **Iron Law:** PRESENT IN 200-300 WORD SECTIONS. VALIDATE EACH.
117
+
118
+ **Protocol:**
119
+
120
+ 1. Present design incrementally (not all at once)
121
+ 2. After each section: "Does this look right so far?"
122
+ 3. Cover: architecture, components, data flow, error handling
123
+ 4. Apply YAGNI ruthlessly - remove anything "just in case"
124
+ 5. Go back and clarify when something doesn't fit
125
+
126
+ **Sections (present one at a time):**
127
+
128
+ 1. **Overview** - What we're building, high-level approach
129
+ 2. **Components** - Key pieces and responsibilities
130
+ 3. **Data Flow** - How data moves through system
131
+ 4. **Edge Cases** - Error handling, boundaries
132
+ 5. **Out of Scope** - What we're explicitly NOT doing
133
+
134
+ **Exit Criteria:**
135
+
136
+ - [ ] Each section validated by user
137
+ - [ ] Design is complete and coherent
138
+ - [ ] YAGNI applied (no speculative features)
139
+ - [ ] Ready to create spec
140
+
141
+ ---
142
+
143
+ ## Phase 5: SPEC
144
+
145
+ **Purpose:** Convert validated design into structured spec.
146
+
147
+ **Protocol:**
148
+
149
+ 1. Determine level (L0/L1/L2) using triage questions
150
+ 2. Create spec using appropriate template
151
+ 3. Commit the spec
152
+
153
+ **Triage:**
154
+
155
+ | Question | If Yes → |
156
+ | ---------------------------------------- | ---------------------------- |
157
+ | User-facing feature with business value? | **L2** → Feature Spec |
158
+ | Bug, improvement, internal, or refactor? | **L1** → Task Spec |
159
+ | Typo, config, or trivial change? | **L0** → Task Spec (minimal) |
160
+
161
+ **Output Locations:**
162
+
163
+ - L2: `.safeword/planning/specs/feature-[slug].md`
164
+ - L1/L0: `.safeword/planning/specs/task-[slug].md`
165
+ - L2 Test Defs: `.safeword/planning/test-definitions/feature-[slug].md`
166
+
167
+ **Exit Criteria:**
168
+
169
+ - [ ] Spec created in correct location
170
+ - [ ] L2: Test definitions created
171
+ - [ ] Spec committed to git
172
+
173
+ ---
174
+
175
+ ## Phase 6: HANDOFF
176
+
177
+ **Protocol:**
178
+
179
+ 1. Summarize what was created
180
+ 2. Ask: "Ready to start implementation with TDD?"
181
+ 3. If yes → Invoke enforcing-tdd skill
182
+
183
+ **Exit Criteria:**
184
+
185
+ - [ ] User confirmed spec is complete
186
+ - [ ] Handed off to enforcing-tdd (if continuing)
187
+
188
+ ---
189
+
190
+ ## Key Principles
191
+
192
+ | Principle | Why |
193
+ | ----------------------------- | --------------------------------------- |
194
+ | One question at a time | Prevents overwhelm, gets better answers |
195
+ | Multiple choice preferred | Faster to answer, reduces ambiguity |
196
+ | Alternatives before decisions | Avoids premature commitment |
197
+ | Incremental validation | Catches misunderstandings early |
198
+ | YAGNI ruthlessly | Scope creep kills projects |
199
+
200
+ ---
201
+
202
+ ## Anti-Patterns
203
+
204
+ | Don't | Do |
205
+ | ------------------------------ | -------------------------------- |
206
+ | Dump full design at once | Present in 200-300 word sections |
207
+ | Ask 5 questions in one message | Ask ONE question |
208
+ | Skip alternatives | Always present 2-3 options |
209
+ | Accept vague requirements | Probe until concrete |
210
+ | Add "nice to have" features | Put them in "Out of Scope" |
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: systematic-debugger
2
+ name: debugging
3
3
  description: Four-phase debugging framework that ensures root cause identification before fixes. Use when encountering bugs, test failures, unexpected behavior, or when previous fix attempts failed. Enforces investigate-first discipline ('debug this', 'fix this error', 'test is failing', 'not working').
4
4
  allowed-tools: '*'
5
5
  ---
@@ -26,33 +26,6 @@ Answer IN ORDER. Stop at first match:
26
26
  - "Quick fix" seems obvious (red flag)
27
27
  - Already tried 1+ fixes that didn't work
28
28
 
29
- ---
30
-
31
- ## Work Log
32
-
33
- **Think hard. Keep notes.**
34
-
35
- Before starting Phase 1, create or open a work log:
36
-
37
- **Location:** `.safeword/logs/{artifact-type}-{slug}.md`
38
-
39
- | Working on... | Log file name |
40
- | --------------------- | ------------------------ |
41
- | Ticket `001-fix-auth` | `ticket-001-fix-auth.md` |
42
- | Spec `task-add-cache` | `spec-task-add-cache.md` |
43
-
44
- **One artifact = one log.** If log exists, append a new session.
45
-
46
- **Especially important for debugging:**
47
-
48
- 1. **Re-read the log** before each hypothesis
49
- 2. **Log what you tried** and why it didn't work
50
- 3. **Note dead ends** - debugging often revisits same paths
51
-
52
- **Template:** @./.safeword/templates/work-log-template.md
53
-
54
- ---
55
-
56
29
  ## The Four Phases
57
30
 
58
31
  Complete each phase before proceeding.
@@ -220,32 +193,6 @@ If you catch yourself thinking:
220
193
 
221
194
  **ALL mean: STOP. Return to Phase 1.**
222
195
 
223
- ## Finding Test Pollution
224
-
225
- When tests pass individually but fail together (test isolation problem, tests affect each other, tests leave files behind), use bisection:
226
-
227
- ```bash
228
- ./.safeword/scripts/bisect-test-pollution.sh '.git' '*.test.ts' src
229
- ```
230
-
231
- See: @./.safeword/scripts/bisect-test-pollution.sh
232
-
233
- ## Debug Logging
234
-
235
- When adding diagnostic logging:
236
-
237
- ```javascript
238
- // ❌ BAD
239
- console.log('here');
240
- console.log(data);
241
-
242
- // ✅ GOOD
243
- console.log('validateUser', { expected: 'admin', actual: user.role });
244
- console.log('processOrder', JSON.stringify({ input, output }, null, 2));
245
- ```
246
-
247
- Log **expected vs actual**. Remove after fixing.
248
-
249
196
  ## Quick Reference
250
197
 
251
198
  | Phase | Key Question | Success Criteria |
@@ -254,20 +201,3 @@ Log **expected vs actual**. Remove after fixing.
254
201
  | 2. Pattern | "What's different from working code?" | Identified key differences |
255
202
  | 3. Hypothesis | "Is my theory correct?" | Confirmed or formed new theory |
256
203
  | 4. Implementation | "Does the fix work?" | Test passes, issue resolved |
257
-
258
- ## Finding Zombie Process Spawners
259
-
260
- When tests leave processes behind (playwright browsers not cleaned up, port stays in use, zombie node processes, chromium accumulating), use bisection to find the culprit:
261
-
262
- ```bash
263
- ./.safeword/scripts/bisect-zombie-processes.sh 'chromium' '*.test.ts' tests
264
- ./.safeword/scripts/bisect-zombie-processes.sh 'playwright' '*.spec.ts' e2e
265
- ```
266
-
267
- See: @./.safeword/scripts/bisect-zombie-processes.sh
268
-
269
- ## Related Resources
270
-
271
- - Process cleanup guide: @./.safeword/guides/zombie-process-cleanup.md
272
- - Debug logging style: @./.safeword/guides/code-philosophy.md
273
- - TDD for fix verification: @./.safeword/guides/testing-guide.md
@@ -1,6 +1,6 @@
1
1
  ---
2
- name: tdd-enforcer
3
- description: Use when implementing features, fixing bugs, or adding new behavior. Ensures scope is defined before coding, then enforces RED → GREEN → REFACTOR test discipline. NOT for pure refactoring (use refactoring skill for structural improvements without behavior change). Triggers: 'implement', 'add', 'build', 'create', 'fix', 'change', 'feature', 'bug'.
2
+ name: enforcing-tdd
3
+ description: Use when implementing features, fixing bugs, or making code changes. Ensures scope is defined before coding, then enforces RED → GREEN → REFACTOR test discipline. Triggers: 'implement', 'add', 'build', 'create', 'fix', 'change', 'feature', 'bug'.
4
4
  allowed-tools: '*'
5
5
  ---
6
6
 
@@ -17,7 +17,7 @@ Answer IN ORDER. Stop at first match:
17
17
  1. Implementing new feature? → Use this skill
18
18
  2. Fixing bug? → Use this skill
19
19
  3. Adding enhancement? → Use this skill
20
- 4. Refactoring only (no new behavior)? → Skip (use refactoring skill)
20
+ 4. Refactoring? → Use this skill
21
21
  5. Research/investigation only? → Skip this skill
22
22
 
23
23
  ---
@@ -160,15 +160,15 @@ Claim: "All tests pass" "Tests pass" (no output shown)
160
160
 
161
161
  **Red Flags → STOP:**
162
162
 
163
- | Flag | Action |
164
- | --------------------------- | -------------------------------------- |
165
- | "should", "probably" claims | Run command, show output first |
166
- | "Done!" before verification | Run command, show output first |
167
- | "Just in case" code | Delete it |
168
- | Multiple functions | Delete extras |
169
- | Refactoring | Stop - that's Phase 3 |
170
- | Test still fails | Debug (→ systematic-debugger if stuck) |
171
- | Hardcoded value | Implement real logic (see below) |
163
+ | Flag | Action |
164
+ | --------------------------- | ---------------------------------- |
165
+ | "should", "probably" claims | Run command, show output first |
166
+ | "Done!" before verification | Run command, show output first |
167
+ | "Just in case" code | Delete it |
168
+ | Multiple functions | Delete extras |
169
+ | Refactoring | Stop - that's Phase 3 |
170
+ | Test still fails | Debug (→ debugging skill if stuck) |
171
+ | Hardcoded value | Implement real logic (see below) |
172
172
 
173
173
  ### Anti-Pattern: Mock Implementations
174
174
 
@@ -253,11 +253,11 @@ Phase 0: L0 → create minimal spec → Phase 1: no new test (existing tests cov
253
253
 
254
254
  ## Integration
255
255
 
256
- | Scenario | Handoff |
257
- | ----------------------- | --------------------- |
258
- | Test fails unexpectedly | → systematic-debugger |
259
- | Review needed | → quality-reviewer |
260
- | Scope expanding | → Update spec first |
256
+ | Scenario | Handoff |
257
+ | ----------------------- | ------------------- |
258
+ | Test fails unexpectedly | → debugging skill |
259
+ | Review needed | → quality-reviewer |
260
+ | Scope expanding | → Update spec first |
261
261
 
262
262
  ---
263
263