@simplysm/sd-claude 13.0.78 → 13.0.81

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 (68) hide show
  1. package/claude/rules/sd-claude-rules.md +4 -63
  2. package/claude/rules/sd-simplysm-usage.md +7 -0
  3. package/claude/sd-session-start.sh +10 -0
  4. package/claude/sd-statusline.py +249 -0
  5. package/claude/skills/sd-api-review/SKILL.md +89 -0
  6. package/claude/skills/sd-check/SKILL.md +55 -57
  7. package/claude/skills/sd-commit/SKILL.md +37 -42
  8. package/claude/skills/sd-debug/SKILL.md +75 -265
  9. package/claude/skills/sd-document/SKILL.md +63 -53
  10. package/claude/skills/sd-document/_common.py +94 -0
  11. package/claude/skills/sd-document/extract_docx.py +19 -48
  12. package/claude/skills/sd-document/extract_pdf.py +22 -50
  13. package/claude/skills/sd-document/extract_pptx.py +17 -40
  14. package/claude/skills/sd-document/extract_xlsx.py +19 -40
  15. package/claude/skills/sd-email-analyze/SKILL.md +23 -31
  16. package/claude/skills/sd-email-analyze/email-analyzer.py +79 -65
  17. package/claude/skills/sd-init/SKILL.md +133 -0
  18. package/claude/skills/sd-plan/SKILL.md +69 -120
  19. package/claude/skills/sd-readme/SKILL.md +106 -131
  20. package/claude/skills/sd-review/SKILL.md +38 -155
  21. package/claude/skills/sd-simplify/SKILL.md +59 -0
  22. package/dist/commands/install.js +20 -6
  23. package/dist/commands/install.js.map +1 -1
  24. package/package.json +3 -2
  25. package/src/commands/install.ts +29 -7
  26. package/README.md +0 -297
  27. package/claude/refs/sd-angular.md +0 -127
  28. package/claude/refs/sd-code-conventions.md +0 -155
  29. package/claude/refs/sd-directories.md +0 -7
  30. package/claude/refs/sd-library-issue.md +0 -7
  31. package/claude/refs/sd-migration.md +0 -7
  32. package/claude/refs/sd-orm-v12.md +0 -81
  33. package/claude/refs/sd-orm.md +0 -23
  34. package/claude/refs/sd-service.md +0 -5
  35. package/claude/refs/sd-simplysm-docs.md +0 -52
  36. package/claude/refs/sd-solid.md +0 -68
  37. package/claude/refs/sd-workflow.md +0 -25
  38. package/claude/rules/sd-refs-linker.md +0 -52
  39. package/claude/sd-statusline.js +0 -296
  40. package/claude/skills/sd-api-name-review/SKILL.md +0 -154
  41. package/claude/skills/sd-brainstorm/SKILL.md +0 -215
  42. package/claude/skills/sd-debug/condition-based-waiting-example.ts +0 -158
  43. package/claude/skills/sd-debug/condition-based-waiting.md +0 -114
  44. package/claude/skills/sd-debug/defense-in-depth.md +0 -128
  45. package/claude/skills/sd-debug/find-polluter.sh +0 -64
  46. package/claude/skills/sd-debug/root-cause-tracing.md +0 -168
  47. package/claude/skills/sd-discuss/SKILL.md +0 -91
  48. package/claude/skills/sd-explore/SKILL.md +0 -118
  49. package/claude/skills/sd-plan-dev/SKILL.md +0 -294
  50. package/claude/skills/sd-plan-dev/code-quality-reviewer-prompt.md +0 -49
  51. package/claude/skills/sd-plan-dev/final-review-prompt.md +0 -50
  52. package/claude/skills/sd-plan-dev/implementer-prompt.md +0 -60
  53. package/claude/skills/sd-plan-dev/spec-reviewer-prompt.md +0 -45
  54. package/claude/skills/sd-review/api-reviewer-prompt.md +0 -75
  55. package/claude/skills/sd-review/code-reviewer-prompt.md +0 -82
  56. package/claude/skills/sd-review/convention-checker-prompt.md +0 -61
  57. package/claude/skills/sd-review/refactoring-analyzer-prompt.md +0 -92
  58. package/claude/skills/sd-skill/SKILL.md +0 -417
  59. package/claude/skills/sd-skill/anthropic-best-practices.md +0 -156
  60. package/claude/skills/sd-skill/cso-guide.md +0 -161
  61. package/claude/skills/sd-skill/examples/CLAUDE_MD_TESTING.md +0 -200
  62. package/claude/skills/sd-skill/persuasion-principles.md +0 -220
  63. package/claude/skills/sd-skill/testing-skills-with-subagents.md +0 -408
  64. package/claude/skills/sd-skill/writing-guide.md +0 -159
  65. package/claude/skills/sd-tdd/SKILL.md +0 -385
  66. package/claude/skills/sd-tdd/testing-anti-patterns.md +0 -317
  67. package/claude/skills/sd-use/SKILL.md +0 -67
  68. package/claude/skills/sd-worktree/SKILL.md +0 -78
