opencode-metis 0.1.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 (156) hide show
  1. package/README.md +140 -0
  2. package/dist/cli.cjs +63 -0
  3. package/dist/mcp-server.cjs +51 -0
  4. package/dist/plugin.cjs +4 -0
  5. package/dist/worker.cjs +224 -0
  6. package/opencode/agent/the-analyst/feature-prioritization.md +66 -0
  7. package/opencode/agent/the-analyst/market-research.md +77 -0
  8. package/opencode/agent/the-analyst/project-coordination.md +81 -0
  9. package/opencode/agent/the-analyst/requirements-analysis.md +77 -0
  10. package/opencode/agent/the-architect/compatibility-review.md +138 -0
  11. package/opencode/agent/the-architect/complexity-review.md +137 -0
  12. package/opencode/agent/the-architect/quality-review.md +67 -0
  13. package/opencode/agent/the-architect/security-review.md +127 -0
  14. package/opencode/agent/the-architect/system-architecture.md +119 -0
  15. package/opencode/agent/the-architect/system-documentation.md +83 -0
  16. package/opencode/agent/the-architect/technology-research.md +85 -0
  17. package/opencode/agent/the-chief.md +79 -0
  18. package/opencode/agent/the-designer/accessibility-implementation.md +101 -0
  19. package/opencode/agent/the-designer/design-foundation.md +74 -0
  20. package/opencode/agent/the-designer/interaction-architecture.md +75 -0
  21. package/opencode/agent/the-designer/user-research.md +70 -0
  22. package/opencode/agent/the-meta-agent.md +155 -0
  23. package/opencode/agent/the-platform-engineer/ci-cd-pipelines.md +109 -0
  24. package/opencode/agent/the-platform-engineer/containerization.md +106 -0
  25. package/opencode/agent/the-platform-engineer/data-architecture.md +81 -0
  26. package/opencode/agent/the-platform-engineer/dependency-review.md +144 -0
  27. package/opencode/agent/the-platform-engineer/deployment-automation.md +81 -0
  28. package/opencode/agent/the-platform-engineer/infrastructure-as-code.md +107 -0
  29. package/opencode/agent/the-platform-engineer/performance-tuning.md +82 -0
  30. package/opencode/agent/the-platform-engineer/pipeline-engineering.md +81 -0
  31. package/opencode/agent/the-platform-engineer/production-monitoring.md +105 -0
  32. package/opencode/agent/the-qa-engineer/exploratory-testing.md +66 -0
  33. package/opencode/agent/the-qa-engineer/performance-testing.md +81 -0
  34. package/opencode/agent/the-qa-engineer/quality-assurance.md +77 -0
  35. package/opencode/agent/the-qa-engineer/test-execution.md +66 -0
  36. package/opencode/agent/the-software-engineer/api-development.md +78 -0
  37. package/opencode/agent/the-software-engineer/component-development.md +79 -0
  38. package/opencode/agent/the-software-engineer/concurrency-review.md +141 -0
  39. package/opencode/agent/the-software-engineer/domain-modeling.md +66 -0
  40. package/opencode/agent/the-software-engineer/performance-optimization.md +113 -0
  41. package/opencode/command/analyze.md +149 -0
  42. package/opencode/command/constitution.md +178 -0
  43. package/opencode/command/debug.md +194 -0
  44. package/opencode/command/document.md +178 -0
  45. package/opencode/command/implement.md +225 -0
  46. package/opencode/command/refactor.md +207 -0
  47. package/opencode/command/review.md +229 -0
  48. package/opencode/command/simplify.md +267 -0
  49. package/opencode/command/specify.md +191 -0
  50. package/opencode/command/validate.md +224 -0
  51. package/opencode/skill/accessibility-design/SKILL.md +566 -0
  52. package/opencode/skill/accessibility-design/checklists/wcag-checklist.md +435 -0
  53. package/opencode/skill/agent-coordination/SKILL.md +224 -0
  54. package/opencode/skill/api-contract-design/SKILL.md +550 -0
  55. package/opencode/skill/api-contract-design/templates/graphql-schema-template.md +818 -0
  56. package/opencode/skill/api-contract-design/templates/rest-api-template.md +417 -0
  57. package/opencode/skill/architecture-design/SKILL.md +160 -0
  58. package/opencode/skill/architecture-design/examples/architecture-examples.md +170 -0
  59. package/opencode/skill/architecture-design/template.md +749 -0
  60. package/opencode/skill/architecture-design/validation.md +99 -0
  61. package/opencode/skill/architecture-selection/SKILL.md +522 -0
  62. package/opencode/skill/architecture-selection/examples/adrs/001-example-adr.md +71 -0
  63. package/opencode/skill/architecture-selection/examples/architecture-patterns.md +239 -0
  64. package/opencode/skill/bug-diagnosis/SKILL.md +235 -0
  65. package/opencode/skill/code-quality-review/SKILL.md +337 -0
  66. package/opencode/skill/code-quality-review/examples/anti-patterns.md +629 -0
  67. package/opencode/skill/code-quality-review/reference.md +322 -0
  68. package/opencode/skill/code-review/SKILL.md +363 -0
  69. package/opencode/skill/code-review/reference.md +450 -0
  70. package/opencode/skill/codebase-analysis/SKILL.md +139 -0
  71. package/opencode/skill/codebase-navigation/SKILL.md +227 -0
  72. package/opencode/skill/codebase-navigation/examples/exploration-patterns.md +263 -0
  73. package/opencode/skill/coding-conventions/SKILL.md +178 -0
  74. package/opencode/skill/coding-conventions/checklists/accessibility-checklist.md +176 -0
  75. package/opencode/skill/coding-conventions/checklists/performance-checklist.md +154 -0
  76. package/opencode/skill/coding-conventions/checklists/security-checklist.md +127 -0
  77. package/opencode/skill/constitution-validation/SKILL.md +315 -0
  78. package/opencode/skill/constitution-validation/examples/CONSTITUTION.md +202 -0
  79. package/opencode/skill/constitution-validation/reference/rule-patterns.md +328 -0
  80. package/opencode/skill/constitution-validation/template.md +115 -0
  81. package/opencode/skill/context-preservation/SKILL.md +445 -0
  82. package/opencode/skill/data-modeling/SKILL.md +385 -0
  83. package/opencode/skill/data-modeling/templates/schema-design-template.md +268 -0
  84. package/opencode/skill/deployment-pipeline-design/SKILL.md +579 -0
  85. package/opencode/skill/deployment-pipeline-design/templates/pipeline-template.md +633 -0
  86. package/opencode/skill/documentation-extraction/SKILL.md +259 -0
  87. package/opencode/skill/documentation-sync/SKILL.md +431 -0
  88. package/opencode/skill/domain-driven-design/SKILL.md +509 -0
  89. package/opencode/skill/domain-driven-design/examples/ddd-patterns.md +688 -0
  90. package/opencode/skill/domain-driven-design/reference.md +465 -0
  91. package/opencode/skill/drift-detection/SKILL.md +383 -0
  92. package/opencode/skill/drift-detection/reference.md +340 -0
  93. package/opencode/skill/error-recovery/SKILL.md +162 -0
  94. package/opencode/skill/error-recovery/examples/error-patterns.md +484 -0
  95. package/opencode/skill/feature-prioritization/SKILL.md +419 -0
  96. package/opencode/skill/feature-prioritization/examples/rice-template.md +139 -0
  97. package/opencode/skill/feature-prioritization/reference.md +256 -0
  98. package/opencode/skill/git-workflow/SKILL.md +453 -0
  99. package/opencode/skill/implementation-planning/SKILL.md +215 -0
  100. package/opencode/skill/implementation-planning/examples/phase-examples.md +217 -0
  101. package/opencode/skill/implementation-planning/template.md +220 -0
  102. package/opencode/skill/implementation-planning/validation.md +88 -0
  103. package/opencode/skill/implementation-verification/SKILL.md +272 -0
  104. package/opencode/skill/knowledge-capture/SKILL.md +265 -0
  105. package/opencode/skill/knowledge-capture/reference/knowledge-capture.md +402 -0
  106. package/opencode/skill/knowledge-capture/reference.md +444 -0
  107. package/opencode/skill/knowledge-capture/templates/domain-template.md +325 -0
  108. package/opencode/skill/knowledge-capture/templates/interface-template.md +255 -0
  109. package/opencode/skill/knowledge-capture/templates/pattern-template.md +144 -0
  110. package/opencode/skill/observability-design/SKILL.md +291 -0
  111. package/opencode/skill/observability-design/references/monitoring-patterns.md +461 -0
  112. package/opencode/skill/pattern-detection/SKILL.md +171 -0
  113. package/opencode/skill/pattern-detection/examples/common-patterns.md +359 -0
  114. package/opencode/skill/performance-analysis/SKILL.md +266 -0
  115. package/opencode/skill/performance-analysis/references/profiling-tools.md +499 -0
  116. package/opencode/skill/requirements-analysis/SKILL.md +139 -0
  117. package/opencode/skill/requirements-analysis/examples/good-prd.md +66 -0
  118. package/opencode/skill/requirements-analysis/template.md +177 -0
  119. package/opencode/skill/requirements-analysis/validation.md +69 -0
  120. package/opencode/skill/requirements-elicitation/SKILL.md +518 -0
  121. package/opencode/skill/requirements-elicitation/examples/interview-questions.md +226 -0
  122. package/opencode/skill/requirements-elicitation/examples/user-stories.md +414 -0
  123. package/opencode/skill/safe-refactoring/SKILL.md +312 -0
  124. package/opencode/skill/safe-refactoring/reference/code-smells.md +347 -0
  125. package/opencode/skill/security-assessment/SKILL.md +421 -0
  126. package/opencode/skill/security-assessment/checklists/security-review-checklist.md +285 -0
  127. package/opencode/skill/specification-management/SKILL.md +143 -0
  128. package/opencode/skill/specification-management/readme-template.md +32 -0
  129. package/opencode/skill/specification-management/reference.md +115 -0
  130. package/opencode/skill/specification-management/spec.py +229 -0
  131. package/opencode/skill/specification-validation/SKILL.md +397 -0
  132. package/opencode/skill/specification-validation/reference/3cs-framework.md +306 -0
  133. package/opencode/skill/specification-validation/reference/ambiguity-detection.md +132 -0
  134. package/opencode/skill/specification-validation/reference/constitution-validation.md +301 -0
  135. package/opencode/skill/specification-validation/reference/drift-detection.md +383 -0
  136. package/opencode/skill/task-delegation/SKILL.md +607 -0
  137. package/opencode/skill/task-delegation/examples/file-coordination.md +495 -0
  138. package/opencode/skill/task-delegation/examples/parallel-research.md +337 -0
  139. package/opencode/skill/task-delegation/examples/sequential-build.md +504 -0
  140. package/opencode/skill/task-delegation/reference.md +825 -0
  141. package/opencode/skill/tech-stack-detection/SKILL.md +89 -0
  142. package/opencode/skill/tech-stack-detection/references/framework-signatures.md +598 -0
  143. package/opencode/skill/technical-writing/SKILL.md +190 -0
  144. package/opencode/skill/technical-writing/templates/adr-template.md +205 -0
  145. package/opencode/skill/technical-writing/templates/system-doc-template.md +380 -0
  146. package/opencode/skill/test-design/SKILL.md +464 -0
  147. package/opencode/skill/test-design/examples/test-pyramid.md +724 -0
  148. package/opencode/skill/testing/SKILL.md +213 -0
  149. package/opencode/skill/testing/examples/test-pyramid.md +724 -0
  150. package/opencode/skill/user-insight-synthesis/SKILL.md +576 -0
  151. package/opencode/skill/user-insight-synthesis/templates/research-plan-template.md +217 -0
  152. package/opencode/skill/user-research/SKILL.md +508 -0
  153. package/opencode/skill/user-research/examples/interview-questions.md +265 -0
  154. package/opencode/skill/user-research/examples/personas.md +267 -0
  155. package/opencode/skill/vibe-security/SKILL.md +654 -0
  156. package/package.json +45 -0
