@anionzo/skill 1.4.0 → 1.7.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 (57) hide show
  1. package/CONTRIBUTING.md +2 -1
  2. package/README.md +82 -24
  3. package/docs/design-brief.md +17 -13
  4. package/docs/knowledge-spec.md +1 -0
  5. package/i18n/CONTRIBUTING.vi.md +2 -1
  6. package/i18n/README.vi.md +82 -24
  7. package/i18n/design-brief.vi.md +17 -13
  8. package/i18n/knowledge-spec.vi.md +1 -0
  9. package/knowledge/global/skill-triggering-rules.md +3 -2
  10. package/package.json +1 -1
  11. package/scripts/install-opencode-skills +197 -35
  12. package/skills/brainstorming/SKILL.md +176 -13
  13. package/skills/brainstorming/meta.yaml +18 -10
  14. package/skills/code-review/SKILL.md +214 -19
  15. package/skills/code-review/meta.yaml +21 -9
  16. package/skills/commit/SKILL.md +187 -0
  17. package/skills/commit/examples.md +62 -0
  18. package/skills/commit/meta.yaml +29 -0
  19. package/skills/commit/references/output-template.md +14 -0
  20. package/skills/debug/SKILL.md +252 -0
  21. package/skills/debug/examples.md +83 -0
  22. package/skills/debug/meta.yaml +39 -0
  23. package/skills/debug/references/output-template.md +16 -0
  24. package/skills/docs-writer/SKILL.md +85 -10
  25. package/skills/docs-writer/meta.yaml +18 -13
  26. package/skills/extract/SKILL.md +201 -0
  27. package/skills/extract/examples.md +47 -0
  28. package/skills/extract/meta.yaml +33 -0
  29. package/skills/extract/references/output-template.md +24 -0
  30. package/skills/feature-delivery/SKILL.md +12 -5
  31. package/skills/feature-delivery/meta.yaml +6 -1
  32. package/skills/planning/SKILL.md +146 -17
  33. package/skills/planning/meta.yaml +19 -7
  34. package/skills/refactor-safe/SKILL.md +10 -7
  35. package/skills/research/SKILL.md +130 -0
  36. package/skills/research/examples.md +79 -0
  37. package/skills/research/meta.yaml +31 -0
  38. package/skills/research/references/output-template.md +23 -0
  39. package/skills/test-driven-development/SKILL.md +194 -0
  40. package/skills/test-driven-development/examples.md +77 -0
  41. package/skills/test-driven-development/meta.yaml +31 -0
  42. package/skills/test-driven-development/references/.gitkeep +0 -0
  43. package/skills/test-driven-development/references/output-template.md +31 -0
  44. package/skills/using-skills/SKILL.md +33 -17
  45. package/skills/using-skills/examples.md +20 -5
  46. package/skills/using-skills/meta.yaml +7 -4
  47. package/skills/verification-before-completion/SKILL.md +127 -13
  48. package/skills/verification-before-completion/meta.yaml +23 -14
  49. package/templates/SKILL.md +8 -1
  50. package/skills/bug-triage/SKILL.md +0 -47
  51. package/skills/bug-triage/examples.md +0 -68
  52. package/skills/bug-triage/meta.yaml +0 -25
  53. package/skills/bug-triage/references/output-template.md +0 -26
  54. package/skills/repo-onboarding/SKILL.md +0 -52
  55. package/skills/repo-onboarding/examples.md +0 -115
  56. package/skills/repo-onboarding/meta.yaml +0 -23
  57. package/skills/repo-onboarding/references/output-template.md +0 -24
