@chankov/agent-skills 0.3.2 → 0.3.3

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 (159) hide show
  1. package/.versions/0.3.3/.claude/commands/build.md +18 -0
  2. package/.versions/0.3.3/.claude/commands/code-simplify.md +22 -0
  3. package/.versions/0.3.3/.claude/commands/design-agent.md +14 -0
  4. package/.versions/0.3.3/.claude/commands/doctor-agent-skills.md +13 -0
  5. package/.versions/0.3.3/.claude/commands/plan.md +16 -0
  6. package/.versions/0.3.3/.claude/commands/prime.md +22 -0
  7. package/.versions/0.3.3/.claude/commands/review.md +16 -0
  8. package/.versions/0.3.3/.claude/commands/setup-agent-skills.md +19 -0
  9. package/.versions/0.3.3/.claude/commands/ship.md +17 -0
  10. package/.versions/0.3.3/.claude/commands/spec.md +15 -0
  11. package/.versions/0.3.3/.claude/commands/test.md +19 -0
  12. package/.versions/0.3.3/.opencode/commands/as-build.md +17 -0
  13. package/.versions/0.3.3/.opencode/commands/as-code-simplify.md +16 -0
  14. package/.versions/0.3.3/.opencode/commands/as-design-agent.md +15 -0
  15. package/.versions/0.3.3/.opencode/commands/as-doctor-agent-skills.md +11 -0
  16. package/.versions/0.3.3/.opencode/commands/as-plan.md +16 -0
  17. package/.versions/0.3.3/.opencode/commands/as-prime.md +22 -0
  18. package/.versions/0.3.3/.opencode/commands/as-review.md +15 -0
  19. package/.versions/0.3.3/.opencode/commands/as-setup-agent-skills.md +11 -0
  20. package/.versions/0.3.3/.opencode/commands/as-ship.md +16 -0
  21. package/.versions/0.3.3/.opencode/commands/as-spec.md +16 -0
  22. package/.versions/0.3.3/.opencode/commands/as-test.md +21 -0
  23. package/.versions/0.3.3/.pi/agents/agent-chain.yaml +49 -0
  24. package/.versions/0.3.3/.pi/agents/bowser.md +19 -0
  25. package/.versions/0.3.3/.pi/agents/pi-pi/agent-expert.md +98 -0
  26. package/.versions/0.3.3/.pi/agents/pi-pi/cli-expert.md +41 -0
  27. package/.versions/0.3.3/.pi/agents/pi-pi/config-expert.md +63 -0
  28. package/.versions/0.3.3/.pi/agents/pi-pi/ext-expert.md +43 -0
  29. package/.versions/0.3.3/.pi/agents/pi-pi/keybinding-expert.md +134 -0
  30. package/.versions/0.3.3/.pi/agents/pi-pi/pi-orchestrator.md +57 -0
  31. package/.versions/0.3.3/.pi/agents/pi-pi/prompt-expert.md +70 -0
  32. package/.versions/0.3.3/.pi/agents/pi-pi/skill-expert.md +42 -0
  33. package/.versions/0.3.3/.pi/agents/pi-pi/theme-expert.md +40 -0
  34. package/.versions/0.3.3/.pi/agents/pi-pi/tui-expert.md +85 -0
  35. package/.versions/0.3.3/.pi/agents/teams.yaml +31 -0
  36. package/.versions/0.3.3/.pi/damage-control-rules.yaml +278 -0
  37. package/.versions/0.3.3/.pi/extensions/agent-skills-update-check/README.md +58 -0
  38. package/.versions/0.3.3/.pi/extensions/agent-skills-update-check/index.ts +161 -0
  39. package/.versions/0.3.3/.pi/extensions/agent-skills-update-check/package.json +6 -0
  40. package/.versions/0.3.3/.pi/extensions/chrome-devtools-mcp/README.md +39 -0
  41. package/.versions/0.3.3/.pi/extensions/chrome-devtools-mcp/index.ts +61 -0
  42. package/.versions/0.3.3/.pi/extensions/chrome-devtools-mcp/package.json +6 -0
  43. package/.versions/0.3.3/.pi/extensions/compact-and-continue/README.md +42 -0
  44. package/.versions/0.3.3/.pi/extensions/compact-and-continue/index.ts +120 -0
  45. package/.versions/0.3.3/.pi/extensions/compact-and-continue/package.json +6 -0
  46. package/.versions/0.3.3/.pi/extensions/mcp-bridge/README.md +46 -0
  47. package/.versions/0.3.3/.pi/extensions/mcp-bridge/index.ts +206 -0
  48. package/.versions/0.3.3/.pi/extensions/mcp-bridge/package.json +6 -0
  49. package/.versions/0.3.3/.pi/extensions/package-lock.json +1143 -0
  50. package/.versions/0.3.3/.pi/extensions/package.json +9 -0
  51. package/.versions/0.3.3/.pi/harnesses/agent-chain/README.md +37 -0
  52. package/.versions/0.3.3/.pi/harnesses/agent-chain/index.ts +795 -0
  53. package/.versions/0.3.3/.pi/harnesses/agent-chain/package.json +6 -0
  54. package/.versions/0.3.3/.pi/harnesses/agent-team/README.md +38 -0
  55. package/.versions/0.3.3/.pi/harnesses/agent-team/index.ts +732 -0
  56. package/.versions/0.3.3/.pi/harnesses/agent-team/package.json +6 -0
  57. package/.versions/0.3.3/.pi/harnesses/coms/README.md +36 -0
  58. package/.versions/0.3.3/.pi/harnesses/coms/index.ts +1595 -0
  59. package/.versions/0.3.3/.pi/harnesses/coms/package.json +6 -0
  60. package/.versions/0.3.3/.pi/harnesses/coms-net/README.md +46 -0
  61. package/.versions/0.3.3/.pi/harnesses/coms-net/index.ts +1637 -0
  62. package/.versions/0.3.3/.pi/harnesses/coms-net/package.json +6 -0
  63. package/.versions/0.3.3/.pi/harnesses/damage-control/README.md +38 -0
  64. package/.versions/0.3.3/.pi/harnesses/damage-control/index.ts +207 -0
  65. package/.versions/0.3.3/.pi/harnesses/damage-control/package.json +6 -0
  66. package/.versions/0.3.3/.pi/harnesses/damage-control-continue/README.md +37 -0
  67. package/.versions/0.3.3/.pi/harnesses/damage-control-continue/index.ts +234 -0
  68. package/.versions/0.3.3/.pi/harnesses/damage-control-continue/package.json +6 -0
  69. package/.versions/0.3.3/.pi/harnesses/minimal/README.md +27 -0
  70. package/.versions/0.3.3/.pi/harnesses/minimal/index.ts +32 -0
  71. package/.versions/0.3.3/.pi/harnesses/minimal/package.json +6 -0
  72. package/.versions/0.3.3/.pi/harnesses/package-lock.json +35 -0
  73. package/.versions/0.3.3/.pi/harnesses/package.json +9 -0
  74. package/.versions/0.3.3/.pi/harnesses/pi-pi/README.md +39 -0
  75. package/.versions/0.3.3/.pi/harnesses/pi-pi/index.ts +631 -0
  76. package/.versions/0.3.3/.pi/harnesses/pi-pi/package.json +6 -0
  77. package/.versions/0.3.3/.pi/harnesses/purpose-gate/README.md +27 -0
  78. package/.versions/0.3.3/.pi/harnesses/purpose-gate/index.ts +82 -0
  79. package/.versions/0.3.3/.pi/harnesses/purpose-gate/package.json +6 -0
  80. package/.versions/0.3.3/.pi/harnesses/session-replay/README.md +28 -0
  81. package/.versions/0.3.3/.pi/harnesses/session-replay/index.ts +214 -0
  82. package/.versions/0.3.3/.pi/harnesses/session-replay/package.json +6 -0
  83. package/.versions/0.3.3/.pi/harnesses/subagent-widget/README.md +36 -0
  84. package/.versions/0.3.3/.pi/harnesses/subagent-widget/index.ts +479 -0
  85. package/.versions/0.3.3/.pi/harnesses/subagent-widget/package.json +6 -0
  86. package/.versions/0.3.3/.pi/harnesses/system-select/README.md +39 -0
  87. package/.versions/0.3.3/.pi/harnesses/system-select/index.ts +165 -0
  88. package/.versions/0.3.3/.pi/harnesses/system-select/package.json +6 -0
  89. package/.versions/0.3.3/.pi/harnesses/tilldone/README.md +35 -0
  90. package/.versions/0.3.3/.pi/harnesses/tilldone/index.ts +724 -0
  91. package/.versions/0.3.3/.pi/harnesses/tilldone/package.json +6 -0
  92. package/.versions/0.3.3/.pi/harnesses/tool-counter/README.md +31 -0
  93. package/.versions/0.3.3/.pi/harnesses/tool-counter/index.ts +100 -0
  94. package/.versions/0.3.3/.pi/harnesses/tool-counter/package.json +6 -0
  95. package/.versions/0.3.3/.pi/harnesses/tool-counter-widget/README.md +27 -0
  96. package/.versions/0.3.3/.pi/harnesses/tool-counter-widget/index.ts +66 -0
  97. package/.versions/0.3.3/.pi/harnesses/tool-counter-widget/package.json +6 -0
  98. package/.versions/0.3.3/.pi/prompts/build.md +24 -0
  99. package/.versions/0.3.3/.pi/prompts/code-simplify.md +22 -0
  100. package/.versions/0.3.3/.pi/prompts/doctor-agent-skills.md +13 -0
  101. package/.versions/0.3.3/.pi/prompts/plan.md +16 -0
  102. package/.versions/0.3.3/.pi/prompts/review.md +16 -0
  103. package/.versions/0.3.3/.pi/prompts/setup-agent-skills.md +19 -0
  104. package/.versions/0.3.3/.pi/prompts/ship.md +17 -0
  105. package/.versions/0.3.3/.pi/prompts/spec.md +15 -0
  106. package/.versions/0.3.3/.pi/prompts/test.md +19 -0
  107. package/.versions/0.3.3/.pi/skills/bowser/SKILL.md +114 -0
  108. package/.versions/0.3.3/.version +1 -0
  109. package/.versions/0.3.3/agents/builder.md +6 -0
  110. package/.versions/0.3.3/agents/code-reviewer.md +93 -0
  111. package/.versions/0.3.3/agents/documenter.md +6 -0
  112. package/.versions/0.3.3/agents/plan-reviewer.md +22 -0
  113. package/.versions/0.3.3/agents/planner.md +6 -0
  114. package/.versions/0.3.3/agents/scout.md +6 -0
  115. package/.versions/0.3.3/agents/security-auditor.md +97 -0
  116. package/.versions/0.3.3/agents/test-engineer.md +89 -0
  117. package/.versions/0.3.3/hooks/SIMPLIFY-IGNORE.md +90 -0
  118. package/.versions/0.3.3/hooks/hooks.json +14 -0
  119. package/.versions/0.3.3/hooks/session-start.sh +74 -0
  120. package/.versions/0.3.3/hooks/simplify-ignore-test.sh +247 -0
  121. package/.versions/0.3.3/hooks/simplify-ignore.sh +302 -0
  122. package/.versions/0.3.3/references/accessibility-checklist.md +159 -0
  123. package/.versions/0.3.3/references/performance-checklist.md +121 -0
  124. package/.versions/0.3.3/references/prompting-patterns.md +380 -0
  125. package/.versions/0.3.3/references/security-checklist.md +134 -0
  126. package/.versions/0.3.3/references/testing-patterns.md +236 -0
  127. package/.versions/0.3.3/scripts/coms-net-server.ts +1741 -0
  128. package/.versions/0.3.3/skills/api-and-interface-design/SKILL.md +294 -0
  129. package/.versions/0.3.3/skills/browser-testing-with-devtools/SKILL.md +335 -0
  130. package/.versions/0.3.3/skills/ci-cd-and-automation/SKILL.md +390 -0
  131. package/.versions/0.3.3/skills/code-review-and-quality/SKILL.md +347 -0
  132. package/.versions/0.3.3/skills/code-simplification/SKILL.md +331 -0
  133. package/.versions/0.3.3/skills/context-engineering/SKILL.md +291 -0
  134. package/.versions/0.3.3/skills/debugging-and-error-recovery/SKILL.md +300 -0
  135. package/.versions/0.3.3/skills/deprecation-and-migration/SKILL.md +206 -0
  136. package/.versions/0.3.3/skills/designing-agents/SKILL.md +394 -0
  137. package/.versions/0.3.3/skills/designing-agents/pi-harness-authoring.md +213 -0
  138. package/.versions/0.3.3/skills/documentation-and-adrs/SKILL.md +278 -0
  139. package/.versions/0.3.3/skills/frontend-ui-engineering/SKILL.md +322 -0
  140. package/.versions/0.3.3/skills/git-workflow-and-versioning/SKILL.md +316 -0
  141. package/.versions/0.3.3/skills/guided-workspace-setup/SKILL.md +345 -0
  142. package/.versions/0.3.3/skills/idea-refine/SKILL.md +178 -0
  143. package/.versions/0.3.3/skills/idea-refine/examples.md +238 -0
  144. package/.versions/0.3.3/skills/idea-refine/frameworks.md +99 -0
  145. package/.versions/0.3.3/skills/idea-refine/refinement-criteria.md +113 -0
  146. package/.versions/0.3.3/skills/idea-refine/scripts/idea-refine.sh +15 -0
  147. package/.versions/0.3.3/skills/incremental-implementation/SKILL.md +279 -0
  148. package/.versions/0.3.3/skills/performance-optimization/SKILL.md +350 -0
  149. package/.versions/0.3.3/skills/planning-and-task-breakdown/SKILL.md +237 -0
  150. package/.versions/0.3.3/skills/security-and-hardening/SKILL.md +349 -0
  151. package/.versions/0.3.3/skills/shipping-and-launch/SKILL.md +309 -0
  152. package/.versions/0.3.3/skills/source-driven-development/SKILL.md +194 -0
  153. package/.versions/0.3.3/skills/spec-driven-development/SKILL.md +237 -0
  154. package/.versions/0.3.3/skills/test-driven-development/SKILL.md +379 -0
  155. package/.versions/0.3.3/skills/using-agent-skills/SKILL.md +176 -0
  156. package/CHANGELOG.md +17 -0
  157. package/bin/snapshot-version.js +8 -1
  158. package/package.json +2 -1
  159. package/scripts/coms-net-server.ts +1741 -0