@@ -0,0 +1,229 @@
1
+ ---
2
+ description: "Multi-agent code review with specialized perspectives (security, performance, patterns, simplification, tests)"
3
+ argument-hint: "PR number, branch name, file path, or 'staged' for staged changes"
4
+ allowed-tools:
5
+ ["todowrite", "bash", "read", "glob", "grep", "question", "skill"]
6
+ ---
7
+
8
+ # Review
9
+
10
+ Roleplay as a multi-perspective code review orchestrator that coordinates comprehensive review feedback across specialized perspectives.
11
+
12
+ **Review Target**: $ARGUMENTS
13
+
14
+ Review {
15
+ Constraints {
16
+ You are an orchestrator - delegate review activities using specialized subagents, not a reviewer yourself
17
+ Call skill tool FIRST - skill({ name: "code-review" }) for review methodology and finding formats
18
+ Parallel execution - launch ALL applicable review activities simultaneously in a single response
19
+ Full file context - provide full file contents to reviewers, not just diffs
20
+ Display ALL agent responses - present complete agent findings to the user, never summarize or omit
21
+ Highlight strengths - include positive observations alongside issues
22
+ Specific locations - every finding must include file:line locations, no generic "the codebase has issues"
23
+ Actionable fixes - every recommendation must be implementable, no "consider improving"
24
+ Synthesize only - never forward raw reviewer messages to the user, only synthesized output
25
+ }
26
+
27
+ AlwaysReviewPerspectives {
28
+ | Perspective | Intent | What to Look For |
29
+ | --- | --- | --- |
30
+ | **Security** | Find vulnerabilities before they reach production | Auth/authz gaps, injection risks, hardcoded secrets, input validation, CSRF, cryptographic weaknesses |
31
+ | **Simplification** | Aggressively challenge unnecessary complexity | YAGNI violations, over-engineering, premature abstraction, dead code, "clever" code that should be obvious |
32
+ | **Performance** | Identify efficiency issues | N+1 queries, algorithm complexity, resource leaks, blocking operations, caching opportunities |
33
+ | **Quality** | Ensure code meets standards | SOLID violations, naming issues, error handling gaps, pattern inconsistencies, code smells |
34
+ | **Testing** | Verify adequate coverage | Missing tests for new code paths, edge cases not covered, test quality issues |
35
+ }
36
+
37
+ ConditionalPerspectives {
38
+ | Perspective | Intent | Include When |
39
+ | --- | --- | --- |
40
+ | **Concurrency** | Find race conditions and async issues | Code uses async/await, threading, shared state, parallel operations |
41
+ | **Dependencies** | Assess supply chain security | Changes to package.json, requirements.txt, go.mod, Cargo.toml, etc. |
42
+ | **Compatibility** | Detect breaking changes | Modifications to public APIs, database schemas, config formats |
43
+ | **Accessibility** | Ensure inclusive design | Frontend/UI component changes |
44
+ | **Constitution** | Check project rules compliance | Project has CONSTITUTION.md |
45
+ }
46
+
47
+ SeverityClassification {
48
+ CRITICAL => Security vulnerability, data loss, production crash
49
+ HIGH => Incorrect behavior, perf regression, a11y blocker
50
+ MEDIUM => Code smell, maintainability, minor perf
51
+ LOW => Style preference, minor improvement
52
+ }
53
+
54
+ ConfidenceClassification {
55
+ HIGH => Clear violation of established pattern or security rule => Present as definite issue
56
+ MEDIUM => Likely issue but context-dependent => Present as probable concern
57
+ LOW => Potential improvement, may not be applicable => Present as suggestion
58
+ }
59
+
60
+ Workflow {
61
+ Phase1_GatherChangesContext {
62
+ 1. Parse $ARGUMENTS to determine review target:
63
+ PR number => fetch PR diff via gh pr diff
64
+ Branch name => diff against main/master
65
+ "staged" => use git diff --cached
66
+ File path => read file and recent changes
67
+
68
+ 2. Retrieve full file contents for context (not just diff)
69
+ 3. Read project context: CLAUDE.md, CONSTITUTION.md if present, relevant specs
70
+
71
+ 4. Analyze changes to determine which conditional perspectives apply:
72
+ Contains async/await, Promise, threading => include Concurrency
73
+ Modifies dependency files => include Dependencies
74
+ Changes public API/schema => include Compatibility
75
+ Modifies frontend components => include Accessibility
76
+ Project has CONSTITUTION.md => include Constitution
77
+
78
+ 5. Count applicable perspectives and assess scope of changes
79
+ }
80
+
81
+ Phase2_LaunchReviewActivities {
82
+ Launch ALL applicable review activities in parallel (single response with multiple task calls)
83
+
84
+ Template {
85
+ Review this code for [PERSPECTIVE]:
86
+
87
+ CONTEXT:
88
+ - Files changed: [list]
89
+ - Changes: [the diff or code]
90
+ - Full file context: [surrounding code]
91
+ - Project standards: [from CLAUDE.md, .editorconfig, etc.]
92
+
93
+ FOCUS: [What this perspective looks for - from perspectives table above]
94
+
95
+ OUTPUT: Return findings as a structured list:
96
+ - id: (leave blank - assigned during synthesis)
97
+ - title: Brief title (max 40 chars)
98
+ - severity: CRITICAL | HIGH | MEDIUM | LOW
99
+ - confidence: HIGH | MEDIUM | LOW
100
+ - location: file:line
101
+ - finding: What was found
102
+ - recommendation: Actionable fix
103
+ - diff: (Required for CRITICAL, recommended for HIGH)
104
+ - principle: (If applicable - YAGNI, SRP, OWASP, etc.)
105
+
106
+ If no findings for this perspective, return: NO_FINDINGS
107
+ }
108
+ }
109
+
110
+ Phase3_SynthesizePresent {
111
+ Deduplication {
112
+ 1. Collect all findings from all reviewers
113
+ 2. Group by location (file:line range overlap -- within 5 lines = potential overlap)
114
+ 3. For overlapping findings: keep highest severity, merge complementary details, credit all perspectives
115
+ 4. Sort by severity (Critical > High > Medium > Low) then confidence
116
+ 5. Assign finding IDs (C1, C2, H1, H2, M1, M2, L1, etc.)
117
+ }
118
+
119
+ PresentationFormat {
120
+ ## Code Review: [target]
121
+
122
+ **Verdict**: [VERDICT from decision table]
123
+
124
+ ### Summary
125
+
126
+ | Category | Critical | High | Medium | Low |
127
+ | --- | --- | --- | --- | --- |
128
+ | Security | X | X | X | X |
129
+ | Simplification | X | X | X | X |
130
+ | Performance | X | X | X | X |
131
+ | Quality | X | X | X | X |
132
+ | Testing | X | X | X | X |
133
+ | **Total** | X | X | X | X |
134
+
135
+ *Critical & High Findings (Must Address)*
136
+
137
+ | ID | Finding | Remediation |
138
+ | --- | --- | --- |
139
+ | C1 | Brief title *(file:line)* | Specific fix *(concise issue description)* |
140
+
141
+ #### Code Examples for Critical Fixes
142
+
143
+ **[C1] Title**
144
+ // Before -> After code diff
145
+
146
+ *Medium Findings (Should Address)*
147
+
148
+ | ID | Finding | Remediation |
149
+ | --- | --- | --- |
150
+ | M1 | Brief title *(file:line)* | Specific fix *(concise issue description)* |
151
+
152
+ *Low Findings (Consider)*
153
+
154
+ | ID | Finding | Remediation |
155
+ | --- | --- | --- |
156
+ | L1 | Brief title *(file:line)* | Specific fix *(concise issue description)* |
157
+
158
+ ### Strengths
159
+
160
+ - [Positive observation with specific code reference]
161
+
162
+ ### Verdict Reasoning
163
+
164
+ [Why this verdict was chosen based on findings]
165
+ }
166
+
167
+ TableColumnGuidelines {
168
+ ID => Severity letter + number (C1 = Critical #1, H2 = High #2, M1 = Medium #1, L1 = Low #1)
169
+ Finding => Brief title + location in italics
170
+ Remediation => Fix recommendation + issue context in italics
171
+ }
172
+
173
+ CodeExamples {
174
+ REQUIRED for all Critical findings (before/after style)
175
+ Include for High findings when the fix is non-obvious
176
+ Medium/Low findings use table-only format
177
+ }
178
+ }
179
+
180
+ Phase4_Verdict {
181
+ Apply verdict decision table to determine review outcome based on finding severity counts
182
+ }
183
+
184
+ Phase5_NextSteps {
185
+ Use question with options based on verdict:
186
+
187
+ If REVISIONS_NEEDED {
188
+ "Address critical issues first"
189
+ "Show me fixes for [specific issue]"
190
+ "Explain [finding] in more detail"
191
+ }
192
+
193
+ If APPROVED_WITH_NOTES {
194
+ "Apply suggested fixes"
195
+ "Create follow-up issues for medium findings"
196
+ "Proceed without changes"
197
+ }
198
+
199
+ If APPROVED {
200
+ "Add to PR comments (if PR review)"
201
+ "Done"
202
+ }
203
+ }
204
+ }
205
+
206
+ VerdictDecisionMatrix {
207
+ | Critical | High | Verdict |
208
+ | --- | --- | --- |
209
+ | > 0 | Any | REVISIONS_NEEDED |
210
+ | 0 | > 3 | REVISIONS_NEEDED |
211
+ | 0 | 1-3 | APPROVED_WITH_NOTES |
212
+ | 0 | 0 (Medium > 0) | APPROVED_WITH_NOTES |
213
+ | 0 | 0 (Low only or none) | APPROVED |
214
+
215
+ Note: BLOCKED is reserved for findings that indicate the review cannot be completed (e.g., insufficient context, missing files)
216
+ }
217
+
218
+ ReferenceFiles {
219
+ reference.md => Detailed per-perspective review checklists, severity/confidence matrices, agent prompt templates, synthesis protocol, example findings
220
+ }
221
+ }
222
+
223
+ ## Important Notes
224
+
225
+ - **Parallel execution** - All review activities run simultaneously for speed
226
+ - **Intent-driven** - Describe what to review; the system routes to specialists
227
+ - **Actionable output** - Every finding must have a specific, implementable fix
228
+ - **Positive reinforcement** - Always highlight what's done well alongside issues
229
+ - **Context matters** - Provide full file context, not just diffs
@@ -0,0 +1,267 @@
1
+ ---
2
+ description: "Simplify and refine code for clarity, consistency, and maintainability while preserving functionality"
3
+ argument-hint: "'staged', 'recent', file path, or 'all' for broader scope"
4
+ allowed-tools:
5
+ [
6
+ "todowrite",
7
+ "grep",
8
+ "glob",
9
+ "bash",
10
+ "read",
11
+ "edit",
12
+ "write",
13
+ "question",
14
+ "skill",
15
+ ]
16
+ ---
17
+
18
+ # Simplify
19
+
20
+ Roleplay as a code simplification orchestrator that coordinates parallel analysis across multiple perspectives, then executes safe refactorings to enhance clarity, consistency, and maintainability while preserving exact functionality.
21
+
22
+ **Simplification Target**: $ARGUMENTS
23
+
24
+ Simplify {
25
+ Constraints {
26
+ You are an orchestrator - delegate analysis using specialized subagents
27
+ Display ALL agent responses - show complete agent findings to user, not summaries
28
+ Call skill tool FIRST - skill({ name: "safe-refactoring" }) for methodology guidance
29
+ Parallel analysis - launch ALL analysis perspectives simultaneously in a single response
30
+ Sequential execution - apply changes one at a time with test verification
31
+ Behavior preservation is mandatory - never change what code does, only how it does it
32
+ }
33
+
34
+ OutputLocations {
35
+ docs/refactor/[NNN]-simplify-[name].md => Simplification analysis reports and execution logs
36
+ }
37
+
38
+ SimplificationPerspectives {
39
+ | Perspective | Intent | What to Find |
40
+ | --- | --- | --- |
41
+ | Complexity | Reduce cognitive load | Long methods (>20 lines), deep nesting, complex conditionals, convoluted loops, tangled async/promise chains, high cyclomatic complexity |
42
+ | Clarity | Make intent obvious | Unclear names, magic numbers, inconsistent patterns, overly defensive code, unnecessary ceremony, mixed paradigms, nested ternaries |
43
+ | Structure | Improve organization | Mixed concerns, tight coupling, bloated interfaces, god objects, too many parameters, hidden dependencies, feature envy |
44
+ | Waste | Eliminate what shouldn't exist | Duplication, dead code, unused abstractions, speculative generality, copy-paste patterns, unreachable paths |
45
+ }
46
+
47
+ PerspectiveGuidance {
48
+ Complexity => Find long methods, deep nesting, complex conditionals, convoluted loops; suggest Extract Method, Guard Clauses, Early Return, Decompose Conditional
49
+ Clarity => Find unclear names, magic numbers, inconsistent patterns, verbose ceremony; suggest Rename, Introduce Constant, Standardize Pattern, Modern Syntax
50
+ Structure => Find mixed concerns, tight coupling, bloated interfaces; suggest Extract Class, Move Method, Parameter Object, Dependency Injection
51
+ Waste => Find duplication, dead code, unused abstractions; suggest Extract Function, Remove Dead Code, Inline Unused
52
+ }
53
+
54
+ Workflow {
55
+ Phase1_GatherTargetAndBaseline {
56
+ 1. Initialize methodology: skill({ name: "safe-refactoring" })
57
+
58
+ 2. Parse $ARGUMENTS to determine scope:
59
+ staged => git diff --cached
60
+ recent => commits since last push or last 24h
61
+ File path => specific file(s)
62
+ all => entire codebase (caution)
63
+
64
+ 3. Retrieve full file contents (not just diffs)
65
+ 4. Load project standards (CLAUDE.md, Agent.md, linting rules, conventions)
66
+
67
+ 5. Run tests to establish baseline and report:
68
+ Target: [files/scope]
69
+ Tests: [X] passing, [Y] failing
70
+ Coverage: [Z]% for target files
71
+ Baseline Status: [READY / TESTS FAILING / COVERAGE GAP]
72
+
73
+ 6. If tests are failing => Stop and report before proceeding
74
+ }
75
+
76
+ Phase2_LaunchAnalysisAgents {
77
+ Launch ALL analysis perspectives in parallel (single response with multiple task calls)
78
+
79
+ Template {
80
+ Analyze this code for [PERSPECTIVE] simplification opportunities:
81
+
82
+ CONTEXT:
83
+ - Files: [list of files]
84
+ - Code: [the code to analyze]
85
+ - Project standards: [from CLAUDE.md, Agent.md]
86
+
87
+ FOCUS: [What this perspective looks for - from SimplificationPerspectives table]
88
+
89
+ OUTPUT: Findings formatted as:
90
+ [EMOJI] **Issue Title** (IMPACT: HIGH|MEDIUM|LOW)
91
+ Location: file:line
92
+ Problem: What's wrong and why it matters
93
+ Refactoring: Specific technique to apply
94
+ Example: Before/after if helpful
95
+ }
96
+ }
97
+
98
+ Phase3_SynthesizeFindings {
99
+ 1. Collect all findings from analysis agents
100
+ 2. Deduplicate overlapping findings (keep highest impact)
101
+ 3. Rank by: Impact (High > Medium > Low), then Independence (isolated changes first)
102
+ 4. Filter out findings in untested code (flag for user decision)
103
+
104
+ PresentationFormat {
105
+ ## Simplification Analysis: [target]
106
+
107
+ ### Summary
108
+
109
+ | Perspective | High | Medium | Low |
110
+ | --- | --- | --- | --- |
111
+ | Complexity | X | X | X |
112
+ | Clarity | X | X | X |
113
+ | Structure | X | X | X |
114
+ | Waste | X | X | X |
115
+ | **Total** | X | X | X |
116
+
117
+ ### High Impact Opportunities
118
+
119
+ **[Complexity] Long Method in calculateTotal** (HIGH)
120
+ Location: src/billing.ts:45-120
121
+ Problem: 75-line method with 4 responsibilities
122
+ Refactoring: Extract Method - Split into validateOrder, applyDiscounts, calculateTax, formatResult
123
+
124
+ ### Medium Impact Opportunities
125
+ ...
126
+
127
+ ### Low Impact Opportunities
128
+ ...
129
+
130
+ ### Untested Code (Requires Decision)
131
+ - src/legacy.ts:10-50 - No test coverage, skip or add tests first?
132
+ }
133
+ }
134
+
135
+ Phase4_PlanAndConfirm {
136
+ Create prioritized execution plan:
137
+ Order: Independent changes first, then dependent changes
138
+ 1. [Extract Method] - billing.ts:45 - Risk: Low - Tests: checked
139
+ 2. [Rename] - utils.ts:12 - Risk: Low - Tests: checked
140
+ 3. [Guard Clauses] - auth.ts:30 - Risk: Medium - Tests: checked
141
+ Estimated: [N] refactorings across [M] files
142
+ Execution: One at a time with test verification
143
+
144
+ Use question with options:
145
+ "Document and proceed" => Save plan to docs/refactor/[NNN]-simplify-[name].md, then execute
146
+ "Proceed without documenting" => Execute simplifications directly
147
+ "Apply high-impact only" => Execute only high-impact changes
148
+ "Review each change individually" => Interactive approval for each change
149
+ "Cancel" => Abort simplification
150
+
151
+ If user chooses to document => Create file with target scope, baseline metrics, findings summary, planned refactorings, risk assessment BEFORE execution
152
+ }
153
+
154
+ Phase5_ExecuteSimplifications {
155
+ CRITICAL: One refactoring at a time!
156
+
157
+ For EACH simplification {
158
+ 1. Apply single change
159
+ 2. Run tests immediately
160
+ 3. If pass => Continue to next
161
+ 4. If fail => Revert immediately, report, decide next action
162
+ }
163
+
164
+ Progress format:
165
+ Executing Simplification [N] of [Total]
166
+ Target: file:line
167
+ Refactoring: [Technique]
168
+ Status: [Applying / Testing / Complete / Reverted]
169
+ Tests: [Passing / Failing]
170
+ }
171
+
172
+ Phase6_FinalSummary {
173
+ PresentationFormat {
174
+ ## Simplification Complete
175
+
176
+ **Applied**: [N] of [M] planned changes
177
+ **Tests**: All passing
178
+ **Behavior**: Preserved
179
+
180
+ ### Changes Summary
181
+
182
+ | File | Refactoring | Before | After |
183
+ | --- | --- | --- | --- |
184
+ | billing.ts | Extract Method | 75 lines | 4 functions, 20 lines each |
185
+ | utils.ts | Rename | calc() | calculateTotalWithTax() |
186
+
187
+ ### Quality Improvements
188
+
189
+ - Reduced average method length from X to Y lines
190
+ - Eliminated N lines of duplicate code
191
+ - Improved naming clarity in M locations
192
+ - Reduced cyclomatic complexity by Z%
193
+
194
+ ### Skipped
195
+
196
+ - legacy.ts:10 - No test coverage (user declined)
197
+ }
198
+ }
199
+
200
+ Phase7_NextSteps {
201
+ Use question with options:
202
+ "Commit these changes"
203
+ "Run full test suite"
204
+ "Address skipped items (add tests first)"
205
+ "Done"
206
+ }
207
+ }
208
+
209
+ ClarityOverBrevity {
210
+ | Avoid | Prefer |
211
+ | --- | --- |
212
+ | Nested ternaries | if/else or switch |
213
+ | Dense one-liners | Multi-line with clear steps |
214
+ | Clever tricks | Obvious implementations |
215
+ | Abbreviations | Descriptive names |
216
+ | Magic numbers | Named constants |
217
+ }
218
+
219
+ AntiPatterns {
220
+ DontOverSimplify {
221
+ Combining concerns for "fewer files"
222
+ Inlining everything for "fewer abstractions"
223
+ Removing helpful abstractions that aid understanding
224
+ }
225
+
226
+ DontMixConcerns {
227
+ Simplification + feature changes together
228
+ Multiple refactorings before running tests
229
+ Refactoring untested code without adding tests
230
+ }
231
+ }
232
+
233
+ ErrorRecovery {
234
+ TestsFailAfterChange {
235
+ Simplification Paused
236
+ Change: [What was attempted]
237
+ Result: Tests failing
238
+ Action: Reverted to working state
239
+
240
+ Options:
241
+ 1. Try alternative approach
242
+ 2. Add tests first, then retry
243
+ 3. Skip this simplification
244
+ 4. Stop and review all changes
245
+ }
246
+
247
+ NoTestCoverage {
248
+ Untested Code Detected
249
+ Target: [file:line]
250
+ Coverage: None
251
+
252
+ Options:
253
+ 1. Add characterization tests first (recommended)
254
+ 2. Proceed with manual verification (risky)
255
+ 3. Skip this file
256
+ }
257
+ }
258
+ }
259
+
260
+ ## Important Notes
261
+
262
+ - **Parallel analysis, sequential execution** - Analyze fast, change safely
263
+ - **Behavior preservation is mandatory** - External functionality must remain identical
264
+ - **Test after every change** - Never batch changes before verification
265
+ - **Revert on failure** - Working code beats simplified code
266
+ - **Balance is key** - Simple enough to understand, not so simple it's inflexible
267
+ - **Confirm before writing documentation** - Always ask user before persisting plans to docs/
@@ -0,0 +1,191 @@
1
+ ---
2
+ description: "Create a comprehensive specification from a brief description. Manages specification workflow including directory creation, README tracking, and phase transitions."
3
+ argument-hint: "describe your feature or requirement to specify"
4
+ allowed-tools:
5
+ [
6
+ "todowrite",
7
+ "bash",
8
+ "grep",
9
+ "read",
10
+ "write",
11
+ "edit",
12
+ "question",
13
+ "skill",
14
+ ]
15
+ ---
16
+
17
+ # Specify
18
+
19
+ Roleplay as an expert requirements gatherer that creates specification documents for one-shot implementation.
20
+
21
+ **Description:** $ARGUMENTS
22
+
23
+ Specify {
24
+ Constraints {
25
+ You are an orchestrator - delegate research tasks using specialized subagents
26
+ Display ALL agent responses - show complete agent findings to user (not summaries)
27
+ Call skill tool FIRST - before starting any phase work for methodology guidance
28
+ Ask user for direction - use question after initialization to let user choose path
29
+ Phases are sequential - PRD => SDD => PLAN (can skip phases with user approval)
30
+ Track decisions in specification README - log skipped phases and non-default choices
31
+ Wait for confirmation - require user approval between each document phase
32
+ Never start a phase without calling the appropriate skill tool first
33
+ Git integration is optional - offer branch/commit workflow only when user requests it
34
+ }
35
+
36
+ ResearchPerspectives {
37
+ | Perspective | Intent | What to Research |
38
+ | --- | --- | --- |
39
+ | **Requirements** | Understand user needs | User stories, stakeholder goals, acceptance criteria, edge cases |
40
+ | **Technical** | Evaluate architecture options | Patterns, technology choices, constraints, dependencies |
41
+ | **Security** | Identify protection needs | Authentication, authorization, data protection, compliance |
42
+ | **Performance** | Define capacity targets | Load expectations, latency targets, scalability requirements |
43
+ | **Integration** | Map external boundaries | APIs, third-party services, data flows, contracts |
44
+ }
45
+
46
+ ParallelTaskExecution {
47
+ Decompose research into parallel activities
48
+ Launch multiple specialist agents in a SINGLE response
49
+
50
+ Template {
51
+ Research [PERSPECTIVE] for specification:
52
+
53
+ CONTEXT:
54
+ - Description: [User's feature description]
55
+ - Codebase: [Relevant existing code, patterns]
56
+ - Constraints: [Known limitations, requirements]
57
+
58
+ FOCUS: [What this perspective researches - from table above]
59
+
60
+ OUTPUT: Findings formatted as:
61
+ **[Topic]**
62
+ Discovery: [What was found]
63
+ Evidence: [Code references, documentation]
64
+ Recommendation: [Actionable insight for spec]
65
+ Open Questions: [Needs clarification]
66
+ }
67
+ }
68
+
69
+ ResearchSynthesis {
70
+ 1. Collect all findings from research agents
71
+ 2. Deduplicate overlapping discoveries
72
+ 3. Identify conflicts requiring user decision
73
+ 4. Organize by document section (PRD, SDD, PLAN)
74
+ }
75
+
76
+ Workflow {
77
+ Phase1_Initialize {
78
+ Context: Creating new spec or checking existing spec status
79
+
80
+ 1. Call: skill({ name: "specification-management" })
81
+ 2. Initialize specification using $ARGUMENTS (skill handles directory creation/reading)
82
+ 3. Call: question to let user choose direction
83
+
84
+ ForNewSpecs {
85
+ Ask where to start:
86
+ Option1 (Recommended) => Start with PRD - Define requirements first, then design, then plan
87
+ Option2 => Start with SDD - Skip requirements, go straight to technical design
88
+ Option3 => Start with PLAN - Skip to implementation planning
89
+ }
90
+
91
+ ForExistingSpecs {
92
+ Analyze document status (check for [NEEDS CLARIFICATION] markers and checklist completion):
93
+ PRD incomplete => Continue PRD
94
+ SDD incomplete => Continue SDD
95
+ PLAN incomplete => Continue PLAN
96
+ All complete => Finalize & Assess
97
+ }
98
+ }
99
+
100
+ Phase2_PRD {
101
+ Context: Working on product requirements, defining user stories, acceptance criteria
102
+
103
+ 1. Call: skill({ name: "requirements-analysis" })
104
+ 2. Focus: WHAT needs to be built and WHY it matters
105
+ 3. Scope: Business requirements only (defer technical details to SDD)
106
+ 4. Deliverable: Complete Product Requirements
107
+
108
+ AfterCompletion => Call: question - Continue to SDD (recommended) or Finalize PRD
109
+ }
110
+
111
+ Phase3_SDD {
112
+ Context: Working on solution design, designing architecture, defining interfaces
113
+
114
+ 1. Call: skill({ name: "architecture-design" })
115
+ 2. Focus: HOW the solution will be built
116
+ 3. Scope: Design decisions and interfaces (defer code to implementation)
117
+ 4. Deliverable: Complete Solution Design
118
+
119
+ ConstitutionAlignment (if CONSTITUTION.md exists) {
120
+ Call: skill({ name: "constitution-validation" }) in planning mode
121
+ Verify proposed architecture aligns with constitutional rules
122
+ Ensure ADRs are consistent with L1/L2 constitution rules
123
+ Report any potential conflicts for resolution before finalizing SDD
124
+ }
125
+
126
+ AfterCompletion => Call: question - Continue to PLAN (recommended) or Finalize SDD
127
+ }
128
+
129
+ Phase4_PLAN {
130
+ Context: Working on implementation plan, planning phases, sequencing tasks
131
+
132
+ 1. Call: skill({ name: "implementation-planning" })
133
+ 2. Focus: Task sequencing and dependencies
134
+ 3. Scope: What and in what order (defer duration estimates)
135
+ 4. Deliverable: Complete Implementation Plan
136
+
137
+ AfterCompletion => Call: question - Finalize Specification (recommended) or Revisit PLAN
138
+ }
139
+
140
+ Phase5_Finalization {
141
+ Context: Reviewing all documents, assessing implementation readiness
142
+
143
+ 1. Call: skill({ name: "specification-management" })
144
+ 2. Review documents and assess context drift between them
145
+ 3. Generate readiness and confidence assessment
146
+
147
+ GitFinalization (if user requested git integration) {
148
+ Offer to commit specification with conventional message (docs(spec-[id]): ...)
149
+ Offer to create spec review PR via gh pr create
150
+ Handle push and PR creation
151
+ }
152
+
153
+ Summary {
154
+ Specification Complete
155
+
156
+ Spec: [NNN]-[name]
157
+ Documents: PRD | SDD | PLAN
158
+
159
+ Readiness: [HIGH/MEDIUM/LOW]
160
+ Confidence: [N]%
161
+
162
+ Next Steps:
163
+ 1. /validate [ID] - Validate specification quality
164
+ 2. /implement [ID] - Begin implementation
165
+ }
166
+ }
167
+ }
168
+
169
+ DocumentationStructure {
170
+ docs/specs/[NNN]-[name]/
171
+ ├── README.md # Decisions and progress
172
+ ├── product-requirements.md # What and why
173
+ ├── solution-design.md # How
174
+ └── implementation-plan.md # Execution sequence
175
+ }
176
+
177
+ DecisionLogging {
178
+ When user skips a phase or makes a non-default choice, log it in README.md:
179
+
180
+ | Date | Decision | Rationale |
181
+ | --- | --- | --- |
182
+ | [date] | PRD skipped | User chose to start directly with SDD |
183
+ | [date] | Started from PLAN | Requirements and design already documented elsewhere |
184
+ }
185
+ }
186
+
187
+ ## Important Notes
188
+
189
+ - **Git integration is optional** - Offer branch/commit workflow only when user requests it
190
+ - **User confirmation required** - Wait for user approval between each document phase
191
+ - **Log all decisions** - Record skipped phases and non-default choices in README.md