@@ -0,0 +1,252 @@
1
+ # Debug
2
+
3
+ ## Purpose
4
+
5
+ Systematically diagnose and fix errors through structured investigation, root cause analysis, and verified resolution.
6
+
7
+ This skill exists to prevent fixing symptoms without understanding root causes, and to enforce the discipline of evidence-based debugging over guesswork.
8
+
9
+ ## When To Use
10
+
11
+ Load this skill when:
12
+
13
+ - a build fails (compilation, type error, missing dependency)
14
+ - a test fails (assertion mismatch, timeout, flaky)
15
+ - a runtime crash or exception occurs
16
+ - an integration failure happens (API mismatch, env config, auth)
17
+ - a user reports a bug or regression
18
+ - a task is blocked with unclear cause
19
+ - the user says "debug this", "fix this error", "why is this failing", or "investigate this"
20
+
21
+ ## The Iron Law
22
+
23
+ ```
24
+ NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
25
+ ```
26
+
27
+ If you have not completed Phase 1, you cannot propose fixes. Symptom fixes are failure.
28
+
29
+ ## The Four Phases
30
+
31
+ You MUST complete each phase before proceeding to the next.
32
+
33
+ ### Phase 1: Investigate — Find the Root Cause
34
+
35
+ **BEFORE attempting ANY fix:**
36
+
37
+ #### 1a. Classify the Issue
38
+
39
+ Classify before investigating. Misclassifying wastes time.
40
+
41
+ | Type | Signals |
42
+ |---|---|
43
+ | **Build failure** | Compilation error, type error, missing module, bundler failure |
44
+ | **Test failure** | Assertion mismatch, snapshot diff, timeout, flaky intermittent |
45
+ | **Runtime error** | Crash, uncaught exception, undefined behavior |
46
+ | **Integration failure** | HTTP 4xx/5xx, env variable missing, API schema mismatch |
47
+ | **Blocked task** | Circular dependency, conflicting changes, unclear requirement |
48
+
49
+ **Output:** One-line classification: `[TYPE] in [component]: [symptom]`
50
+
51
+ #### 1b. Reproduce
52
+
53
+ Run the exact failing command verbatim:
54
+
55
+ ```bash
56
+ <failing-command> 2>&1
57
+ ```
58
+
59
+ - Capture error output verbatim. Exact line numbers and messages matter.
60
+ - Run twice — if intermittent, classify as flaky (check shared state, race conditions, test ordering).
61
+ - If the command cannot be reproduced, note that explicitly and gather more data. Do not guess.
62
+
63
+ #### 1c. Read Implicated Files
64
+
65
+ Read exactly the files mentioned in the error output. Do not read the entire codebase.
66
+
67
+ #### 1d. Check Recent Changes
68
+
69
+ ```bash
70
+ git log --oneline -10
71
+ git diff HEAD~3 -- <failing-file>
72
+ ```
73
+
74
+ If a recent commit introduced the failure, the fix is likely adjusting that change.
75
+
76
+ #### 1e. Multi-Component Diagnostics
77
+
78
+ When the system has multiple components (CI -> build -> deploy, API -> service -> database):
79
+
80
+ Add diagnostic instrumentation at EACH component boundary BEFORE proposing fixes:
81
+
82
+ ```
83
+ For EACH component boundary:
84
+ - Log what data enters the component
85
+ - Log what data exits the component
86
+ - Verify environment/config propagation
87
+ - Check state at each layer
88
+
89
+ Run once to gather evidence showing WHERE it breaks
90
+ THEN analyze evidence to identify the failing component
91
+ THEN investigate that specific component
92
+ ```
93
+
94
+ #### 1f. Narrow to Root Cause
95
+
96
+ Write a one-sentence root cause:
97
+
98
+ > Root cause: `<file>:<line>` — `<what is wrong and why>`
99
+
100
+ **If you cannot write this sentence, you do not have the root cause yet. Do NOT proceed to Phase 2.**
101
+
102
+ ### Phase 2: Analyze — Find the Pattern
103
+
104
+ #### 2a. Find Working Examples
105
+
106
+ Locate similar working code in the same codebase. What works that is similar to what is broken?
107
+
108
+ #### 2b. Compare Against References
109
+
110
+ If implementing a pattern, read the reference implementation COMPLETELY. Do not skim.
111
+
112
+ #### 2c. Identify Differences
113
+
114
+ What is different between working and broken? List every difference, however small. Do not assume "that can't matter."
115
+
116
+ #### 2d. Form Hypothesis
117
+
118
+ State clearly: "I think X is the root cause because Y."
119
+
120
+ Be specific, not vague. Write it down.
121
+
122
+ ### Phase 3: Fix — Implement and Verify
123
+
124
+ #### 3a. Small Fix (1-3 files, obvious change)
125
+
126
+ - Implement directly
127
+ - Run verification immediately
128
+
129
+ #### 3b. Substantial Fix (cross-cutting, logic redesign)
130
+
131
+ - Consider whether the fix needs its own plan (hand off to `planning`)
132
+ - Document the root cause and fix approach before implementing
133
+
134
+ #### 3c. Verify the Fix
135
+
136
+ Run the exact command that originally failed. It must pass cleanly:
137
+
138
+ ```bash
139
+ <original-failing-command>
140
+ ```
141
+
142
+ Also run broader checks for regressions:
143
+
144
+ ```bash
145
+ # Project-specific build/test/lint — adapt to your project
146
+ ```
147
+
148
+ **If verification fails, return to Phase 1 with new information. Do NOT report success.**
149
+
150
+ #### 3d. Escalation: 3+ Failed Fixes
151
+
152
+ Count how many fixes you have attempted.
153
+
154
+ - **< 3 fixes failed:** Return to Phase 1, re-analyze with new information.
155
+ - **>= 3 fixes failed: STOP.** Question the architecture.
156
+
157
+ Signs of an architectural problem:
158
+
159
+ - Each fix reveals new shared state, coupling, or problems in different places
160
+ - Fixes require "massive refactoring" to implement
161
+ - Each fix creates new symptoms elsewhere
162
+
163
+ **Stop and discuss with the user before attempting more fixes.** This is not a failed hypothesis — this is a wrong architecture.
164
+
165
+ ### Phase 4: Learn — Capture the Pattern
166
+
167
+ Ask: would knowing this save 15+ minutes in a future session?
168
+
169
+ If yes, document the pattern:
170
+
171
+ ```markdown
172
+ ## [Classification]
173
+
174
+ **Root cause:** [one sentence]
175
+ **Signal:** [how to recognize this pattern]
176
+ **Fix:** [what resolves it]
177
+ ```
178
+
179
+ Consider handing off to `extract` for significant learnings.
180
+
181
+ ## Quick Reference
182
+
183
+ | Situation | First action |
184
+ |---|---|
185
+ | Build fails | `git log --oneline -10` — check recent changes |
186
+ | Test fails | Run test verbatim, capture exact assertion output |
187
+ | Flaky test | Run 5x — if intermittent, check shared state/ordering |
188
+ | Runtime crash | Read stack trace top-to-bottom, find first line in your code |
189
+ | Integration error | Check env vars, then API response body (not just status code) |
190
+ | Bug report | Restate symptom, then reproduce or explain why reproduction is blocked |
191
+ | 3+ fixes failed | Stop fixing. Question the architecture. |
192
+
193
+ ## Output Format
194
+
195
+ Present results using the Shared Output Contract:
196
+
197
+ 1. **Goal/Result** — what was debugged and whether it is fixed
198
+ 2. **Key Details:**
199
+ - classification and root cause (one-line each)
200
+ - reproduction status
201
+ - what was changed to fix it
202
+ - verification result (pass/fail)
203
+ - number of fix attempts if > 1
204
+ - whether a learning was captured
205
+ 3. **Next Action** — only when a natural follow-up exists:
206
+ - fix applied → resume implementation with `feature-delivery`
207
+ - fix revealed a pattern → `extract`
208
+ - fix needs review → `code-review`
209
+ - fix is non-trivial → `planning` before implementation
210
+ - 3+ fixes failed → discuss architecture with user
211
+
212
+ ## Common Rationalizations
213
+
214
+ | Excuse | Reality |
215
+ |--------|---------|
216
+ | "Issue is simple, don't need process" | Simple issues have root causes too. Process is fast for simple bugs. |
217
+ | "Emergency, no time for process" | Systematic debugging is FASTER than guess-and-check thrashing. |
218
+ | "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
219
+ | "I see the problem, let me fix it" | Seeing symptoms is not understanding root cause. |
220
+ | "One more fix attempt" (after 2+ failures) | 3+ failures signals architectural problem. Question the pattern. |
221
+ | "Quick fix for now, investigate later" | Later never comes. Fix properly now. |
222
+
223
+ ## Red Flags
224
+
225
+ - fixing symptoms without identifying root cause
226
+ - skipping reproduction — diagnosing from error message alone
227
+ - guessing the fix without reading the implicated code
228
+ - proposing fixes before tracing data flow
229
+ - committing a fix without running verification
230
+ - proposing a rewrite before understanding the current failure
231
+ - changing many files before narrowing the cause
232
+ - not capturing a learning when the fix took more than 15 minutes to find
233
+ - declaring "should work now" without running the failing command again
234
+ - attempting fix #4+ without questioning the architecture
235
+
236
+ ## Checklist
237
+
238
+ - [ ] Issue classified (one-line)
239
+ - [ ] Reproduced with exact command
240
+ - [ ] Implicated files read
241
+ - [ ] Recent changes checked
242
+ - [ ] Root cause identified (one sentence with file:line)
243
+ - [ ] Working example compared (if applicable)
244
+ - [ ] Fix applied
245
+ - [ ] Fix verified (original command passes)
246
+ - [ ] Regression check run
247
+ - [ ] Fix attempt count tracked (escalate at 3+)
248
+ - [ ] Learning captured (if pattern is new/useful)
249
+
250
+ ## Done Criteria
251
+
252
+ This skill is complete when the root cause is identified, the fix is verified with the originally failing command, and a regression check has been run. If 3+ fixes have failed, the skill is complete when the architectural concern has been raised with the user. If the fix cannot be completed, the skill is complete when the root cause and blocker are documented.
@@ -0,0 +1,83 @@
1
+ # Examples
2
+
3
+ ## Example 1
4
+
5
+ User request:
6
+
7
+ ```text
8
+ The build is failing after the last merge.
9
+ ```
10
+
11
+ Expected result:
12
+
13
+ - classify the issue
14
+ - reproduce the failure
15
+ - narrow to root cause
16
+ - fix and verify
17
+
18
+ Sample completed output:
19
+
20
+ ```
21
+ Goal/Result: Build failure debugged and fixed.
22
+
23
+ Key Details:
24
+ Classification: [Build failure] in auth module: missing import after merge
25
+
26
+ Root cause: src/auth/index.ts:15 — import references
27
+ `refreshToken` from ./providers but the function was renamed to
28
+ `refreshAccessToken` in PR #142 (merged 2h ago).
29
+
30
+ Fix applied: Updated import in src/auth/index.ts:15
31
+ - Before: import { refreshToken } from './providers'
32
+ - After: import { refreshAccessToken } from './providers'
33
+
34
+ Verification:
35
+ - npm run build — PASS
36
+ - npm test — PASS (42/42)
37
+
38
+ Learning: Rename refactors should use project-wide find-replace.
39
+ This pattern has caused 3 build failures in the last month.
40
+
41
+ Next Action: commit — fix is verified and ready.
42
+ ```
43
+
44
+ ## Example 2
45
+
46
+ User request:
47
+
48
+ ```text
49
+ Tests are flaky — sometimes pass, sometimes fail.
50
+ ```
51
+
52
+ Expected result:
53
+
54
+ - reproduce intermittent failure
55
+ - identify shared state or race condition
56
+ - fix and verify stability
57
+
58
+ Sample completed output:
59
+
60
+ ```
61
+ Goal/Result: Flaky test diagnosed and fixed.
62
+
63
+ Key Details:
64
+ Classification: [Test failure] in user service: intermittent assertion
65
+ failure on test ordering
66
+
67
+ Reproduction: Ran 5 times — failed 2/5. Failures occur when
68
+ "create user" test runs before "list users" test.
69
+
70
+ Root cause: tests/user.test.ts:45 — tests share a database
71
+ connection without cleanup. "list users" test returns results
72
+ from "create user" test when run order is alphabetical.
73
+
74
+ Fix applied: Added beforeEach() cleanup hook to reset test
75
+ database state between tests.
76
+
77
+ Verification: Ran 10 times — 10/10 PASS.
78
+
79
+ Learning captured: Test isolation pattern — always clean up
80
+ shared state in beforeEach, not afterAll.
81
+
82
+ Next Action: commit
83
+ ```
@@ -0,0 +1,39 @@
1
+ name: debug
2
+ version: 0.2.0
3
+ category: troubleshooting
4
+ summary: 4-phase systematic debugging with root cause investigation, multi-component diagnostics, and 3+ fix escalation.
5
+ summary_vi: "Gỡ lỗi hệ thống 4 giai đoạn với điều tra nguyên nhân gốc, chẩn đoán đa thành phần, và leo thang khi 3+ lần sửa thất bại."
6
+ triggers:
7
+ - debug this error
8
+ - fix this failure
9
+ - why is this failing
10
+ - diagnose this issue
11
+ - investigate this error
12
+ - debug this regression
13
+ - failing test or production issue
14
+ inputs:
15
+ - error message or stack trace
16
+ - failing command
17
+ - bug report or reproduction steps
18
+ - optional task context
19
+ outputs:
20
+ - classification
21
+ - root cause with file:line
22
+ - verified fix
23
+ - fix attempt count
24
+ - learning captured
25
+ constraints:
26
+ - no fixes without root cause investigation first
27
+ - must reproduce before diagnosing
28
+ - must verify fix before declaring success
29
+ - escalate at 3+ failed fix attempts
30
+ related_skills:
31
+ - using-skills
32
+ - planning
33
+ - feature-delivery
34
+ - extract
35
+ - code-review
36
+ - commit
37
+ - verification-before-completion
38
+ - test-driven-development
39
+ - extract
@@ -0,0 +1,16 @@
1
+ ## Goal/Result
2
+
3
+ - What was debugged:
4
+ - Fix status:
5
+
6
+ ## Key Details
7
+
8
+ - Classification:
9
+ - Root cause:
10
+ - Fix applied:
11
+ - Verification result:
12
+ - Learning captured:
13
+
14
+ ## Next Action
15
+
16
+ - Recommended follow-up:
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Purpose
4
4
 
