@lenardangeloolajay/len-toolkit 1.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 (114) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +209 -0
  3. package/bin/cli.js +244 -0
  4. package/package.json +35 -0
  5. package/src/installer.js +236 -0
  6. package/templates/configs/.editorconfig +12 -0
  7. package/templates/configs/sample.gitignore +8 -0
  8. package/templates/docs/FEATURE.md +40 -0
  9. package/templates/docs/HANDOFF.md +39 -0
  10. package/templates/docs/IMPLEMENTATION_PLAN.md +47 -0
  11. package/templates/docs/SPEC_INDEX.md +12 -0
  12. package/templates/docs/VERIFICATION.md +14 -0
  13. package/templates/docs/product/ARCHITECTURE.md +22 -0
  14. package/templates/docs/product/CONSTRAINTS.md +22 -0
  15. package/templates/docs/product/DATA_MODEL.md +22 -0
  16. package/templates/docs/product/OVERVIEW.md +22 -0
  17. package/templates/examples/flutter-handoff/EXERCISES.md +16 -0
  18. package/templates/examples/flutter-handoff/HANDOFF.md +32 -0
  19. package/templates/examples/flutter-handoff/docs/SPEC_INDEX.md +19 -0
  20. package/templates/examples/flutter-handoff/docs/evidence/FEAT-001-verification.md +14 -0
  21. package/templates/examples/flutter-handoff/docs/features/FEAT-001-local-note.md +40 -0
  22. package/templates/examples/flutter-handoff/docs/plans/FEAT-001-implementation.md +43 -0
  23. package/templates/examples/flutter-handoff/docs/product/ARCHITECTURE.md +24 -0
  24. package/templates/examples/flutter-handoff/docs/product/CONSTRAINTS.md +13 -0
  25. package/templates/examples/flutter-handoff/docs/product/DATA_MODEL.md +20 -0
  26. package/templates/examples/flutter-handoff/docs/product/OVERVIEW.md +26 -0
  27. package/templates/rules/.cursorrules +7 -0
  28. package/templates/rules/AGENTS.md +61 -0
  29. package/templates/rules/GEMINI.md +7 -0
  30. package/templates/skills/a-philosophy-of-software-design/SKILL.md +11 -0
  31. package/templates/skills/a-philosophy-of-software-design/a-philosophy-of-software-design.md +370 -0
  32. package/templates/skills/a-philosophy-of-software-design/a-philosophy-of-software-design.mini.md +46 -0
  33. package/templates/skills/a-philosophy-of-software-design/a-philosophy-of-software-design.nano.md +35 -0
  34. package/templates/skills/clean-architecture/SKILL.md +11 -0
  35. package/templates/skills/clean-architecture/clean-architecture.md +515 -0
  36. package/templates/skills/clean-architecture/clean-architecture.mini.md +49 -0
  37. package/templates/skills/clean-architecture/clean-architecture.nano.md +36 -0
  38. package/templates/skills/clean-code/SKILL.md +11 -0
  39. package/templates/skills/clean-code/clean-code.md +297 -0
  40. package/templates/skills/clean-code/clean-code.mini.md +47 -0
  41. package/templates/skills/clean-code/clean-code.nano.md +32 -0
  42. package/templates/skills/code-complete/SKILL.md +11 -0
  43. package/templates/skills/code-complete/code-complete.md +354 -0
  44. package/templates/skills/code-complete/code-complete.mini.md +56 -0
  45. package/templates/skills/code-complete/code-complete.nano.md +41 -0
  46. package/templates/skills/council/SKILL.md +37 -0
  47. package/templates/skills/designing-data-intensive-applications/SKILL.md +11 -0
  48. package/templates/skills/designing-data-intensive-applications/designing-data-intensive-applications.md +393 -0
  49. package/templates/skills/designing-data-intensive-applications/designing-data-intensive-applications.mini.md +55 -0
  50. package/templates/skills/designing-data-intensive-applications/designing-data-intensive-applications.nano.md +34 -0
  51. package/templates/skills/domain-driven-design/SKILL.md +11 -0
  52. package/templates/skills/domain-driven-design/domain-driven-design.md +979 -0
  53. package/templates/skills/domain-driven-design/domain-driven-design.mini.md +48 -0
  54. package/templates/skills/domain-driven-design/domain-driven-design.nano.md +39 -0
  55. package/templates/skills/domain-driven-design-distilled/SKILL.md +11 -0
  56. package/templates/skills/domain-driven-design-distilled/domain-driven-design-distilled.md +317 -0
  57. package/templates/skills/domain-driven-design-distilled/domain-driven-design-distilled.mini.md +56 -0
  58. package/templates/skills/domain-driven-design-distilled/domain-driven-design-distilled.nano.md +41 -0
  59. package/templates/skills/implementation-plan/SKILL.md +42 -0
  60. package/templates/skills/implementing-domain-driven-design/SKILL.md +11 -0
  61. package/templates/skills/implementing-domain-driven-design/implementing-domain-driven-design.md +337 -0
  62. package/templates/skills/implementing-domain-driven-design/implementing-domain-driven-design.mini.md +57 -0
  63. package/templates/skills/implementing-domain-driven-design/implementing-domain-driven-design.nano.md +37 -0
  64. package/templates/skills/patterns-of-enterprise-application-architecture/SKILL.md +11 -0
  65. package/templates/skills/patterns-of-enterprise-application-architecture/patterns-of-enterprise-application-architecture.md +404 -0
  66. package/templates/skills/patterns-of-enterprise-application-architecture/patterns-of-enterprise-application-architecture.mini.md +54 -0
  67. package/templates/skills/patterns-of-enterprise-application-architecture/patterns-of-enterprise-application-architecture.nano.md +35 -0
  68. package/templates/skills/ponytail/SKILL.md +124 -0
  69. package/templates/skills/ponytail-audit/SKILL.md +45 -0
  70. package/templates/skills/ponytail-debt/SKILL.md +48 -0
  71. package/templates/skills/ponytail-gain/SKILL.md +17 -0
  72. package/templates/skills/ponytail-help/SKILL.md +42 -0
  73. package/templates/skills/ponytail-review/SKILL.md +61 -0
  74. package/templates/skills/refactoring/SKILL.md +11 -0
  75. package/templates/skills/refactoring/refactoring.md +433 -0
  76. package/templates/skills/refactoring/refactoring.mini.md +49 -0
  77. package/templates/skills/refactoring/refactoring.nano.md +37 -0
  78. package/templates/skills/refactoring-guru/SKILL.md +11 -0
  79. package/templates/skills/refactoring-guru/refactoring-guru.md +765 -0
  80. package/templates/skills/refactoring-guru/refactoring-guru.mini.md +64 -0
  81. package/templates/skills/refactoring-guru/refactoring-guru.nano.md +41 -0
  82. package/templates/skills/release-it/SKILL.md +11 -0
  83. package/templates/skills/release-it/release-it.md +382 -0
  84. package/templates/skills/release-it/release-it.mini.md +48 -0
  85. package/templates/skills/release-it/release-it.nano.md +38 -0
  86. package/templates/skills/security-audit/AI-AND-LLM.md +83 -0
  87. package/templates/skills/security-audit/ATTACK-CLASSES.md +130 -0
  88. package/templates/skills/security-audit/CLIENT-SIDE.md +83 -0
  89. package/templates/skills/security-audit/CLOUD-AND-DEPLOYMENT.md +86 -0
  90. package/templates/skills/security-audit/DATA-ISOLATION-AND-LIFECYCLE.md +84 -0
  91. package/templates/skills/security-audit/DESKTOP-MOBILE-AND-LOCAL-IPC.md +89 -0
  92. package/templates/skills/security-audit/HUNTING.md +251 -0
  93. package/templates/skills/security-audit/MEMORY-SAFETY-AND-BINARY.md +101 -0
  94. package/templates/skills/security-audit/PROTOCOLS-RPC-AND-MESSAGING.md +81 -0
  95. package/templates/skills/security-audit/RECONNAISSANCE.md +156 -0
  96. package/templates/skills/security-audit/RESOURCE-EXHAUSTION-AND-AVAILABILITY.md +78 -0
  97. package/templates/skills/security-audit/SKILL.md +192 -0
  98. package/templates/skills/security-audit/SUPPLY-CHAIN-AND-RELEASE.md +73 -0
  99. package/templates/skills/security-audit/VALIDATION-AND-REPORTING.md +186 -0
  100. package/templates/skills/security-audit/WEB-PROTOCOL-AND-AUTH.md +105 -0
  101. package/templates/skills/security-audit/report-schema.json +461 -0
  102. package/templates/skills/security-audit/validate-coverage-ledger.cjs +872 -0
  103. package/templates/skills/security-audit/validate-coverage-ledger.test.cjs +740 -0
  104. package/templates/skills/security-audit/validate-findings.cjs +773 -0
  105. package/templates/skills/security-audit/validate-findings.test.cjs +652 -0
  106. package/templates/skills/spec/SKILL.md +55 -0
  107. package/templates/skills/the-pragmatic-programmer/SKILL.md +11 -0
  108. package/templates/skills/the-pragmatic-programmer/the-pragmatic-programmer.md +359 -0
  109. package/templates/skills/the-pragmatic-programmer/the-pragmatic-programmer.mini.md +65 -0
  110. package/templates/skills/the-pragmatic-programmer/the-pragmatic-programmer.nano.md +44 -0
  111. package/templates/skills/working-effectively-with-legacy-code/SKILL.md +11 -0
  112. package/templates/skills/working-effectively-with-legacy-code/working-effectively-with-legacy-code.md +371 -0
  113. package/templates/skills/working-effectively-with-legacy-code/working-effectively-with-legacy-code.mini.md +50 -0
  114. package/templates/skills/working-effectively-with-legacy-code/working-effectively-with-legacy-code.nano.md +35 -0