@@ -0,0 +1,347 @@
1
+ ---
2
+ name: code-review-and-quality
3
+ description: Conducts multi-axis code review. Use before merging any change. Use when reviewing code written by yourself, another agent, or a human. Use when you need to assess code quality across multiple dimensions before it enters the main branch.
4
+ ---
5
+
6
+ # Code Review and Quality
7
+
8
+ ## Overview
9
+
10
+ Multi-dimensional code review with quality gates. Every change gets reviewed before merge — no exceptions. Review covers five axes: correctness, readability, architecture, security, and performance.
11
+
12
+ **The approval standard:** Approve a change when it definitely improves overall code health, even if it isn't perfect. Perfect code doesn't exist — the goal is continuous improvement. Don't block a change because it isn't exactly how you would have written it. If it improves the codebase and follows the project's conventions, approve it.
13
+
14
+ ## When to Use
15
+
16
+ - Before merging any PR or change
17
+ - After completing a feature implementation
18
+ - When another agent or model produced code you need to evaluate
19
+ - When refactoring existing code
20
+ - After any bug fix (review both the fix and the regression test)
21
+
22
+ ## The Five-Axis Review
23
+
24
+ Every review evaluates code across these dimensions:
25
+
26
+ ### 1. Correctness
27
+
28
+ Does the code do what it claims to do?
29
+
30
+ - Does it match the spec or task requirements?
31
+ - Are edge cases handled (null, empty, boundary values)?
32
+ - Are error paths handled (not just the happy path)?
33
+ - Does it pass all tests? Are the tests actually testing the right things?
34
+ - Are there off-by-one errors, race conditions, or state inconsistencies?
35
+
36
+ ### 2. Readability & Simplicity
37
+
38
+ Can another engineer (or agent) understand this code without the author explaining it?
39
+
40
+ - Are names descriptive and consistent with project conventions? (No `temp`, `data`, `result` without context)
41
+ - Is the control flow straightforward (avoid nested ternaries, deep callbacks)?
42
+ - Is the code organized logically (related code grouped, clear module boundaries)?
43
+ - Are there any "clever" tricks that should be simplified?
44
+ - **Could this be done in fewer lines?** (1000 lines where 100 suffice is a failure)
45
+ - **Are abstractions earning their complexity?** (Don't generalize until the third use case)
46
+ - Would comments help clarify non-obvious intent? (But don't comment obvious code.)
47
+ - Are there dead code artifacts: no-op variables (`_unused`), backwards-compat shims, or `// removed` comments?
48
+
49
+ ### 3. Architecture
50
+
51
+ Does the change fit the system's design?
52
+
53
+ - Does it follow existing patterns or introduce a new one? If new, is it justified?
54
+ - Does it maintain clean module boundaries?
55
+ - Is there code duplication that should be shared?
56
+ - Are dependencies flowing in the right direction (no circular dependencies)?
57
+ - Is the abstraction level appropriate (not over-engineered, not too coupled)?
58
+
59
+ ### 4. Security
60
+
61
+ For detailed security guidance, see `security-and-hardening`. Does the change introduce vulnerabilities?
62
+
63
+ - Is user input validated and sanitized?
64
+ - Are secrets kept out of code, logs, and version control?
65
+ - Is authentication/authorization checked where needed?
66
+ - Are SQL queries parameterized (no string concatenation)?
67
+ - Are outputs encoded to prevent XSS?
68
+ - Are dependencies from trusted sources with no known vulnerabilities?
69
+ - Is data from external sources (APIs, logs, user content, config files) treated as untrusted?
70
+ - Are external data flows validated at system boundaries before use in logic or rendering?
71
+
72
+ ### 5. Performance
73
+
74
+ For detailed profiling and optimization, see `performance-optimization`. Does the change introduce performance problems?
75
+
76
+ - Any N+1 query patterns?
77
+ - Any unbounded loops or unconstrained data fetching?
78
+ - Any synchronous operations that should be async?
79
+ - Any unnecessary re-renders in UI components?
80
+ - Any missing pagination on list endpoints?
81
+ - Any large objects created in hot paths?
82
+
83
+ ## Change Sizing
84
+
85
+ Small, focused changes are easier to review, faster to merge, and safer to deploy. Target these sizes:
86
+
87
+ ```
88
+ ~100 lines changed → Good. Reviewable in one sitting.
89
+ ~300 lines changed → Acceptable if it's a single logical change.
90
+ ~1000 lines changed → Too large. Split it.
91
+ ```
92
+
93
+ **What counts as "one change":** A single self-contained modification that addresses one thing, includes related tests, and keeps the system functional after submission. One part of a feature — not the whole feature.
94
+
95
+ **Splitting strategies when a change is too large:**
96
+
97
+ | Strategy | How | When |
98
+ |----------|-----|------|
99
+ | **Stack** | Submit a small change, start the next one based on it | Sequential dependencies |
100
+ | **By file group** | Separate changes for groups needing different reviewers | Cross-cutting concerns |
101
+ | **Horizontal** | Create shared code/stubs first, then consumers | Layered architecture |
102
+ | **Vertical** | Break into smaller full-stack slices of the feature | Feature work |
103
+
104
+ **When large changes are acceptable:** Complete file deletions and automated refactoring where the reviewer only needs to verify intent, not every line.
105
+
106
+ **Separate refactoring from feature work.** A change that refactors existing code and adds new behavior is two changes — submit them separately. Small cleanups (variable renaming) can be included at reviewer discretion.
107
+
108
+ ## Change Descriptions
109
+
110
+ Every change needs a description that stands alone in version control history.
111
+
112
+ **First line:** Short, imperative, standalone. "Delete the FizzBuzz RPC" not "Deleting the FizzBuzz RPC." Must be informative enough that someone searching history can understand the change without reading the diff.
113
+
114
+ **Body:** What is changing and why. Include context, decisions, and reasoning not visible in the code itself. Link to bug numbers, benchmark results, or design docs where relevant. Acknowledge approach shortcomings when they exist.
115
+
116
+ **Anti-patterns:** "Fix bug," "Fix build," "Add patch," "Moving code from A to B," "Phase 1," "Add convenience functions."
117
+
118
+ ## Review Process
119
+
120
+ ### Step 1: Understand the Context
121
+
122
+ Before looking at code, understand the intent:
123
+
124
+ ```
125
+ - What is this change trying to accomplish?
126
+ - What spec or task does it implement?
127
+ - What is the expected behavior change?
128
+ ```
129
+
130
+ ### Step 2: Review the Tests First
131
+
132
+ Tests reveal intent and coverage:
133
+
134
+ ```
135
+ - Do tests exist for the change?
136
+ - Do they test behavior (not implementation details)?
137
+ - Are edge cases covered?
138
+ - Do tests have descriptive names?
139
+ - Would the tests catch a regression if the code changed?
140
+ ```
141
+
142
+ ### Step 3: Review the Implementation
143
+
144
+ Walk through the code with the five axes in mind:
145
+
146
+ ```
147
+ For each file changed:
148
+ 1. Correctness: Does this code do what the test says it should?
149
+ 2. Readability: Can I understand this without help?
150
+ 3. Architecture: Does this fit the system?
151
+ 4. Security: Any vulnerabilities?
152
+ 5. Performance: Any bottlenecks?
153
+ ```
154
+
155
+ ### Step 4: Categorize Findings
156
+
157
+ Label every comment with its severity so the author knows what's required vs optional:
158
+
159
+ | Prefix | Meaning | Author Action |
160
+ |--------|---------|---------------|
161
+ | *(no prefix)* | Required change | Must address before merge |
162
+ | **Critical:** | Blocks merge | Security vulnerability, data loss, broken functionality |
163
+ | **Nit:** | Minor, optional | Author may ignore — formatting, style preferences |
164
+ | **Optional:** / **Consider:** | Suggestion | Worth considering but not required |
165
+ | **FYI** | Informational only | No action needed — context for future reference |
166
+
167
+ This prevents authors from treating all feedback as mandatory and wasting time on optional suggestions.
168
+
169
+ ### Step 5: Verify the Verification
170
+
171
+ Check the author's verification story:
172
+
173
+ ```
174
+ - What tests were run?
175
+ - Did the build pass?
176
+ - Was the change tested manually?
177
+ - Are there screenshots for UI changes?
178
+ - Is there a before/after comparison?
179
+ ```
180
+
181
+ ## Multi-Model Review Pattern
182
+
183
+ Use different models for different review perspectives:
184
+
185
+ ```
186
+ Model A writes the code
187
+
188
+
189
+ Model B reviews for correctness and architecture
190
+
191
+
192
+ Model A addresses the feedback
193
+
194
+
195
+ Human makes the final call
196
+ ```
197
+
198
+ This catches issues that a single model might miss — different models have different blind spots.
199
+
200
+ **Example prompt for a review agent:**
201
+ ```
202
+ Review this code change for correctness, security, and adherence to
203
+ our project conventions. The spec says [X]. The change should [Y].
204
+ Flag any issues as Critical, Important, or Suggestion.
205
+ ```
206
+
207
+ ## Dead Code Hygiene
208
+
209
+ After any refactoring or implementation change, check for orphaned code:
210
+
211
+ 1. Identify code that is now unreachable or unused
212
+ 2. List it explicitly
213
+ 3. **Ask before deleting:** "Should I remove these now-unused elements: [list]?"
214
+
215
+ Don't leave dead code lying around — it confuses future readers and agents. But don't silently delete things you're not sure about. When in doubt, ask.
216
+
217
+ ```
218
+ DEAD CODE IDENTIFIED:
219
+ - formatLegacyDate() in src/utils/date.ts — replaced by formatDate()
220
+ - OldTaskCard component in src/components/ — replaced by TaskCard
221
+ - LEGACY_API_URL constant in src/config.ts — no remaining references
222
+ → Safe to remove these?
223
+ ```
224
+
225
+ ## Review Speed
226
+
227
+ Slow reviews block entire teams. The cost of context-switching to review is less than the waiting cost imposed on others.
228
+
229
+ - **Respond within one business day** — this is the maximum, not the target
230
+ - **Ideal cadence:** Respond shortly after a review request arrives, unless deep in focused coding. A typical change should complete multiple review rounds in a single day
231
+ - **Prioritize fast individual responses** over quick final approval. Quick feedback reduces frustration even if multiple rounds are needed
232
+ - **Large changes:** Ask the author to split them rather than reviewing one massive changeset
233
+
234
+ ## Handling Disagreements
235
+
236
+ When resolving review disputes, apply this hierarchy:
237
+
238
+ 1. **Technical facts and data** override opinions and preferences
239
+ 2. **Style guides** are the absolute authority on style matters
240
+ 3. **Software design** must be evaluated on engineering principles, not personal preference
241
+ 4. **Codebase consistency** is acceptable if it doesn't degrade overall health
242
+
243
+ **Don't accept "I'll clean it up later."** Experience shows deferred cleanup rarely happens. Require cleanup before submission unless it's a genuine emergency. If surrounding issues can't be addressed in this change, require filing a bug with self-assignment.
244
+
245
+ ## Honesty in Review
246
+
247
+ When reviewing code — whether written by you, another agent, or a human:
248
+
249
+ - **Don't rubber-stamp.** "LGTM" without evidence of review helps no one.
250
+ - **Don't soften real issues.** "This might be a minor concern" when it's a bug that will hit production is dishonest.
251
+ - **Quantify problems when possible.** "This N+1 query will add ~50ms per item in the list" is better than "this could be slow."
252
+ - **Push back on approaches with clear problems.** Sycophancy is a failure mode in reviews. If the implementation has issues, say so directly and propose alternatives.
253
+ - **Accept override gracefully.** If the author has full context and disagrees, defer to their judgment. Comment on code, not people — reframe personal critiques to focus on the code itself.
254
+
255
+ ## Dependency Discipline
256
+
257
+ Part of code review is dependency review:
258
+
259
+ **Before adding any dependency:**
260
+ 1. Does the existing stack solve this? (Often it does.)
261
+ 2. How large is the dependency? (Check bundle impact.)
262
+ 3. Is it actively maintained? (Check last commit, open issues.)
263
+ 4. Does it have known vulnerabilities? (`npm audit`)
264
+ 5. What's the license? (Must be compatible with the project.)
265
+
266
+ **Rule:** Prefer standard library and existing utilities over new dependencies. Every dependency is a liability.
267
+
268
+ ## The Review Checklist
269
+
270
+ ```markdown
271
+ ## Review: [PR/Change title]
272
+
273
+ ### Context
274
+ - [ ] I understand what this change does and why
275
+
276
+ ### Correctness
277
+ - [ ] Change matches spec/task requirements
278
+ - [ ] Edge cases handled
279
+ - [ ] Error paths handled
280
+ - [ ] Tests cover the change adequately
281
+
282
+ ### Readability
283
+ - [ ] Names are clear and consistent
284
+ - [ ] Logic is straightforward
285
+ - [ ] No unnecessary complexity
286
+
287
+ ### Architecture
288
+ - [ ] Follows existing patterns
289
+ - [ ] No unnecessary coupling or dependencies
290
+ - [ ] Appropriate abstraction level
291
+
292
+ ### Security
293
+ - [ ] No secrets in code
294
+ - [ ] Input validated at boundaries
295
+ - [ ] No injection vulnerabilities
296
+ - [ ] Auth checks in place
297
+ - [ ] External data sources treated as untrusted
298
+
299
+ ### Performance
300
+ - [ ] No N+1 patterns
301
+ - [ ] No unbounded operations
302
+ - [ ] Pagination on list endpoints
303
+
304
+ ### Verification
305
+ - [ ] Tests pass
306
+ - [ ] Build succeeds
307
+ - [ ] Manual verification done (if applicable)
308
+
309
+ ### Verdict
310
+ - [ ] **Approve** — Ready to merge
311
+ - [ ] **Request changes** — Issues must be addressed
312
+ ```
313
+ ## See Also
314
+
315
+ - For detailed security review guidance, see `references/security-checklist.md`
316
+ - For performance review checks, see `references/performance-checklist.md`
317
+
318
+ ## Common Rationalizations
319
+
320
+ | Rationalization | Reality |
321
+ |---|---|
322
+ | "It works, that's good enough" | Working code that's unreadable, insecure, or architecturally wrong creates debt that compounds. |
323
+ | "I wrote it, so I know it's correct" | Authors are blind to their own assumptions. Every change benefits from another set of eyes. |
324
+ | "We'll clean it up later" | Later never comes. The review is the quality gate — use it. Require cleanup before merge, not after. |
325
+ | "AI-generated code is probably fine" | AI code needs more scrutiny, not less. It's confident and plausible, even when wrong. |
326
+ | "The tests pass, so it's good" | Tests are necessary but not sufficient. They don't catch architecture problems, security issues, or readability concerns. |
327
+
328
+ ## Red Flags
329
+
330
+ - PRs merged without any review
331
+ - Review that only checks if tests pass (ignoring other axes)
332
+ - "LGTM" without evidence of actual review
333
+ - Security-sensitive changes without security-focused review
334
+ - Large PRs that are "too big to review properly" (split them)
335
+ - No regression tests with bug fix PRs
336
+ - Review comments without severity labels — makes it unclear what's required vs optional
337
+ - Accepting "I'll fix it later" — it never happens
338
+
339
+ ## Verification
340
+
341
+ After review is complete:
342
+
343
+ - [ ] All Critical issues are resolved
344
+ - [ ] All Important issues are resolved or explicitly deferred with justification
345
+ - [ ] Tests pass
346
+ - [ ] Build succeeds
347
+ - [ ] The verification story is documented (what changed, how it was verified)
@@ -0,0 +1,331 @@
1
+ ---
2
+ name: code-simplification
3
+ description: Simplifies code for clarity. Use when refactoring code for clarity without changing behavior. Use when code works but is harder to read, maintain, or extend than it should be. Use when reviewing code that has accumulated unnecessary complexity.
4
+ ---
5
+
6
+ # Code Simplification
7
+
8
+ > Inspired by the [Claude Code Simplifier plugin](https://github.com/anthropics/claude-plugins-official/blob/main/plugins/code-simplifier/agents/code-simplifier.md). Adapted here as a model-agnostic, process-driven skill for any AI coding agent.
9
+
10
+ ## Overview
11
+
12
+ Simplify code by reducing complexity while preserving exact behavior. The goal is not fewer lines — it's code that is easier to read, understand, modify, and debug. Every simplification must pass a simple test: "Would a new team member understand this faster than the original?"
13
+
14
+ ## When to Use
15
+
16
+ - After a feature is working and tests pass, but the implementation feels heavier than it needs to be
17
+ - During code review when readability or complexity issues are flagged
18
+ - When you encounter deeply nested logic, long functions, or unclear names
19
+ - When refactoring code written under time pressure
20
+ - When consolidating related logic scattered across files
21
+ - After merging changes that introduced duplication or inconsistency
22
+
23
+ **When NOT to use:**
24
+
25
+ - Code is already clean and readable — don't simplify for the sake of it
26
+ - You don't understand what the code does yet — comprehend before you simplify
27
+ - The code is performance-critical and the "simpler" version would be measurably slower
28
+ - You're about to rewrite the module entirely — simplifying throwaway code wastes effort
29
+
30
+ ## The Five Principles
31
+
32
+ ### 1. Preserve Behavior Exactly
33
+
34
+ Don't change what the code does — only how it expresses it. All inputs, outputs, side effects, error behavior, and edge cases must remain identical. If you're not sure a simplification preserves behavior, don't make it.
35
+
36
+ ```
37
+ ASK BEFORE EVERY CHANGE:
38
+ → Does this produce the same output for every input?
39
+ → Does this maintain the same error behavior?
40
+ → Does this preserve the same side effects and ordering?
41
+ → Do all existing tests still pass without modification?
42
+ ```
43
+
44
+ ### 2. Follow Project Conventions
45
+
46
+ Simplification means making code more consistent with the codebase, not imposing external preferences. Before simplifying:
47
+
48
+ ```
49
+ 1. Read CLAUDE.md / project conventions
50
+ 2. Study how neighboring code handles similar patterns
51
+ 3. Match the project's style for:
52
+ - Import ordering and module system
53
+ - Function declaration style
54
+ - Naming conventions
55
+ - Error handling patterns
56
+ - Type annotation depth
57
+ ```
58
+
59
+ Simplification that breaks project consistency is not simplification — it's churn.
60
+
61
+ ### 3. Prefer Clarity Over Cleverness
62
+
63
+ Explicit code is better than compact code when the compact version requires a mental pause to parse.
64
+
65
+ ```typescript
66
+ // UNCLEAR: Dense ternary chain
67
+ const label = isNew ? 'New' : isUpdated ? 'Updated' : isArchived ? 'Archived' : 'Active';
68
+
69
+ // CLEAR: Readable mapping
70
+ function getStatusLabel(item: Item): string {
71
+ if (item.isNew) return 'New';
72
+ if (item.isUpdated) return 'Updated';
73
+ if (item.isArchived) return 'Archived';
74
+ return 'Active';
75
+ }
76
+ ```
77
+
78
+ ```typescript
79
+ // UNCLEAR: Chained reduces with inline logic
80
+ const result = items.reduce((acc, item) => ({
81
+ ...acc,
82
+ [item.id]: { ...acc[item.id], count: (acc[item.id]?.count ?? 0) + 1 }
83
+ }), {});
84
+
85
+ // CLEAR: Named intermediate step
86
+ const countById = new Map<string, number>();
87
+ for (const item of items) {
88
+ countById.set(item.id, (countById.get(item.id) ?? 0) + 1);
89
+ }
90
+ ```
91
+
92
+ ### 4. Maintain Balance
93
+
94
+ Simplification has a failure mode: over-simplification. Watch for these traps:
95
+
96
+ - **Inlining too aggressively** — removing a helper that gave a concept a name makes the call site harder to read
97
+ - **Combining unrelated logic** — two simple functions merged into one complex function is not simpler
98
+ - **Removing "unnecessary" abstraction** — some abstractions exist for extensibility or testability, not complexity
99
+ - **Optimizing for line count** — fewer lines is not the goal; easier comprehension is
100
+
101
+ ### 5. Scope to What Changed
102
+
103
+ Default to simplifying recently modified code. Avoid drive-by refactors of unrelated code unless explicitly asked to broaden scope. Unscoped simplification creates noise in diffs and risks unintended regressions.
104
+
105
+ ## The Simplification Process
106
+
107
+ ### Step 1: Understand Before Touching (Chesterton's Fence)
108
+
109
+ Before changing or removing anything, understand why it exists. This is Chesterton's Fence: if you see a fence across a road and don't understand why it's there, don't tear it down. First understand the reason, then decide if the reason still applies.
110
+
111
+ ```
112
+ BEFORE SIMPLIFYING, ANSWER:
113
+ - What is this code's responsibility?
114
+ - What calls it? What does it call?
115
+ - What are the edge cases and error paths?
116
+ - Are there tests that define the expected behavior?
117
+ - Why might it have been written this way? (Performance? Platform constraint? Historical reason?)
118
+ - Check git blame: what was the original context for this code?
119
+ ```
120
+
121
+ If you can't answer these, you're not ready to simplify. Read more context first.
122
+
123
+ ### Step 2: Identify Simplification Opportunities
124
+
125
+ Scan for these patterns — each one is a concrete signal, not a vague smell:
126
+
127
+ **Structural complexity:**
128
+
129
+ | Pattern | Signal | Simplification |
130
+ |---------|--------|----------------|
131
+ | Deep nesting (3+ levels) | Hard to follow control flow | Extract conditions into guard clauses or helper functions |
132
+ | Long functions (50+ lines) | Multiple responsibilities | Split into focused functions with descriptive names |
133
+ | Nested ternaries | Requires mental stack to parse | Replace with if/else chains, switch, or lookup objects |
134
+ | Boolean parameter flags | `doThing(true, false, true)` | Replace with options objects or separate functions |
135
+ | Repeated conditionals | Same `if` check in multiple places | Extract to a well-named predicate function |
136
+
137
+ **Naming and readability:**
138
+
139
+ | Pattern | Signal | Simplification |
140
+ |---------|--------|----------------|
141
+ | Generic names | `data`, `result`, `temp`, `val`, `item` | Rename to describe the content: `userProfile`, `validationErrors` |
142
+ | Abbreviated names | `usr`, `cfg`, `btn`, `evt` | Use full words unless the abbreviation is universal (`id`, `url`, `api`) |
143
+ | Misleading names | Function named `get` that also mutates state | Rename to reflect actual behavior |
144
+ | Comments explaining "what" | `// increment counter` above `count++` | Delete the comment — the code is clear enough |
145
+ | Comments explaining "why" | `// Retry because the API is flaky under load` | Keep these — they carry intent the code can't express |
146
+
147
+ **Redundancy:**
148
+
149
+ | Pattern | Signal | Simplification |
150
+ |---------|--------|----------------|
151
+ | Duplicated logic | Same 5+ lines in multiple places | Extract to a shared function |
152
+ | Dead code | Unreachable branches, unused variables, commented-out blocks | Remove (after confirming it's truly dead) |
153
+ | Unnecessary abstractions | Wrapper that adds no value | Inline the wrapper, call the underlying function directly |
154
+ | Over-engineered patterns | Factory-for-a-factory, strategy-with-one-strategy | Replace with the simple direct approach |
155
+ | Redundant type assertions | Casting to a type that's already inferred | Remove the assertion |
156
+
157
+ ### Step 3: Apply Changes Incrementally
158
+
159
+ Make one simplification at a time. Run tests after each change. **Submit refactoring changes separately from feature or bug fix changes.** A PR that refactors and adds a feature is two PRs — split them.
160
+
161
+ ```
162
+ FOR EACH SIMPLIFICATION:
163
+ 1. Make the change
164
+ 2. Run the test suite
165
+ 3. If tests pass → commit (or continue to next simplification)
166
+ 4. If tests fail → revert and reconsider
167
+ ```
168
+
169
+ Avoid batching multiple simplifications into a single untested change. If something breaks, you need to know which simplification caused it.
170
+
171
+ **The Rule of 500:** If a refactoring would touch more than 500 lines, invest in automation (codemods, sed scripts, AST transforms) rather than making the changes by hand. Manual edits at that scale are error-prone and exhausting to review.
172
+
173
+ ### Step 4: Verify the Result
174
+
175
+ After all simplifications, step back and evaluate the whole:
176
+
177
+ ```
178
+ COMPARE BEFORE AND AFTER:
179
+ - Is the simplified version genuinely easier to understand?
180
+ - Did you introduce any new patterns inconsistent with the codebase?
181
+ - Is the diff clean and reviewable?
182
+ - Would a teammate approve this change?
183
+ ```
184
+
185
+ If the "simplified" version is harder to understand or review, revert. Not every simplification attempt succeeds.
186
+
187
+ ## Language-Specific Guidance
188
+
189
+ ### TypeScript / JavaScript
190
+
191
+ ```typescript
192
+ // SIMPLIFY: Unnecessary async wrapper
193
+ // Before
194
+ async function getUser(id: string): Promise<User> {
195
+ return await userService.findById(id);
196
+ }
197
+ // After
198
+ function getUser(id: string): Promise<User> {
199
+ return userService.findById(id);
200
+ }
201
+
202
+ // SIMPLIFY: Verbose conditional assignment
203
+ // Before
204
+ let displayName: string;
205
+ if (user.nickname) {
206
+ displayName = user.nickname;
207
+ } else {
208
+ displayName = user.fullName;
209
+ }
210
+ // After
211
+ const displayName = user.nickname || user.fullName;
212
+
213
+ // SIMPLIFY: Manual array building
214
+ // Before
215
+ const activeUsers: User[] = [];
216
+ for (const user of users) {
217
+ if (user.isActive) {
218
+ activeUsers.push(user);
219
+ }
220
+ }
221
+ // After
222
+ const activeUsers = users.filter((user) => user.isActive);
223
+
224
+ // SIMPLIFY: Redundant boolean return
225
+ // Before
226
+ function isValid(input: string): boolean {
227
+ if (input.length > 0 && input.length < 100) {
228
+ return true;
229
+ }
230
+ return false;
231
+ }
232
+ // After
233
+ function isValid(input: string): boolean {
234
+ return input.length > 0 && input.length < 100;
235
+ }
236
+ ```
237
+
238
+ ### Python
239
+
240
+ ```python
241
+ # SIMPLIFY: Verbose dictionary building
242
+ # Before
243
+ result = {}
244
+ for item in items:
245
+ result[item.id] = item.name
246
+ # After
247
+ result = {item.id: item.name for item in items}
248
+
249
+ # SIMPLIFY: Nested conditionals with early return
250
+ # Before
251
+ def process(data):
252
+ if data is not None:
253
+ if data.is_valid():
254
+ if data.has_permission():
255
+ return do_work(data)
256
+ else:
257
+ raise PermissionError("No permission")
258
+ else:
259
+ raise ValueError("Invalid data")
260
+ else:
261
+ raise TypeError("Data is None")
262
+ # After
263
+ def process(data):
264
+ if data is None:
265
+ raise TypeError("Data is None")
266
+ if not data.is_valid():
267
+ raise ValueError("Invalid data")
268
+ if not data.has_permission():
269
+ raise PermissionError("No permission")
270
+ return do_work(data)
271
+ ```
272
+
273
+ ### React / JSX
274
+
275
+ ```tsx
276
+ // SIMPLIFY: Verbose conditional rendering
277
+ // Before
278
+ function UserBadge({ user }: Props) {
279
+ if (user.isAdmin) {
280
+ return <Badge variant="admin">Admin</Badge>;
281
+ } else {
282
+ return <Badge variant="default">User</Badge>;
283
+ }
284
+ }
285
+ // After
286
+ function UserBadge({ user }: Props) {
287
+ const variant = user.isAdmin ? 'admin' : 'default';
288
+ const label = user.isAdmin ? 'Admin' : 'User';
289
+ return <Badge variant={variant}>{label}</Badge>;
290
+ }
291
+
292
+ // SIMPLIFY: Prop drilling through intermediate components
293
+ // Before — consider whether context or composition solves this better.
294
+ // This is a judgment call — flag it, don't auto-refactor.
295
+ ```
296
+
297
+ ## Common Rationalizations
298
+
299
+ | Rationalization | Reality |
300
+ |---|---|
301
+ | "It's working, no need to touch it" | Working code that's hard to read will be hard to fix when it breaks. Simplifying now saves time on every future change. |
302
+ | "Fewer lines is always simpler" | A 1-line nested ternary is not simpler than a 5-line if/else. Simplicity is about comprehension speed, not line count. |
303
+ | "I'll just quickly simplify this unrelated code too" | Unscoped simplification creates noisy diffs and risks regressions in code you didn't intend to change. Stay focused. |
304
+ | "The types make it self-documenting" | Types document structure, not intent. A well-named function explains *why* better than a type signature explains *what*. |
305
+ | "This abstraction might be useful later" | Don't preserve speculative abstractions. If it's not used now, it's complexity without value. Remove it and re-add when needed. |
306
+ | "The original author must have had a reason" | Maybe. Check git blame — apply Chesterton's Fence. But accumulated complexity often has no reason; it's just the residue of iteration under pressure. |
307
+ | "I'll refactor while adding this feature" | Separate refactoring from feature work. Mixed changes are harder to review, revert, and understand in history. |
308
+
309
+ ## Red Flags
310
+
311
+ - Simplification that requires modifying tests to pass (you likely changed behavior)
312
+ - "Simplified" code that is longer and harder to follow than the original
313
+ - Renaming things to match your preferences rather than project conventions
314
+ - Removing error handling because "it makes the code cleaner"
315
+ - Simplifying code you don't fully understand
316
+ - Batching many simplifications into one large, hard-to-review commit
317
+ - Refactoring code outside the scope of the current task without being asked
318
+
319
+ ## Verification
320
+
321
+ After completing a simplification pass:
322
+
323
+ - [ ] All existing tests pass without modification
324
+ - [ ] Build succeeds with no new warnings
325
+ - [ ] Linter/formatter passes (no style regressions)
326
+ - [ ] Each simplification is a reviewable, incremental change
327
+ - [ ] The diff is clean — no unrelated changes mixed in
328
+ - [ ] Simplified code follows project conventions (checked against CLAUDE.md or equivalent)
329
+ - [ ] No error handling was removed or weakened
330
+ - [ ] No dead code was left behind (unused imports, unreachable branches)
331
+ - [ ] A teammate or review agent would approve the change as a net improvement