5
- Keep documentation aligned with how the system actually works.
5
+ Keep documentation aligned with how the system actually works. Support both full document creation and targeted section editing.
6
6
 
7
7
  ## When To Use
8
8
 
@@ -13,22 +13,83 @@ Load this skill when writing or updating:
13
13
  - runbooks
14
14
  - API usage notes
15
15
  - project operating instructions
16
+ - architecture diagrams
17
+ - any documentation that should stay in sync with code
16
18
 
17
19
  ## Workflow
18
20
 
19
21
  1. Confirm the target audience and document purpose.
20
22
  2. Verify current behavior from source, commands, or config before writing.
21
- 3. Update only the sections that need to change.
22
- 4. Prefer concise instructions, examples, and commands over long prose.
23
- 5. Call out assumptions or areas that still need verification.
23
+ 3. Determine scope: full document or section edit.
24
+ 4. For section edits, update only the sections that need to change — do not rewrite the entire document.
25
+ 5. Prefer concise instructions, examples, and commands over long prose.
26
+ 6. Use diagrams (mermaid) for complex flows or architecture.
27
+ 7. Call out assumptions or areas that still need verification.
28
+
29
+ ## Section Editing
30
+
31
+ For targeted updates, prefer editing specific sections rather than rewriting the full document:
32
+
33
+ 1. Identify which section(s) need updating.
34
+ 2. Read the current section content.
35
+ 3. Update only the affected section while preserving surrounding structure.
36
+ 4. Verify the update does not break references or flow.
37
+
38
+ This is more efficient and less error-prone than full document rewrites.
39
+
40
+ ## Mermaid Diagrams
41
+
42
+ Use mermaid diagrams for:
43
+ - Architecture diagrams
44
+ - Flowcharts
45
+ - Sequence diagrams
46
+ - Entity relationships
47
+ - Decision trees
48
+
49
+ ````markdown
50
+ ```mermaid
51
+ graph TD
52
+ A[Start] --> B{Decision}
53
+ B -->|Yes| C[Action]
54
+ B -->|No| D[End]
55
+ ```
56
+ ````
57
+
58
+ ````markdown
59
+ ```mermaid
60
+ sequenceDiagram
61
+ Client->>Server: Request
62
+ Server->>DB: Query
63
+ DB-->>Server: Result
64
+ Server-->>Client: Response
65
+ ```
66
+ ````
67
+
68
+ Diagrams render in GitHub, most doc platforms, and many editor previews. Use them when a text description would be confusing.
24
69
 