@@ -0,0 +1,297 @@
1
+ # OBEY Clean Code by Robert C. Martin
2
+
3
+ This file defines mandatory working rules for this repository. Follow these instructions before making any code, test, refactor, review, or documentation change.
4
+
5
+ ## Priority and behavior
6
+
7
+ - Treat every unqualified rule in this file as `MUST`; treat `Prefer` as `SHOULD`; treat `Do not`, `Avoid`, and `Never` as `MUST NOT` unless the user explicitly overrides it.
8
+ - Prefer readability, maintainability, correctness, and safe change over cleverness or speed hacks.
9
+ - Optimize for the next human reader.
10
+ - When trade-offs exist, choose the option that reduces long-term complexity.
11
+ - Never preserve bad structure just because it already exists.
12
+ - Apply the Boy Scout Rule: leave touched code cleaner than you found it.
13
+
14
+ ## Core clean code principles
15
+
16
+ - Write code primarily for humans, not just for execution.
17
+ - Keep code simple, direct, and easy to modify.
18
+ - Avoid accidental complexity.
19
+ - Avoid surprising behavior.
20
+ - Prefer explicit intent over implicit magic.
21
+ - Prefer local reasoning: a reader should understand code with minimal jumping across files.
22
+ - Reduce technical debt instead of moving it around.
23
+
24
+ ## Naming rules
25
+
26
+ - Use intention-revealing names.
27
+ - Names must explain purpose, role, or behavior without requiring extra comments.
28
+ - Avoid misleading names, overloaded meanings, and visually confusable identifiers.
29
+ - Make distinctions meaningful. Do not create names that differ only cosmetically.
30
+ - Use pronounceable, searchable names.
31
+ - Avoid abbreviations unless they are established domain or platform standards.
32
+ - Avoid encodings in names, including type prefixes, implementation hints, and Hungarian notation.
33
+ - Avoid unnecessary context in identifiers.
34
+ - Add context through modules, classes, namespaces, or types when that is cleaner than longer names.
35
+ - Use one word per concept across the codebase.
36
+ - Do not use multiple synonyms for the same operation or concept.
37
+ - Do not reuse a familiar word for a different meaning.
38
+ - Class, type, and module names should be nouns or noun phrases.
39
+ - Function and method names should be verbs or verb phrases.
40
+ - Use problem-domain names for domain concepts.
41
+ - Use solution-domain names for technical concepts.
42
+ - Do not use cute, funny, cryptic, or private-joke names.
43
+
44
+ ## Function rules
45
+
46
+ - Keep functions small.
47
+ - Each function must do one thing.
48
+ - A function should have one clear reason to change.
49
+ - Keep each function at one level of abstraction.
50
+ - Organize code top-down so readers see the high-level story before details.
51
+ - Prefer descriptive names over short names.
52
+ - Minimize the number of parameters.
53
+ - Avoid boolean flag parameters. Split behavior into separate functions instead.
54
+ - Avoid output parameters unless language conventions make them necessary.
55
+ - Eliminate hidden side effects.
56
+ - Separate commands from queries.
57
+ - A function that answers a question should not also mutate state.
58
+ - Prefer exceptions or explicit result types over ad hoc error codes, according to project language norms.
59
+ - Isolate error handling from main logic.
60
+ - Eliminate duplication aggressively.
61
+ - Prefer straightforward control flow over clever control flow.
62
+ - Refactor deep nesting into clearer structure.
63
+
64
+ ## Comment rules
65
+
66
+ - Do not use comments to compensate for bad naming or bad structure.
67
+ - First improve the code, then decide whether a comment is still needed.
68
+ - Prefer self-explanatory code.
69
+ - Use comments only when they add information the code cannot express well.
70
+ - Good comment categories include:
71
+ - legal or licensing requirements
72
+ - non-obvious intent
73
+ - important warnings or constraints
74
+ - rationale for a surprising decision
75
+ - clarification of external behavior or protocol assumptions
76
+ - Remove redundant, obsolete, obvious, noisy, and misleading comments.
77
+ - Do not narrate the code line by line.
78
+ - Keep comments precise and maintain them when code changes.
79
+ - Avoid TODO comments unless they are actionable, specific, and necessary.
80
+
81
+ ## Formatting and structure
82
+
83
+ - Use consistent formatting across the repository.
84
+ - Format code to reveal structure and intent.
85
+ - Keep related concepts close together.
86
+ - Keep files, classes, and functions reasonably small.
87
+ - Use vertical ordering to tell the story from higher level to lower level.
88
+ - Use indentation to clarify scope, not to hide complexity.
89
+ - Avoid excessive line length when it hurts readability.
90
+ - Avoid decorative alignment that is brittle during edits.
91
+ - Preserve a layout that supports fast scanning.
92
+
93
+ ## Objects, modules, and data structures
94
+
95
+ - Separate behavior-rich objects from plain data carriers intentionally.
96
+ - Do not mix data containers and business behavior arbitrarily.
97
+ - Hide implementation details behind clear interfaces.
98
+ - Expose behavior, not representation.
99
+ - Use DTO-like structures as simple carriers when appropriate.
100
+ - Avoid train-wreck call chains and unnecessary knowledge of internal structure.
101
+ - Respect loose coupling and local boundaries.
102
+ - Keep persistence, framework, and third-party details from obscuring business behavior or core logic.
103
+
104
+ ## Class and module design
105
+
106
+ - Keep classes and modules small.
107
+ - Each class or module should have one primary responsibility.
108
+ - Favor high cohesion.
109
+ - Split classes that accumulate unrelated behavior.
110
+ - Organize code so likely changes remain local.
111
+ - Public APIs should be small, obvious, and hard to misuse.
112
+ - Prefer composition over complex inheritance unless inheritance is clearly the simpler and more stable model.
113
+ - Keep constructors and setup logic from overwhelming domain behavior.
114
+
115
+ ## Error handling
116
+
117
+ - Design error handling deliberately.
118
+ - Keep the happy path easy to read.
119
+ - Provide enough context in error messages for diagnosis.
120
+ - Use error types or exception classes that support caller decisions.
121
+ - Do not return `null` or equivalent absence sentinels when a safer model exists.
122
+ - Do not pass `null` or equivalent invalid states unless the API explicitly models that case.
123
+ - Prefer exceptions, special cases, empty objects, or explicit optionality according to the codebase's language and conventions.
124
+ - Make resource cleanup and shutdown paths correct and visible.
125
+
126
+ ## Boundaries and external dependencies
127
+
128
+ - Isolate third-party libraries behind local adapters or wrappers when practical.
129
+ - Avoid coupling core logic directly to unstable external APIs.
130
+ - Create narrow interfaces around dependencies.
131
+ - Add learning tests or focused integration tests for tricky external behavior.
132
+ - When a dependency does not exist yet, define interfaces from local needs, not from guesses about future implementations.
133
+
134
+ ## System construction rules
135
+
136
+ - Separate constructing a system from using it.
137
+ - Keep object graph assembly, dependency injection, factories, and framework bootstrapping out of ordinary business behavior.
138
+ - Put startup wiring in an explicit main or composition area.
139
+ - Use factories when construction policy is meaningful or complex.
140
+ - Do not let cross-cutting concerns obscure ordinary code flow.
141
+ - Use standards, frameworks, proxies, or AOP-style mechanisms only when they add demonstrable value.
142
+ - Test-drive architectural decisions with executable slices, not only diagrams or configuration.
143
+ - Use domain-specific languages only when they make system intent clearer than general-purpose code.
144
+
145
+ ## Tests
146
+
147
+ - Treat tests as production-quality code.
148
+ - Keep tests clean, readable, deterministic, and maintainable.
149
+ - A test should communicate one main idea.
150
+ - Prefer simple setup and clear assertions.
151
+ - Avoid brittle tests coupled to irrelevant implementation details.
152
+ - Tests should be fast when possible.
153
+ - Tests should be isolated and order-independent.
154
+ - Tests should be self-checking.
155
+ - Add or update tests for behavior changes, bug fixes, and significant refactors.
156
+ - Do not ship code changes without proportionate validation.
157
+ - When fixing a bug, add a test that would have caught it, when feasible.
158
+
159
+ ## TDD and clean test rules
160
+
161
+ - Prefer writing a failing test before production code when the behavior can be specified clearly.
162
+ - Do not write production behavior beyond what a failing test or explicit requirement justifies.
163
+ - Keep tests small enough that a failure names one behavior or one concept.
164
+ - Prefer one assert or one conceptual assertion per test when that improves clarity.
165
+ - Use test names and test data that reveal the business or technical behavior under test.
166
+ - Build a small testing vocabulary or helper DSL when repeated setup hides intent.
167
+ - Keep test code clean; dirty tests reduce the ability to change production code safely.
168
+ - Avoid tests that require multiple manual steps to run.
169
+ - Use coverage patterns to find untested risk, not as a substitute for meaningful assertions.
170
+ - Treat ignored, flaky, or skipped tests as unresolved questions.
171
+
172
+ ## Concurrency and async work
173
+
174
+ - Do not introduce concurrency unless it provides a real benefit.
175
+ - Prefer simpler sequential code when it is sufficient.
176
+ - Minimize shared mutable state.
177
+ - Prefer immutability, message passing, or clear ownership boundaries.
178
+ - Keep synchronized or locked sections as small as possible.
179
+ - Be explicit about shutdown, cancellation, timeouts, and cleanup.
180
+ - Test concurrent behavior carefully where it matters.
181
+ - Know the execution model before changing concurrent code.
182
+ - Avoid dependencies between synchronized methods.
183
+ - Get non-concurrent behavior correct before adding threading.
184
+ - Make threaded code pluggable and tunable when its policy or concurrency level may vary.
185
+ - Run concurrency-sensitive tests under varied thread counts, schedules, and platforms where practical.
186
+ - Treat spurious failures as possible concurrency defects until evidence says otherwise.
187
+
188
+ ## Refactoring rules
189
+
190
+ - Refactor in small, safe steps.
191
+ - Preserve behavior while improving structure.
192
+ - First make it work, then make it right.
193
+ - Remove duplication, dead code, misleading abstractions, and special-case clutter.
194
+ - Rename aggressively when names are weak.
195
+ - Extract code when doing so improves cohesion and clarity.
196
+ - Inline abstractions that no longer earn their cost.
197
+ - Prefer the simplest design that passes all relevant tests.
198
+
199
+ ## Emergent design and successive refinement
200
+
201
+ - Prefer designs that run all relevant tests, remove duplication, express intent, and use the fewest necessary classes and methods.
202
+ - Refine code through working drafts rather than expecting the first version to be clean.
203
+ - When code starts rough, keep improving names, structure, and tests until intent is clear.
204
+ - Do not start a grand redesign when incremental refinement can recover the design safely.
205
+ - Use the Boy Scout Rule on touched code, but keep cleanup proportional to the task.
206
+
207
+ ## Smells to detect and eliminate
208
+
209
+ Actively look for and fix these issues when touching code:
210
+
211
+ - vague or misleading names
212
+ - duplicated logic
213
+ - oversized functions
214
+ - oversized classes or modules
215
+ - mixed abstraction levels
216
+ - hidden side effects
217
+ - boolean control flags
218
+ - long parameter lists
219
+ - deep nesting
220
+ - excessive conditionals that should be isolated or polymorphic
221
+ - comment-heavy code that should be refactored instead
222
+ - dead code and unused abstractions
223
+ - fragile tests
224
+ - environment-dependent tests without need
225
+ - unnecessary indirection
226
+ - accidental complexity
227
+ - coupling that spreads change broadly
228
+ - build or tests requiring more than one manual step
229
+ - code at the wrong level of abstraction
230
+ - base classes depending on derivatives
231
+ - transitive navigation through object internals
232
+ - artificial coupling between unrelated concepts
233
+ - hidden logical dependencies
234
+ - unimplemented obvious behavior
235
+ - incorrect boundary behavior
236
+ - overridden safeties
237
+ - magic numbers without named meaning
238
+ - negative conditionals that obscure intent
239
+ - ignored tests and insufficient boundary tests
240
+ - functions that require readers to understand an algorithm before they can trust the name
241
+
242
+ ## Change Process
243
+
244
+ For every non-trivial task:
245
+
246
+ 1. Understand the intent and affected behavior.
247
+ 2. Identify the simplest correct change.
248
+ 3. Improve names before adding comments.
249
+ 4. Keep edits localized when possible.
250
+ 5. Add or update tests as needed.
251
+ 6. Run relevant validation.
252
+ 7. Review the diff for readability, duplication, and unnecessary complexity.
253
+ 8. Ensure the final code is cleaner than before.
254
+
255
+ ## Implementation preferences
256
+
257
+ - Prefer explicit, boring, maintainable solutions.
258
+ - Prefer standard library and existing project patterns over new dependencies.
259
+ - Do not add a dependency unless it clearly reduces overall complexity.
260
+ - Reuse established project conventions unless they conflict with these rules or the user explicitly asks otherwise.
261
+ - Keep interfaces small.
262
+ - Keep state transitions obvious.
263
+ - Avoid premature optimization.
264
+ - Optimize only when there is evidence or a known requirement.
265
+
266
+ ## Review checklist
267
+
268
+ Before finishing, verify all of the following:
269
+
270
+ - Names reveal intent.
271
+ - Functions are small and focused.
272
+ - Classes and modules have clear responsibilities.
273
+ - Comments are necessary and accurate.
274
+ - Error handling is explicit and useful.
275
+ - Duplication was removed where reasonable.
276
+ - Tests cover the changed behavior appropriately.
277
+ - The code reads cleanly from top to bottom.
278
+ - The design is simpler or at least not more complex than before.
279
+ - The change follows existing project conventions.
280
+
281
+ ## Output Expectations
282
+
283
+ When making changes:
284
+
285
+ - Briefly explain what changed.
286
+ - State what tests or checks were run.
287
+ - Call out any unresolved risk, assumption, or trade-off.
288
+ - If a requested change conflicts with these rules, follow the user request but mention the conflict explicitly.
289
+
290
+ ## Hard rules
291
+
292
+ - Do not introduce misleading names.
293
+ - Do not keep duplicated logic without a strong reason.
294
+ - Do not add comments where better code would remove the need.
295
+ - Do not mix querying with mutation without a strong reason.
296
+ - Do not silently broaden scope beyond the requested task.
297
+ - Do not leave touched code less readable than before.
@@ -0,0 +1,47 @@
1
+ # OBEY Clean Code by Robert C. Martin
2
+
3
+ ## When to use
4
+
5
+ Use when readability, local reasoning, and maintainable code shape are the main concerns, especially during everyday implementation and review.
6
+
7
+ ## Primary bias to correct
8
+
9
+ Working code is not automatically clean code.
10
+
11
+ ## Decision rules
12
+
13
+ - Treat cleanliness as part of delivery. Preserve behavior, leave touched code cleaner within scope, and do not add mess because the schedule is tight or a rewrite is promised.
14
+ - Write for local reasoning. A reader should understand the path without reconstructing hidden state, wide jumps, or naming trivia.
15
+ - Use precise names and one term per concept. Rename code when vocabulary hides intent, overloads meaning, or forces comments to compensate.
16
+ - Keep functions small, focused, and at one level of abstraction. Tell the story top-down so intent appears before detail.
17
+ - Keep parameters few and meaningful. Avoid boolean flags, output parameters, and grab-bag argument lists; model the concept instead.
18
+ - Separate commands from queries and eliminate hidden side effects. A function that answers should not also mutate behind the reader's back.
19
+ - Keep the happy path readable. Isolate error handling, invalid-state handling, and cleanup; prefer explicit optionality or typed results over null-like sentinel flow when the language supports it.
20
+ - Expose behavior rather than raw representation. Avoid train-wreck access, utility dumping grounds, and classes or modules with mixed responsibilities.
21
+ - Keep construction, framework, persistence, transaction, security, and vendor details outside business behavior.
22
+ - Make public APIs small, explicit, and hard to misuse. Encode boundary logic, required order, and likely changes where readers can see them.
23
+ - Use comments only for rationale, constraints, warnings, or external contracts. Do not narrate code instead of improving it.
24
+ - Treat tests as production code: readable, deterministic, aligned with the behavior or contract they protect, and backed by proportionate validation before calling the change done.
25
+ - Let design emerge through tests, duplication removal, expressiveness, and minimal structure; do not add needless abstractions or infrastructure.
26
+ - When touching code, remove the smell that most increases change cost, but do not silently broaden the task beyond the smallest cleanup that makes the requested change safe.
27
+
28
+ ## Trigger rules
29
+
30
+ - When a function mixes setup, validation, computation, and side effects, split the phases.
31
+ - When a comment explains control flow, simplify names or structure before keeping the comment.
32
+ - When a function both mutates and answers, or hides a mode switch behind a flag, separate the responsibilities.
33
+ - When duplication, repeated switches, or primitive clusters appear, name the concept with an argument object, polymorphism, special case, or other small abstraction.
34
+ - When a boundary leaks framework, vendor, or persistence quirks inward, add or strengthen a local adapter.
35
+ - When async or concurrency enters, isolate threading policy, minimize shared mutable state, define shutdown, and test timing-sensitive behavior.
36
+ - When fixing a bug or changing behavior, add or update the test that protects the intended contract.
37
+ - When cleanup starts spreading into unrelated areas, cut back to the smallest refactor that keeps the requested change safe and readable.
38
+
39
+ ## Final checklist
40
+
41
+ - Can a reader follow the change locally?
42
+ - Are names and APIs carrying the meaning without narration?
43
+ - Is mutation explicit and the happy path still clear?
44
+ - Did framework, persistence, vendor, and construction details stay behind boundaries?
45
+ - Did I remove at least one smell from the touched area?
46
+ - Do tests protect the changed behavior or contract?
47
+ - Did I actually run the relevant tests or checks for this change?
@@ -0,0 +1,32 @@
1
+ # OBEY Clean Code by Robert C. Martin
2
+
3
+ ## When to use
4
+
5
+ Use when you need a small always-on bias toward readable, low-surprise code.
6
+
7
+ ## Primary bias to correct
8
+
9
+ Working code is not automatically clean code.
10
+
11
+ ## Decision rules
12
+
13
+ - Preserve behavior, write for the next reader, and leave touched code cleaner within scope.
14
+ - Write for local reasoning and use precise names with one term per concept.
15
+ - Split boolean flags, mixed abstraction levels, and hidden side effects out of functions.
16
+ - Separate commands from queries and keep parameters small and meaningful.
17
+ - Keep the happy path readable; make invalid states, errors, and cleanup explicit instead of implicit.
18
+ - Use comments only for rationale or contracts, not to explain confusing code.
19
+ - When touching code, remove the smell most likely to make the next change risky or unclear.
20
+
21
+ ## Trigger rules
22
+
23
+ - When a function both mutates and answers, split it.
24
+ - When a comment explains the flow, simplify the code first.
25
+ - When async, concurrency, or framework quirks spread the change, reduce shared mutable state and add the right boundary instead of more branching.
26
+
27
+ ## Final checklist
28
+
29
+ - Local reasoning preserved?
30
+ - Clear names?
31
+ - Clear mutation boundaries?
32
+ - One smell removed?
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: code-complete
3
+ description: Apply Steve McConnell-inspired construction rules when implementing routines, variables, classes, control flow, defensive code, or tests.
4
+ license: MIT
5
+ ---
6
+
7
+ # Code Complete Skill
8
+
9
+ Use this skill when a task involves disciplined software construction: routine design, variable use, class design, control flow, defensive programming, coding standards, or implementation testing.
10
+
11
+ Before making design or code decisions, read and apply [code-complete.mini.md](code-complete.mini.md). Use [code-complete.md](code-complete.md) only as a deeper reference when the mini rules are not enough for the current construction tradeoff.