@codenhub/skills 0.0.2

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 (43) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +53 -0
  3. package/dist/cli.js +213 -0
  4. package/package.json +36 -0
  5. package/src/agents-md-improver/SKILL.md +216 -0
  6. package/src/agents-md-improver/agents/openai.yaml +4 -0
  7. package/src/agents-md-improver/references/quality-criteria.md +116 -0
  8. package/src/agents-md-improver/references/templates.md +255 -0
  9. package/src/agents-md-improver/references/update-guidelines.md +155 -0
  10. package/src/brainstorming/SKILL.md +118 -0
  11. package/src/brainstorming/agents/openai.yaml +4 -0
  12. package/src/caveman/SKILL.md +59 -0
  13. package/src/caveman/agents/openai.yaml +4 -0
  14. package/src/caveman-commit/SKILL.md +68 -0
  15. package/src/caveman-commit/agents/openai.yaml +4 -0
  16. package/src/caveman-review/SKILL.md +54 -0
  17. package/src/caveman-review/agents/openai.yaml +4 -0
  18. package/src/cli.test.ts +102 -0
  19. package/src/cli.ts +311 -0
  20. package/src/executing-plans/SKILL.md +92 -0
  21. package/src/executing-plans/agents/openai.yaml +4 -0
  22. package/src/frontend-design/SKILL.md +60 -0
  23. package/src/frontend-design/agents/openai.yaml +4 -0
  24. package/src/subagent-specialist/SKILL.md +226 -0
  25. package/src/subagent-specialist/agents/openai.yaml +4 -0
  26. package/src/subagent-specialist/references/code-quality-reviewer-prompt.md +48 -0
  27. package/src/subagent-specialist/references/implementer-prompt.md +84 -0
  28. package/src/subagent-specialist/references/parallel-investigator-prompt.md +49 -0
  29. package/src/subagent-specialist/references/spec-reviewer-prompt.md +52 -0
  30. package/src/test-driven-development/SKILL.md +239 -0
  31. package/src/test-driven-development/agents/openai.yaml +11 -0
  32. package/src/test-driven-development/testing-anti-patterns.md +162 -0
  33. package/src/test-driven-development/verification-baselines.md +42 -0
  34. package/src/writing-plans/SKILL.md +169 -0
  35. package/src/writing-plans/agents/openai.yaml +4 -0
  36. package/src/writing-skills/SKILL.md +222 -0
  37. package/src/writing-skills/agents/openai.yaml +4 -0
  38. package/src/writing-skills/best-practices.md +321 -0
  39. package/src/writing-skills/examples/SKILL_AUTHORING_GUIDE_TESTING.md +156 -0
  40. package/src/writing-skills/persuasion-principles.md +172 -0
  41. package/src/writing-skills/testing-skills-with-subagents.md +310 -0
  42. package/src/writing-specs/SKILL.md +72 -0
  43. package/src/writing-specs/agents/openai.yaml +4 -0