25
70
  ## Output Format
26
71
 
27
- - target document
28
- - audience
29
- - what changed
30
- - source of truth used
31
- - assumptions or follow-ups
72
+ Present results using the Shared Output Contract:
73
+
74
+ 1. **Goal/Result** — what document was created, updated, or inspected
75
+ 2. **Key Details:**
76
+ - target document and audience
77
+ - what changed (or what was created)
78
+ - source of truth used for verification
79
+ - whether section edit or full rewrite
80
+ - assumptions or follow-ups
81
+ 3. **Next Action** — only when a natural follow-up exists:
82
+ - if doc reveals code issues → `debug`
83
+ - if doc is part of feature work → `verification-before-completion`
84
+
85
+ ## Documentation Rules
86
+
87
+ - Verify against actual source before writing.
88
+ - Prefer section edits over full rewrites.
89
+ - Use mermaid for complex flows.
90
+ - Keep instructions concise with examples and commands.
91
+ - Remove stale commands, paths, and references.
92
+ - Do not mix user instructions with internal implementation details unnecessarily.
32
93
 
33
94
  ## Red Flags
34
95
 
@@ -36,7 +97,21 @@ Load this skill when writing or updating:
36
97
  - writing broad architecture claims without source verification
37
98
  - mixing user instructions with internal implementation details unnecessarily