@@ -1,317 +0,0 @@
1
- # Testing Anti-Patterns
2
-
3
- **Load this reference when:** writing or changing tests, adding mocks, or tempted to add test-only methods to production code.
4
-
5
- ## Overview
6
-
7
- Tests must verify real behavior, not mock behavior. Mocks are a means to isolate, not the thing being tested.
8
-
9
- **Core principle:** Test what the code does, not what the mocks do.
10
-
11
- **Following strict TDD prevents these anti-patterns.**
12
-
13
- ## The Iron Laws
14
-
15
- ```
16
- 1. NEVER test mock behavior
17
- 2. NEVER add test-only methods to production classes
18
- 3. NEVER mock without understanding dependencies
19
- ```
20
-
21
- ## Anti-Pattern 1: Testing Mock Behavior
22
-
23
- **The violation:**
24
-
25
- ```typescript
26
- // ❌ BAD: Testing that the mock exists
27
- test('renders sidebar', () => {
28
- render(<Page />);
29
- expect(screen.getByTestId('sidebar-mock')).toBeInTheDocument();
30
- });
31
- ```
32
-
33
- **Why this is wrong:**
34
-
35
- - You're verifying the mock works, not that the component works
36
- - Test passes when mock is present, fails when it's not
37
- - Tells you nothing about real behavior
38
-
39
- **your human partner's correction:** "Are we testing the behavior of a mock?"
40
-
41
- **The fix:**
42
-
43
- ```typescript
44
- // ✅ GOOD: Test real component or don't mock it
45
- test('renders sidebar', () => {
46
- render(<Page />); // Don't mock sidebar
47
- expect(screen.getByRole('navigation')).toBeInTheDocument();
48
- });
49
-
50
- // OR if sidebar must be mocked for isolation:
51
- // Don't assert on the mock - test Page's behavior with sidebar present
52
- ```
53
-
54
- ### Gate Function
55
-
56
- ```
57
- BEFORE asserting on any mock element:
58
- Ask: "Am I testing real component behavior or just mock existence?"
59
-
60
- IF testing mock existence:
61
- STOP - Delete the assertion or unmock the component
62
-
63
- Test real behavior instead
64
- ```
65
-
66
- ## Anti-Pattern 2: Test-Only Methods in Production
67
-
68
- **The violation:**
69
-
70
- ```typescript
71
- // ❌ BAD: destroy() only used in tests
72
- class Session {
73
- async destroy() {
74
- // Looks like production API!
75
- await this._workspaceManager?.destroyWorkspace(this.id);
76
- // ... cleanup
77
- }
78
- }
79
-
80
- // In tests
81
- afterEach(() => session.destroy());
82
- ```
83
-
84
- **Why this is wrong:**
85
-
86
- - Production class polluted with test-only code
87
- - Dangerous if accidentally called in production
88
- - Violates YAGNI and separation of concerns
89
- - Confuses object lifecycle with entity lifecycle
90
-
91
- **The fix:**
92
-
93
- ```typescript
94
- // ✅ GOOD: Test utilities handle test cleanup
95
- // Session has no destroy() - it's stateless in production
96
-
97
- // In test-utils/
98
- export async function cleanupSession(session: Session) {
99
- const workspace = session.getWorkspaceInfo();
100
- if (workspace) {
101
- await workspaceManager.destroyWorkspace(workspace.id);
102
- }
103
- }
104
-
105
- // In tests
106
- afterEach(() => cleanupSession(session));
107
- ```
108
-
109
- ### Gate Function
110
-
111
- ```
112
- BEFORE adding any method to production class:
113
- Ask: "Is this only used by tests?"
114
-
115
- IF yes:
116
- STOP - Don't add it
117
- Put it in test utilities instead
118
-
119
- Ask: "Does this class own this resource's lifecycle?"
120
-
121
- IF no:
122
- STOP - Wrong class for this method
123
- ```
124
-
125
- ## Anti-Pattern 3: Mocking Without Understanding
126
-
127
- **The violation:**
128
-
129
- ```typescript
130
- // ❌ BAD: Mock breaks test logic
131
- test("detects duplicate server", () => {
132
- // Mock prevents config write that test depends on!
133
- vi.mock("ToolCatalog", () => ({
134
- discoverAndCacheTools: vi.fn().mockResolvedValue(undefined),
135
- }));
136
-
137
- await addServer(config);
138
- await addServer(config); // Should throw - but won't!
139
- });
140
- ```
141
-
142
- **Why this is wrong:**
143
-
144
- - Mocked method had side effect test depended on (writing config)
145
- - Over-mocking to "be safe" breaks actual behavior
146
- - Test passes for wrong reason or fails mysteriously
147
-
148
- **The fix:**
149
-
150
- ```typescript
151
- // ✅ GOOD: Mock at correct level
152
- test("detects duplicate server", () => {
153
- // Mock the slow part, preserve behavior test needs
154
- vi.mock("MCPServerManager"); // Just mock slow server startup
155
-
156
- await addServer(config); // Config written
157
- await addServer(config); // Duplicate detected ✓
158
- });
159
- ```
160
-
161
- ### Gate Function
162
-
163
- ```
164
- BEFORE mocking any method:
165
- STOP - Don't mock yet
166
-
167
- 1. Ask: "What side effects does the real method have?"
168
- 2. Ask: "Does this test depend on any of those side effects?"
169
- 3. Ask: "Do I fully understand what this test needs?"
170
-
171
- IF depends on side effects:
172
- Mock at lower level (the actual slow/external operation)
173
- OR use test doubles that preserve necessary behavior
174
- NOT the high-level method the test depends on
175
-
176
- IF unsure what test depends on:
177
- Run test with real implementation FIRST
178
- Observe what actually needs to happen
179
- THEN add minimal mocking at the right level
180
-
181
- Red flags:
182
- - "I'll mock this to be safe"
183
- - "This might be slow, better mock it"
184
- - Mocking without understanding the dependency chain
185
- ```
186
-
187
- ## Anti-Pattern 4: Incomplete Mocks
188
-
189
- **The violation:**
190
-
191
- ```typescript
192
- // ❌ BAD: Partial mock - only fields you think you need
193
- const mockResponse = {
194
- status: "success",
195
- data: { userId: "123", name: "Alice" },
196
- // Missing: metadata that downstream code uses
197
- };
198
-
199
- // Later: breaks when code accesses response.metadata.requestId
200
- ```
201
-
202
- **Why this is wrong:**
203
-
204
- - **Partial mocks hide structural assumptions** - You only mocked fields you know about
205
- - **Downstream code may depend on fields you didn't include** - Silent failures
206
- - **Tests pass but integration fails** - Mock incomplete, real API complete
207
- - **False confidence** - Test proves nothing about real behavior
208
-
209
- **The Iron Rule:** Mock the COMPLETE data structure as it exists in reality, not just fields your immediate test uses.
210
-
211
- **The fix:**
212
-
213
- ```typescript
214
- // ✅ GOOD: Mirror real API completeness
215
- const mockResponse = {
216
- status: "success",
217
- data: { userId: "123", name: "Alice" },
218
- metadata: { requestId: "req-789", timestamp: 1234567890 },
219
- // All fields real API returns
220
- };
221
- ```
222
-
223
- ### Gate Function
224
-
225
- ```
226
- BEFORE creating mock responses:
227
- Check: "What fields does the real API response contain?"
228
-
229
- Actions:
230
- 1. Examine actual API response from docs/examples
231
- 2. Include ALL fields system might consume downstream
232
- 3. Verify mock matches real response schema completely
233
-
234
- Critical:
235
- If you're creating a mock, you must understand the ENTIRE structure
236
- Partial mocks fail silently when code depends on omitted fields
237
-
238
- If uncertain: Include all documented fields
239
- ```
240
-
241
- ## Anti-Pattern 5: Integration Tests as Afterthought
242
-
243
- **The violation:**
244
-
245
- ```
246
- ✅ Implementation complete
247
- ❌ No tests written
248
- "Ready for testing"
249
- ```
250
-
251
- **Why this is wrong:**
252
-
253
- - Testing is part of implementation, not optional follow-up
254
- - TDD would have caught this
255
- - Can't claim complete without tests
256
-
257
- **The fix:**
258
-
259
- ```
260
- TDD cycle:
261
- 1. Write failing test
262
- 2. Implement to pass
263
- 3. Refactor
264
- 4. THEN claim complete
265
- ```
266
-
267
- ## When Mocks Become Too Complex
268
-
269
- **Warning signs:**
270
-
271
- - Mock setup longer than test logic
272
- - Mocking everything to make test pass
273
- - Mocks missing methods real components have
274
- - Test breaks when mock changes
275
-
276
- **your human partner's question:** "Do we need to be using a mock here?"
277
-
278
- **Consider:** Integration tests with real components often simpler than complex mocks
279
-
280
- ## TDD Prevents These Anti-Patterns
281
-
282
- **Why TDD helps:**
283
-
284
- 1. **Write test first** → Forces you to think about what you're actually testing
285
- 2. **Watch it fail** → Confirms test tests real behavior, not mocks
286
- 3. **Minimal implementation** → No test-only methods creep in
287
- 4. **Real dependencies** → You see what the test actually needs before mocking
288
-
289
- **If you're testing mock behavior, you violated TDD** - you added mocks without watching test fail against real code first.
290
-
291
- ## Quick Reference
292
-
293
- | Anti-Pattern | Fix |
294
- | ------------------------------- | --------------------------------------------- |
295
- | Assert on mock elements | Test real component or unmock it |
296
- | Test-only methods in production | Move to test utilities |
297
- | Mock without understanding | Understand dependencies first, mock minimally |
298
- | Incomplete mocks | Mirror real API completely |
299
- | Tests as afterthought | TDD - tests first |
300
- | Over-complex mocks | Consider integration tests |
301
-
302
- ## Red Flags
303
-
304
- - Assertion checks for `*-mock` test IDs
305
- - Methods only called in test files
306
- - Mock setup is >50% of test
307
- - Test fails when you remove mock
308
- - Can't explain why mock is needed
309
- - Mocking "just to be safe"
310
-
311
- ## The Bottom Line
312
-
313
- **Mocks are tools to isolate, not things to test.**
314
-
315
- If TDD reveals you're testing mock behavior, you've gone wrong.
316
-
317
- Fix: Test real behavior or question why you're mocking at all.
@@ -1,67 +0,0 @@
1
- ---
2
- name: sd-use
3
- description: "Route requests to sd-* skills/agents (explicit invocation only)"
4
- model: haiku
5
- ---
6
-
7
- # sd-use - Auto Skill Router
8
-
9
- Analyze user request from ARGUMENTS, select the best matching skill, explain why, then execute it.
10
-
11
- ## Execution Flow
12
-
13
- 1. Read ARGUMENTS
14
- 2. If user names a specific skill, route to that skill directly
15
- 3. Otherwise, match against catalog below
16
- 4. Report selection with reason
17
- 5. Execute immediately
18
-
19
- ## Catalog (execute via `Skill` tool)
20
-
21
- | Skill | When to select |
22
- |----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
23
- | `sd-brainstorm` | New feature, component, or behavior change — **creative work before implementation** |
24
- | `sd-debug` | Bug, test failure, unexpected behavior — **systematic root cause investigation** |
25
- | `sd-tdd` | Implementing a feature or fixing a bug — **before writing code** |
26
- | `sd-plan` | Multi-step task with spec/requirements — **planning before code** |
27
- | `sd-plan-dev` | Already have a plan — **executing implementation plan** |
28
- | `sd-review` | Code review + refactoring analysis — defects, safety, API design, conventions, complexity, duplication, code structure |
29
- | `sd-check` | Verify code — typecheck, lint, tests |
30
- | `sd-commit` | Create a git commit |
31
- | `sd-readme` | Update a package README.md |
32
- | `sd-discuss` | Evaluate code design decisions against industry standards and project conventions |
33
- | `sd-api-name-review` | Review public API naming consistency |
34
- | `sd-worktree` | Start new work in branch isolation |
35
- | `sd-skill` | Create or edit skills |
36
- | `sd-email-analyze` | Analyze, read, or summarize email files (`.eml` or `.msg`) — parsing and attachment extraction |
37
- | `sd-document` | Read or write document files (`.docx`, `.xlsx`, `.pptx`, `.pdf`) — content extraction, creation, data export |
38
-
39
- ## Selection Rules
40
-
41
- 1. **Explicit skill name** — If user mentions a specific skill name, route to that skill directly
42
- 2. Select **exactly one** skill — the most specific match wins
43
- 3. **Review & Refactor**: "find bugs", "review", "refactor", "improve structure", "remove duplication" → `sd-review`
44
- 4. **Sequential requests**: Route to the **first** skill only. After completion, user can invoke the next
45
- 5. If nothing matches, use **default LLM behavior** and handle the request directly
46
- 6. Pass ARGUMENTS through as the skill's input
47
-
48
- ## Report Format
49
-
50
- Before executing, output:
51
-
52
- ```
53
- **Selected**: `{skill-name}`
54
- **Reason**: {one-line explanation}
55
- **Tip**: Next time you can call `/{skill-name} {request}` directly.
56
- ```
57
-
58
- Then execute immediately.
59
-
60
- If no match:
61
-
62
- ```
63
- **Selected**: Default LLM
64
- **Reason**: {one-line explanation}
65
- ```
66
-
67
- Then handle the request directly.
@@ -1,78 +0,0 @@
1
- ---
2
- name: sd-worktree
3
- description: "Git worktree branch isolation (explicit invocation only)"
4
- model: haiku
5
- ---
6
-
7
- # sd-worktree
8
-
9
- Branch-isolated workflow using git worktrees.
10
-
11
- ## Flow
12
-
13
- ```mermaid
14
- flowchart TD
15
- START([sd-worktree invoked]) --> ADD
16
-
17
- subgraph ADD [add]
18
- A1["git worktree add .worktrees/NAME -b NAME"]
19
- A1 -->|fail| HALT
20
- A1 -->|ok| A2[detect package manager]
21
- A2 --> A3["pm install (cwd: .worktrees/NAME)"]
22
- A3 -->|fail| HALT
23
- A3 -->|ok| A4["cd .worktrees/NAME"]
24
- end
25
-
26
- A4 --> WORK["work + commit inside worktree"]
27
- WORK --> MERGE
28
-
29
- subgraph MERGE [merge]
30
- M0["cd PROJECT_ROOT"]
31
- M0 --> M1["git merge NAME --no-ff (cwd: PROJECT_ROOT)"]
32
- M1 -->|fail| HALT
33
- M1 -->|ok| M2[merge complete]
34
- end
35
-
36
- M2 --> CLEAN
37
-
38
- subgraph CLEAN [clean]
39
- C1{"cwd inside worktree?"}
40
- C1 -->|yes| HALT
41
- C1 -->|no| C2["rm -rf .worktrees/NAME (bash)"]
42
- C2 --> C3["git worktree prune"]
43
- C3 --> C4["git branch -d NAME"]
44
- C4 -->|fail| HALT
45
- C4 -->|ok| C5[done]
46
- end
47
-
48
- HALT([HALT - AskUserQuestion])
49
- ```
50
-
51
- ## Rules
52
-
53
- ### HALT
54
-
55
- When any step reaches **fail** or **HALT**:
56
-
57
- 1. Show the error message to the user as-is
58
- 2. Ask the user how to proceed via `AskUserQuestion`
59
- 3. Do **nothing** until the user responds
60
-
61
- Manual git merge, git stash, git reset, git clean, or **any workaround is forbidden**. Yolo mode does NOT override HALT.
62
-
63
- ### Worktree location
64
-
65
- All worktrees MUST be created under **`.worktrees/`** (project root).
66
-
67
- ### Package manager detection
68
-
69
- | File | PM |
70
- |---|---|
71
- | `pnpm-lock.yaml` | pnpm |
72
- | `yarn.lock` | yarn |
73
- | `package-lock.json` | npm |
74
- | `bun.lockb` / `bun.lock` | bun |
75
-
76
- ### clean: use rm -rf
77
-
78
- `git worktree remove` almost always fails on Windows due to file locks. Use `rm -rf` (bash) + `git worktree prune` instead.