@@ -0,0 +1,226 @@
1
+ ---
2
+ name: subagent-specialist
3
+ description: Specialist workflow for planning, dispatching, reviewing, and integrating delegated workers. Use for parallelizable work, independent implementation tasks, multiple unrelated bug investigations, or quality-focused implementer + spec-review + code-review workflows.
4
+ ---
5
+
6
+ # Subagent Specialist
7
+
8
+ ## Overview
9
+
10
+ Use fresh subagents as isolated workers while the main agent stays responsible for decomposition, context curation, coordination, and integration. This skill merges two patterns into one operating guide: structured per-task execution with review gates, and parallel dispatch for independent domains.
11
+
12
+ ## Core Principles
13
+
14
+ - Default to isolated context. Give each subagent only the task-local context it needs.
15
+ - Keep the controller responsible for planning, sequencing, tool strategy, and final integration.
16
+ - Use one subagent per task or per independent problem domain.
17
+ - Prefer explicit scope, constraints, and deliverables over open-ended prompts.
18
+ - Review actual artifacts, not just the subagent's report.
19
+ - Preserve the controller's context window for orchestration work.
20
+
21
+ ## Tool Compatibility
22
+
23
+ - Keep instructions tool-agnostic and avoid provider-specific wording.
24
+ - When behavior differs across tools, resolve conflicts in this order: OpenCode > Claude Code > Codex CLI > Gemini CLI.
25
+
26
+ ## Delegation Lifecycle
27
+
28
+ - Use the host environment's delegation mechanism to start a fresh worker when isolated execution is helpful.
29
+ - Prefer isolated, task-local context over copying the full session unless the task genuinely depends on broader context.
30
+ - Reuse the same worker for follow-up work only when it already holds the right local context and reuse reduces setup cost.
31
+ - Wait for worker results only when the next critical-path step depends on them.
32
+ - End or discard workers that are no longer useful, according to the host environment's workflow.
33
+ - Respect the host environment's delegation policy. If the environment only allows delegated workers after explicit user permission, do not bypass that rule.
34
+ - Adapt to the host's actual capabilities. Do not assume support for background workers, message passing, context forking, or explicit worker shutdown unless the environment provides them.
35
+
36
+ ## Choose the Pattern
37
+
38
+ Use the structured per-task workflow when:
39
+
40
+ - you already have a plan or a clearly bounded task list
41
+ - tasks can be executed one at a time in the current session
42
+ - you want strong quality gates after each implementation step
43
+
44
+ Use parallel dispatch when:
45
+
46
+ - 2 or more tasks, failures, or investigations are truly independent
47
+ - each workstream can be understood without hidden context from the others
48
+ - the agents will not collide on the same files, resources, or unresolved design decisions
49
+
50
+ Do local exploration first instead of dispatching immediately when:
51
+
52
+ - the problem is still ambiguous
53
+ - failures are probably symptoms of the same root cause
54
+ - the work depends on one shared architectural decision that has not been made yet
55
+ - multiple agents would compete for the same write scope
56
+
57
+ ## Workflow A: Structured Task Execution
58
+
59
+ ### 1. Prepare Once
60
+
61
+ - Read the plan once.
62
+ - Extract each task's full text, acceptance criteria, dependencies, and scene-setting context.
63
+ - Track the tasks in the session plan tracker so the controller, not the subagents, owns the global picture.
64
+ - Do not make each subagent rediscover the plan from scratch.
65
+
66
+ ### 2. Dispatch One Implementer
67
+
68
+ - Give the full task text directly.
69
+ - Include architectural context, constraints, working directory, and expected report format.
70
+ - Tell the implementer to ask questions before coding if anything is unclear.
71
+ - Prefer reusing the same implementer for follow-up fixes if the review loop stays on the same task.
72
+
73
+ For the prompt structure, read [references/implementer-prompt.md](references/implementer-prompt.md).
74
+
75
+ ### 3. Handle Implementer Status Correctly
76
+
77
+ Implementers should report one of four statuses:
78
+
79
+ - `DONE`: Proceed to spec compliance review.
80
+ - `DONE_WITH_CONCERNS`: Read the concerns before review. Resolve correctness or scope doubts before moving on.
81
+ - `NEEDS_CONTEXT`: Provide the missing information and re-dispatch.
82
+ - `BLOCKED`: Change something real before retrying. Add context, break up the task, choose a stronger execution profile, or escalate to the user.
83
+
84
+ Never ignore a subagent that says it is stuck. If it reported `BLOCKED`, the setup, context, or task shape needs to change.
85
+
86
+ ### 4. Run Spec Compliance Review First
87
+
88
+ - Verify what was requested against the actual code.
89
+ - Check for missing requirements.
90
+ - Check for over-building and extra features.
91
+ - Check for misunderstandings of the requested behavior.
92
+
93
+ Do not start code quality review until spec compliance is clear.
94
+
95
+ For the reviewer template, read [references/spec-reviewer-prompt.md](references/spec-reviewer-prompt.md).
96
+
97
+ ### 5. Run Code Quality Review Second
98
+
99
+ - Review maintainability, decomposition, test quality, and fit with the codebase.
100
+ - Check whether the change created unnecessarily large or tangled files.
101
+ - Check whether the implementation followed the intended structure.
102
+
103
+ For the reviewer template, read [references/code-quality-reviewer-prompt.md](references/code-quality-reviewer-prompt.md).
104
+
105
+ ### 6. Fix and Re-Review in Loops
106
+
107
+ - If a reviewer finds issues, send the findings back to the implementer.
108
+ - Re-run the same review after the fixes land.
109
+ - Do not move to the next task while review issues are still open.
110
+ - Do not let implementer self-review replace an actual reviewer pass.
111
+
112
+ ### 7. Close the Task Only When Both Gates Pass
113
+
114
+ - Mark the task complete only after spec compliance and code quality are both clear.
115
+ - After all tasks are done, run one final holistic review or verification pass across the full change.
116
+
117
+ ## Workflow B: Parallel Dispatch for Independent Domains
118
+
119
+ ### 1. Group Work by Independent Domain
120
+
121
+ Good candidates:
122
+
123
+ - different failing test files with unrelated root causes
124
+ - separate subsystems
125
+ - bounded implementation slices with disjoint write scopes
126
+
127
+ Bad candidates:
128
+
129
+ - failures likely caused by one shared bug
130
+ - tasks touching the same core files or the same unresolved design decision
131
+ - work that depends on shared mutable state or one ordered sequence of changes
132
+
133
+ ### 2. Give Each Agent One Domain Only
134
+
135
+ Each parallel prompt should include:
136
+
137
+ - exact scope
138
+ - raw failure evidence or task text
139
+ - constraints on what not to change
140
+ - expected output
141
+
142
+ For a reusable template, read [references/parallel-investigator-prompt.md](references/parallel-investigator-prompt.md).
143
+
144
+ ### 3. Dispatch Concurrently
145
+
146
+ - Run one subagent per independent domain.
147
+ - Keep the scopes narrow.
148
+ - While the subagents run, continue with non-overlapping controller work instead of waiting by reflex.
149
+
150
+ ### 4. Review and Integrate Carefully
151
+
152
+ When results come back:
153
+
154
+ - read each summary
155
+ - inspect file overlap or conceptual conflicts
156
+ - integrate the changes carefully
157
+ - run the combined verification
158
+
159
+ If the domains turn out not to be independent, stop treating them as parallel work and recombine the investigation.
160
+
161
+ ## Hybrid Pattern
162
+
163
+ Use parallel dispatch at the top level and the structured review loop inside each workstream when the work is large enough to justify it. A typical example is three unrelated bug clusters investigated in parallel, where each accepted fix still goes through spec review and code quality review before final integration.
164
+
165
+ ## Execution Profile Selection
166
+
167
+ - Use a lightweight execution profile for mechanical, well-specified tasks touching 1 or 2 files.
168
+ - Use a standard execution profile for debugging, integration work, or multi-file implementation.
169
+ - Use the strongest available execution profile for architecture, task decomposition, and critical reviews.
170
+
171
+ Signals that you should increase execution depth:
172
+
173
+ - ambiguous requirements
174
+ - many interacting files
175
+ - cross-cutting architectural impact
176
+ - repeated failures after a reasonable attempt
177
+
178
+ ## Prompt Construction Rules
179
+
180
+ - Be specific about scope.
181
+ - Paste the relevant task text or failure evidence.
182
+ - Provide enough context to avoid blind guessing.
183
+ - State constraints explicitly.
184
+ - Tell the subagent what to return.
185
+ - Prefer raw artifacts over your diagnosis when asking for validation or review.
186
+ - Do not leak the intended answer into reviewer prompts.
187
+
188
+ ## Advantages and Costs
189
+
190
+ Advantages:
191
+
192
+ - fresh context per task keeps subagents focused
193
+ - the controller keeps the big picture instead of drowning in implementation detail
194
+ - questions surface early, before the subagent builds the wrong thing
195
+ - review gates catch under-building, over-building, and maintainability problems sooner
196
+ - parallel investigations can collapse multi-hour debugging into one coordination pass
197
+
198
+ Costs:
199
+
200
+ - more setup work from the controller
201
+ - more subagent invocations
202
+ - more review iterations
203
+ - more integration discipline required when multiple workstreams return together
204
+
205
+ The cost is usually worth paying when the alternative is broad context pollution, slow sequential debugging, or late discovery of quality problems.
206
+
207
+ ## Red Flags
208
+
209
+ - Do not start implementation on `main` or `master` without explicit user consent.
210
+ - Do not skip spec compliance review.
211
+ - Do not run code quality review before spec compliance passes.
212
+ - Do not move to the next task while review issues are still open.
213
+ - Do not tell a subagent to "fix everything."
214
+ - Do not dispatch multiple coding subagents against the same write scope unless the integration plan is explicit.
215
+ - Do not ignore a subagent that reports `BLOCKED`.
216
+ - Do not replace actual review with implementer self-review.
217
+ - Do not trust an implementer or reviewer claim without checking the artifacts they produced.
218
+
219
+ ## Reference Templates
220
+
221
+ Read these only when needed:
222
+
223
+ - [references/implementer-prompt.md](references/implementer-prompt.md): implementation-worker prompt
224
+ - [references/spec-reviewer-prompt.md](references/spec-reviewer-prompt.md): spec-compliance review prompt
225
+ - [references/code-quality-reviewer-prompt.md](references/code-quality-reviewer-prompt.md): maintainability and quality review prompt
226
+ - [references/parallel-investigator-prompt.md](references/parallel-investigator-prompt.md): focused prompt for independent parallel investigations
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Subagent Specialist"
3
+ short_description: "Specialist workflow for using subagents well"
4
+ default_prompt: "Use $subagent-specialist to decompose this work, choose the right subagent pattern, and run the correct review loop."
@@ -0,0 +1,48 @@
1
+ # Code Quality Reviewer Prompt Template
2
+
3
+ Use this template when dispatching a code-quality reviewer subagent.
4
+
5
+ Only run this review after spec compliance passes.
6
+
7
+ ```text
8
+ You are reviewing the quality of an implementation that already passed spec compliance.
9
+
10
+ ## What Was Implemented
11
+ [Paste the implementer's report or a concise summary of the accepted change]
12
+
13
+ ## Requirements or Plan
14
+ [Paste the task text, plan section, or accepted scope]
15
+
16
+ ## Diff Context
17
+ - Base SHA: [optional]
18
+ - Head SHA: [optional]
19
+ - Description: [short summary]
20
+
21
+ ## Your Job
22
+ Review the actual code and tests for maintainability, clarity, and engineering quality.
23
+
24
+ Check the usual code review concerns, and explicitly inspect these questions:
25
+ - Does each changed file have one clear responsibility with a well-defined interface?
26
+ - Are units decomposed so they can be understood and tested independently?
27
+ - Does the implementation follow the intended file structure from the plan or task?
28
+ - Did the change create new files that are already large, or significantly grow existing files?
29
+ - Are names clear and intention-revealing?
30
+ - Do tests verify behavior instead of just mocking internals?
31
+ - Did the implementation fit the existing codebase instead of introducing needless patterns?
32
+
33
+ ## Review Rules
34
+ - Read the code. Do not rely on the implementer's summary.
35
+ - Focus on actionable quality issues, not style nitpicks unless they materially affect maintainability.
36
+ - Distinguish between critical, important, and minor issues.
37
+ - If the implementation is solid, say so clearly.
38
+
39
+ ## Report Format
40
+ - Strengths
41
+ - Issues
42
+ - Critical
43
+ - Important
44
+ - Minor
45
+ - Assessment
46
+
47
+ Include file references for issues whenever possible.
48
+ ```
@@ -0,0 +1,84 @@
1
+ # Implementer Prompt Template
2
+
3
+ Use this template when dispatching an implementation subagent.
4
+
5
+ ```text
6
+ You are implementing Task [N]: [task name]
7
+
8
+ ## Task Description
9
+ [FULL TEXT of the task or requirement. Paste it here. Do not make the subagent read the plan file just to reconstruct scope.]
10
+
11
+ ## Context
12
+ [Scene-setting context: where this fits, dependencies, architectural constraints, existing patterns, and anything the task depends on.]
13
+
14
+ ## Working Rules
15
+ - Work in: [directory]
16
+ - Use only the context provided here plus any local files you need to inspect.
17
+ - Follow existing project patterns.
18
+ - Implement exactly what was requested.
19
+ - Do not broaden scope without asking.
20
+ - If a commit is explicitly requested, make it. Otherwise edit, test, and report back without inventing a commit requirement.
21
+
22
+ ## Before You Begin
23
+ If you have questions about:
24
+ - the requirements or acceptance criteria
25
+ - the approach or implementation strategy
26
+ - dependencies or assumptions
27
+ - anything unclear in the task description
28
+
29
+ Ask them before you start coding. Raise concerns early instead of guessing.
30
+
31
+ ## Your Job
32
+ Once the task is clear:
33
+ 1. Implement exactly what the task specifies.
34
+ 2. Add or update tests when the task requires it.
35
+ 3. Verify the implementation works.
36
+ 4. Self-review your own work.
37
+ 5. Report back using the required format.
38
+
39
+ ## Code Organization
40
+ You reason best about code you can hold in context at once, and your edits are more reliable when files are focused.
41
+
42
+ Keep this in mind:
43
+ - Follow the file structure defined by the task or plan.
44
+ - Each file should have one clear responsibility with a well-defined interface.
45
+ - If a file you are creating is growing beyond the task's intent, stop and report `DONE_WITH_CONCERNS` instead of splitting things on your own without direction.
46
+ - If an existing file is already large or tangled, work carefully and call that out in your report.
47
+ - Improve the code you touch the way a good developer would, but do not restructure unrelated areas.
48
+
49
+ ## When You Are in Over Your Head
50
+ It is always OK to stop and escalate. Bad work is worse than no work.
51
+
52
+ Stop and escalate when:
53
+ - the task requires architectural decisions with multiple valid approaches
54
+ - you need context that was not provided and local inspection is not enough
55
+ - you are uncertain whether your approach is correct
56
+ - the task requires restructuring existing code in ways the task did not anticipate
57
+ - you have been reading file after file without converging on the problem
58
+
59
+ If you need help, report `BLOCKED` or `NEEDS_CONTEXT`. Say exactly what you are stuck on, what you tried, and what additional information or decision you need.
60
+
61
+ ## Before Reporting Back: Self-Review
62
+ Review your work with fresh eyes.
63
+
64
+ Check:
65
+ - Completeness: did you implement everything requested?
66
+ - Scope discipline: did you avoid extra features and overbuilding?
67
+ - Quality: are names clear, code clean, and structure maintainable?
68
+ - Testing: do the tests verify behavior and do the results support the claim?
69
+
70
+ If you find issues during self-review, fix them before reporting.
71
+
72
+ ## Report Format
73
+ - Status: `DONE` | `DONE_WITH_CONCERNS` | `BLOCKED` | `NEEDS_CONTEXT`
74
+ - What you implemented or attempted
75
+ - Tests or verification you ran and the results
76
+ - Files changed
77
+ - Self-review findings
78
+ - Any issues, risks, or open questions
79
+
80
+ Use `DONE_WITH_CONCERNS` if you completed the work but have doubts about correctness or fit.
81
+ Use `BLOCKED` if you cannot complete the task.
82
+ Use `NEEDS_CONTEXT` if key information was missing.
83
+ Never silently produce work you are unsure about.
84
+ ```
@@ -0,0 +1,49 @@
1
+ # Parallel Investigator Prompt Template
2
+
3
+ Use this template when dispatching a subagent against one independent problem domain in parallel with other subagents.
4
+
5
+ ```text
6
+ You are working one independent problem domain. Stay strictly within scope.
7
+
8
+ ## Scope
9
+ [One test file, one subsystem, one bug cluster, or one bounded implementation slice]
10
+
11
+ ## Failure Evidence or Task Text
12
+ [Paste the failing tests, logs, bug report, or exact task text]
13
+
14
+ ## Context
15
+ [Only the context this domain actually needs]
16
+
17
+ ## Constraints
18
+ - Do not broaden scope into other failures or subsystems.
19
+ - Do not refactor unrelated code.
20
+ - Do not "fix" the problem by hiding it with arbitrary timeout increases, blanket retries, or similar papering-over unless that is explicitly justified by the root cause.
21
+ - If the real issue crosses the stated scope, stop and report it instead of forcing a local fix.
22
+
23
+ ## Your Job
24
+ 1. Read the relevant files and understand what this domain is supposed to do.
25
+ 2. Identify the root cause.
26
+ 3. Fix it within scope, or report why the scope is not actually independent.
27
+ 4. Verify the result.
28
+ 5. Report back clearly.
29
+
30
+ ## Return
31
+ - Root cause
32
+ - What you changed
33
+ - Verification performed and results
34
+ - Files changed
35
+ - Any blocker, dependency, or reason this domain is not truly independent
36
+ ```
37
+
38
+ What makes a good parallel dispatch prompt:
39
+
40
+ - Focused: one clear problem domain
41
+ - Self-contained: all context needed to work the problem
42
+ - Specific about output: root cause, changes, verification, blockers
43
+
44
+ Common mistakes:
45
+
46
+ - Too broad: "Fix all the tests"
47
+ - Too vague: "Fix the race condition"
48
+ - No constraints: the subagent widens scope and edits unrelated areas
49
+ - No expected output: the controller cannot evaluate the result quickly
@@ -0,0 +1,52 @@
1
+ # Spec Compliance Reviewer Prompt Template
2
+
3
+ Use this template when dispatching a spec-compliance reviewer subagent.
4
+
5
+ ```text
6
+ You are reviewing whether an implementation matches its specification.
7
+
8
+ ## What Was Requested
9
+ [FULL TEXT of the requirements, task, or acceptance criteria]
10
+
11
+ ## What the Implementer Claims They Built
12
+ [Paste the implementer's report or summary]
13
+
14
+ ## Critical Rule: Do Not Trust the Report
15
+ The implementer may be incomplete, inaccurate, or optimistic.
16
+ You must verify everything independently.
17
+
18
+ Do not:
19
+ - take their word for completeness
20
+ - trust their interpretation of the requirements
21
+ - accept claims without reading the actual implementation
22
+
23
+ Do:
24
+ - read the code they changed
25
+ - compare the implementation to the requirements line by line
26
+ - check whether they claimed work that is not actually present
27
+ - look for missing behavior, extra behavior, and misunderstandings
28
+
29
+ ## Your Job
30
+ Verify all three categories:
31
+
32
+ ### Missing Requirements
33
+ - Did they implement everything that was requested?
34
+ - Are there requirements they skipped or missed?
35
+ - Did they claim something works that is not actually implemented?
36
+
37
+ ### Extra or Unneeded Work
38
+ - Did they build things that were not requested?
39
+ - Did they over-engineer or add "nice to haves" that were not in scope?
40
+
41
+ ### Misunderstandings
42
+ - Did they interpret requirements differently than intended?
43
+ - Did they solve the wrong problem?
44
+ - Did they build the right feature the wrong way?
45
+
46
+ ## Report Format
47
+ - `Spec compliant` if everything matches after code inspection
48
+ - `Issues found` if anything is missing, extra, or misunderstood
49
+ - Include precise file references for every issue you report
50
+
51
+ Verify by reading the code, not by trusting the report.
52
+ ```