38
99
  - leaving stale commands or paths in place
100
+ - rewriting an entire document when only one section needed updating
101
+ - creating near-duplicate docs instead of updating existing ones
102
+ - leaving broken cross-references after an edit
103
+
104
+ ## Checklist
105
+
106
+ - [ ] Target audience confirmed
107
+ - [ ] Current behavior verified from source
108
+ - [ ] Scope determined (section edit vs full document)
109
+ - [ ] Content written with concise examples
110
+ - [ ] Mermaid diagrams used where helpful
111
+ - [ ] Stale content removed or corrected
112
+ - [ ] Cross-references checked
113
+ - [ ] Source of truth documented
39
114
 
40
115
  ## Done Criteria
41
116
 
42
- This skill is complete when the updated document has been verified against the actual source, all stale commands or paths have been corrected or removed, and the "Verification" field in the output names the specific files or commands that were checked.
117
+ This skill is complete when the updated document has been verified against the actual source, all stale commands or paths have been corrected or removed, and the output names the specific files or commands that were checked.
@@ -1,22 +1,27 @@
1
1
  name: docs-writer
2
- version: 0.1.0
2
+ version: 0.2.0
3
3
  category: documentation
4
- summary: Update documentation from verified source behavior so the docs stay useful and current.
5
- summary_vi: Cập nhật tài liệu từ hành vi nguồn đã xác minh để docs luôn hữu ích cập nhật.
4
+ summary: Write and update documentation aligned with actual code, with section editing and mermaid diagram support.
5
+ summary_vi: "Vi\u1EBFt v\xE0 c\u1EADp nh\u1EADt t\xE0i li\u1EC7u theo code th\u1EF1c t\u1EBF, h\u1ED7 tr\u1EE3 ch\u1EC9nh s\u1EEDa t\u1EEBng ph\u1EA7n v\xE0 s\u01A1 \u0111\u1ED3 mermaid."
6
6
  triggers:
7
+ - write documentation
7
8
  - update the README
8
- - write onboarding docs
9
- - refresh runbook or API notes
9
+ - document this feature
10
+ - create a runbook
10
11
  inputs:
11
- - current code or behavior
12
- - existing documentation
12
+ - target document
13
+ - audience
14
+ - source of truth (code, commands, config)
13
15
  outputs:
14
- - updated docs
15
- - assumptions and verification notes
16
+ - created or updated document
17
+ - verification source noted
18
+ - assumptions or follow-ups
16
19
  constraints:
17
- - prefer source-verified statements
18
- - keep links repository-relative when possible
20
+ - verify against actual source before writing
21
+ - prefer section edits over full rewrites
19
22
  related_skills:
20
23
  - using-skills
21
- - repo-onboarding
22
- - code-review
24
+ - research
25
+ - feature-delivery
26
+ - extract
27
+ - verification-before-completion