@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.
- package/LICENSE +21 -0
- package/README.md +209 -0
- package/bin/cli.js +244 -0
- package/package.json +35 -0
- package/src/installer.js +236 -0
- package/templates/configs/.editorconfig +12 -0
- package/templates/configs/sample.gitignore +8 -0
- package/templates/docs/FEATURE.md +40 -0
- package/templates/docs/HANDOFF.md +39 -0
- package/templates/docs/IMPLEMENTATION_PLAN.md +47 -0
- package/templates/docs/SPEC_INDEX.md +12 -0
- package/templates/docs/VERIFICATION.md +14 -0
- package/templates/docs/product/ARCHITECTURE.md +22 -0
- package/templates/docs/product/CONSTRAINTS.md +22 -0
- package/templates/docs/product/DATA_MODEL.md +22 -0
- package/templates/docs/product/OVERVIEW.md +22 -0
- package/templates/examples/flutter-handoff/EXERCISES.md +16 -0
- package/templates/examples/flutter-handoff/HANDOFF.md +32 -0
- package/templates/examples/flutter-handoff/docs/SPEC_INDEX.md +19 -0
- package/templates/examples/flutter-handoff/docs/evidence/FEAT-001-verification.md +14 -0
- package/templates/examples/flutter-handoff/docs/features/FEAT-001-local-note.md +40 -0
- package/templates/examples/flutter-handoff/docs/plans/FEAT-001-implementation.md +43 -0
- package/templates/examples/flutter-handoff/docs/product/ARCHITECTURE.md +24 -0
- package/templates/examples/flutter-handoff/docs/product/CONSTRAINTS.md +13 -0
- package/templates/examples/flutter-handoff/docs/product/DATA_MODEL.md +20 -0
- package/templates/examples/flutter-handoff/docs/product/OVERVIEW.md +26 -0
- package/templates/rules/.cursorrules +7 -0
- package/templates/rules/AGENTS.md +61 -0
- package/templates/rules/GEMINI.md +7 -0
- package/templates/skills/a-philosophy-of-software-design/SKILL.md +11 -0
- package/templates/skills/a-philosophy-of-software-design/a-philosophy-of-software-design.md +370 -0
- package/templates/skills/a-philosophy-of-software-design/a-philosophy-of-software-design.mini.md +46 -0
- package/templates/skills/a-philosophy-of-software-design/a-philosophy-of-software-design.nano.md +35 -0
- package/templates/skills/clean-architecture/SKILL.md +11 -0
- package/templates/skills/clean-architecture/clean-architecture.md +515 -0
- package/templates/skills/clean-architecture/clean-architecture.mini.md +49 -0
- package/templates/skills/clean-architecture/clean-architecture.nano.md +36 -0
- package/templates/skills/clean-code/SKILL.md +11 -0
- package/templates/skills/clean-code/clean-code.md +297 -0
- package/templates/skills/clean-code/clean-code.mini.md +47 -0
- package/templates/skills/clean-code/clean-code.nano.md +32 -0
- package/templates/skills/code-complete/SKILL.md +11 -0
- package/templates/skills/code-complete/code-complete.md +354 -0
- package/templates/skills/code-complete/code-complete.mini.md +56 -0
- package/templates/skills/code-complete/code-complete.nano.md +41 -0
- package/templates/skills/council/SKILL.md +37 -0
- package/templates/skills/designing-data-intensive-applications/SKILL.md +11 -0
- package/templates/skills/designing-data-intensive-applications/designing-data-intensive-applications.md +393 -0
- package/templates/skills/designing-data-intensive-applications/designing-data-intensive-applications.mini.md +55 -0
- package/templates/skills/designing-data-intensive-applications/designing-data-intensive-applications.nano.md +34 -0
- package/templates/skills/domain-driven-design/SKILL.md +11 -0
- package/templates/skills/domain-driven-design/domain-driven-design.md +979 -0
- package/templates/skills/domain-driven-design/domain-driven-design.mini.md +48 -0
- package/templates/skills/domain-driven-design/domain-driven-design.nano.md +39 -0
- package/templates/skills/domain-driven-design-distilled/SKILL.md +11 -0
- package/templates/skills/domain-driven-design-distilled/domain-driven-design-distilled.md +317 -0
- package/templates/skills/domain-driven-design-distilled/domain-driven-design-distilled.mini.md +56 -0
- package/templates/skills/domain-driven-design-distilled/domain-driven-design-distilled.nano.md +41 -0
- package/templates/skills/implementation-plan/SKILL.md +42 -0
- package/templates/skills/implementing-domain-driven-design/SKILL.md +11 -0
- package/templates/skills/implementing-domain-driven-design/implementing-domain-driven-design.md +337 -0
- package/templates/skills/implementing-domain-driven-design/implementing-domain-driven-design.mini.md +57 -0
- package/templates/skills/implementing-domain-driven-design/implementing-domain-driven-design.nano.md +37 -0
- package/templates/skills/patterns-of-enterprise-application-architecture/SKILL.md +11 -0
- package/templates/skills/patterns-of-enterprise-application-architecture/patterns-of-enterprise-application-architecture.md +404 -0
- package/templates/skills/patterns-of-enterprise-application-architecture/patterns-of-enterprise-application-architecture.mini.md +54 -0
- package/templates/skills/patterns-of-enterprise-application-architecture/patterns-of-enterprise-application-architecture.nano.md +35 -0
- package/templates/skills/ponytail/SKILL.md +124 -0
- package/templates/skills/ponytail-audit/SKILL.md +45 -0
- package/templates/skills/ponytail-debt/SKILL.md +48 -0
- package/templates/skills/ponytail-gain/SKILL.md +17 -0
- package/templates/skills/ponytail-help/SKILL.md +42 -0
- package/templates/skills/ponytail-review/SKILL.md +61 -0
- package/templates/skills/refactoring/SKILL.md +11 -0
- package/templates/skills/refactoring/refactoring.md +433 -0
- package/templates/skills/refactoring/refactoring.mini.md +49 -0
- package/templates/skills/refactoring/refactoring.nano.md +37 -0
- package/templates/skills/refactoring-guru/SKILL.md +11 -0
- package/templates/skills/refactoring-guru/refactoring-guru.md +765 -0
- package/templates/skills/refactoring-guru/refactoring-guru.mini.md +64 -0
- package/templates/skills/refactoring-guru/refactoring-guru.nano.md +41 -0
- package/templates/skills/release-it/SKILL.md +11 -0
- package/templates/skills/release-it/release-it.md +382 -0
- package/templates/skills/release-it/release-it.mini.md +48 -0
- package/templates/skills/release-it/release-it.nano.md +38 -0
- package/templates/skills/security-audit/AI-AND-LLM.md +83 -0
- package/templates/skills/security-audit/ATTACK-CLASSES.md +130 -0
- package/templates/skills/security-audit/CLIENT-SIDE.md +83 -0
- package/templates/skills/security-audit/CLOUD-AND-DEPLOYMENT.md +86 -0
- package/templates/skills/security-audit/DATA-ISOLATION-AND-LIFECYCLE.md +84 -0
- package/templates/skills/security-audit/DESKTOP-MOBILE-AND-LOCAL-IPC.md +89 -0
- package/templates/skills/security-audit/HUNTING.md +251 -0
- package/templates/skills/security-audit/MEMORY-SAFETY-AND-BINARY.md +101 -0
- package/templates/skills/security-audit/PROTOCOLS-RPC-AND-MESSAGING.md +81 -0
- package/templates/skills/security-audit/RECONNAISSANCE.md +156 -0
- package/templates/skills/security-audit/RESOURCE-EXHAUSTION-AND-AVAILABILITY.md +78 -0
- package/templates/skills/security-audit/SKILL.md +192 -0
- package/templates/skills/security-audit/SUPPLY-CHAIN-AND-RELEASE.md +73 -0
- package/templates/skills/security-audit/VALIDATION-AND-REPORTING.md +186 -0
- package/templates/skills/security-audit/WEB-PROTOCOL-AND-AUTH.md +105 -0
- package/templates/skills/security-audit/report-schema.json +461 -0
- package/templates/skills/security-audit/validate-coverage-ledger.cjs +872 -0
- package/templates/skills/security-audit/validate-coverage-ledger.test.cjs +740 -0
- package/templates/skills/security-audit/validate-findings.cjs +773 -0
- package/templates/skills/security-audit/validate-findings.test.cjs +652 -0
- package/templates/skills/spec/SKILL.md +55 -0
- package/templates/skills/the-pragmatic-programmer/SKILL.md +11 -0
- package/templates/skills/the-pragmatic-programmer/the-pragmatic-programmer.md +359 -0
- package/templates/skills/the-pragmatic-programmer/the-pragmatic-programmer.mini.md +65 -0
- package/templates/skills/the-pragmatic-programmer/the-pragmatic-programmer.nano.md +44 -0
- package/templates/skills/working-effectively-with-legacy-code/SKILL.md +11 -0
- package/templates/skills/working-effectively-with-legacy-code/working-effectively-with-legacy-code.md +371 -0
- package/templates/skills/working-effectively-with-legacy-code/working-effectively-with-legacy-code.mini.md +50 -0
- package/templates/skills/working-effectively-with-legacy-code/working-effectively-with-legacy-code.nano.md +35 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
# OBEY Code Complete by Steve McConnell
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
This repository follows **Code Complete** in the sense of Steve McConnell:
|
|
6
|
+
apply disciplined software construction practices that reduce defects, improve readability, and produce robust code under real-world constraints.
|
|
7
|
+
|
|
8
|
+
All code generation, edits, and reviews must optimize for:
|
|
9
|
+
- low-defect construction
|
|
10
|
+
- readable and intention-revealing code
|
|
11
|
+
- controlled complexity
|
|
12
|
+
- defensive programming where appropriate
|
|
13
|
+
- strong routine and class design
|
|
14
|
+
- practical correctness over style theater
|
|
15
|
+
|
|
16
|
+
This file is a binding engineering policy: `MUST` is binding, `SHOULD` is a strong default, and `MUST NOT` is forbidden.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Primary Directive
|
|
21
|
+
|
|
22
|
+
Construction quality is not accidental.
|
|
23
|
+
|
|
24
|
+
When uncertain, choose the option that:
|
|
25
|
+
1. lowers defect probability
|
|
26
|
+
2. makes the code easier to inspect and reason about
|
|
27
|
+
3. reduces control-flow complexity
|
|
28
|
+
4. uses data and routines clearly
|
|
29
|
+
5. protects the program against invalid states and misuse
|
|
30
|
+
|
|
31
|
+
Do not optimize for cleverness, minimal keystrokes, or fashionable idioms at the cost of clarity.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Foundational Construction Rules
|
|
36
|
+
|
|
37
|
+
1. Write code primarily for human readers.
|
|
38
|
+
2. Favor clarity, locality, and explicitness over trickiness.
|
|
39
|
+
3. Keep control flow simple and visible.
|
|
40
|
+
4. Make correctness easier to achieve than incorrectness.
|
|
41
|
+
5. Use conventions consistently.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Construction Prerequisites and Decisions
|
|
46
|
+
|
|
47
|
+
1. Do not treat construction as isolated typing; verify that requirements, architecture, major risks, and coding conventions are clear enough for the change.
|
|
48
|
+
2. Resolve major construction decisions before large implementation work: language constraints, error policy, data representation, reuse strategy, integration approach, and testing approach.
|
|
49
|
+
3. Use upstream uncertainty as a reason to build a small validated slice, not as an excuse for speculative code.
|
|
50
|
+
4. Keep the software metaphor or design model only if it helps make concrete construction decisions.
|
|
51
|
+
5. Measure twice before cutting when an early decision will be expensive to reverse.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Pseudocode Programming Process
|
|
56
|
+
|
|
57
|
+
1. For complex routines, sketch the routine in precise pseudocode or comments before filling in details.
|
|
58
|
+
2. Refine pseudocode until it names the real steps at a consistent abstraction level.
|
|
59
|
+
3. Convert clear pseudocode into code and keep only comments that still add intent, constraints, or rationale.
|
|
60
|
+
4. Do not use pseudocode as a substitute for understanding the algorithm.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Routine Design Rules
|
|
65
|
+
|
|
66
|
+
1. Routines should have one clear purpose.
|
|
67
|
+
2. The routine name should describe the result or action precisely.
|
|
68
|
+
3. Keep the interface as small as practical.
|
|
69
|
+
4. Avoid long parameter lists and flag arguments.
|
|
70
|
+
5. Separate setup, validation, computation, and side effects when they are conceptually different.
|
|
71
|
+
6. Return values should be meaningful and hard to misuse.
|
|
72
|
+
7. Prefer guard clauses and straightforward structure over deeply nested logic.
|
|
73
|
+
|
|
74
|
+
Anti-patterns (MUST NOT):
|
|
75
|
+
- routines that do several unrelated things
|
|
76
|
+
- routines whose names describe implementation detail instead of purpose
|
|
77
|
+
- many hidden side effects
|
|
78
|
+
- boolean parameters that switch routine mode
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Variable and Data Rules
|
|
83
|
+
|
|
84
|
+
1. Use names that reveal purpose and meaning.
|
|
85
|
+
2. Keep variable scope as small as practical.
|
|
86
|
+
3. Initialize variables deliberately.
|
|
87
|
+
4. Prefer named constants or stable values where a variable is not meant to change.
|
|
88
|
+
5. Avoid magic numbers and unexplained sentinel values.
|
|
89
|
+
6. Use stronger data types when primitives hide meaning.
|
|
90
|
+
|
|
91
|
+
Anti-patterns (MUST NOT):
|
|
92
|
+
- reused loop/index/temp variables beyond their purpose
|
|
93
|
+
- long-lived mutable locals carrying many meanings
|
|
94
|
+
- values whose units or semantics are unclear
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Data Type Rules
|
|
99
|
+
|
|
100
|
+
1. Choose data types that make invalid or ambiguous values harder to represent.
|
|
101
|
+
2. Name constants for magic values, units, bounds, and sentinel meanings.
|
|
102
|
+
3. Use booleans only for true binary meanings; replace flag fields with clearer states when needed.
|
|
103
|
+
4. Use enumerations or named alternatives when a value belongs to a closed set.
|
|
104
|
+
5. Use arrays, records, maps, and tables only where their shape communicates the data meaning.
|
|
105
|
+
6. Encapsulate unusual data structures behind routines or types that reveal purpose.
|
|
106
|
+
7. Keep units, ranges, precision, encoding, and ownership visible near the data they affect.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Control Flow Rules
|
|
111
|
+
|
|
112
|
+
1. Prefer the simplest control flow that expresses the logic.
|
|
113
|
+
2. Keep nesting shallow when possible.
|
|
114
|
+
3. Replace complicated boolean logic with named predicates or clearer structure.
|
|
115
|
+
4. Use case/switch constructs only when they improve clarity.
|
|
116
|
+
5. Eliminate impossible paths and dead branches.
|
|
117
|
+
6. Avoid surprising exits unless they clarify the routine.
|
|
118
|
+
|
|
119
|
+
Anti-patterns (MUST NOT):
|
|
120
|
+
- deeply nested conditionals
|
|
121
|
+
- complicated loop exits with hidden state changes
|
|
122
|
+
- control flow dependent on side effects in expressions
|
|
123
|
+
- clever one-liners that obscure the logic
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Statement, Conditional, and Loop Rules
|
|
128
|
+
|
|
129
|
+
1. Organize straight-line code so dependencies appear before use and related statements stay together.
|
|
130
|
+
2. Keep conditionals positive and direct when possible.
|
|
131
|
+
3. Put the normal path where readers can find it quickly.
|
|
132
|
+
4. Use loops with clear initialization, termination, and update rules.
|
|
133
|
+
5. Keep loop bodies focused; extract work when a loop hides several responsibilities.
|
|
134
|
+
6. Avoid unusual control structures unless they are clearer than ordinary alternatives.
|
|
135
|
+
7. Use table-driven methods when repeated branching is stable and the table can be validated.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Defensive Programming Rules
|
|
140
|
+
|
|
141
|
+
1. Validate inputs at trust boundaries.
|
|
142
|
+
2. Use assertions or invariant checks where programmer assumptions matter.
|
|
143
|
+
3. Distinguish between recoverable conditions and programming errors.
|
|
144
|
+
4. Fail in a way that preserves diagnosability.
|
|
145
|
+
5. Do not silently continue from corrupted or impossible state.
|
|
146
|
+
|
|
147
|
+
Anti-patterns (MUST NOT):
|
|
148
|
+
- assuming all callers are correct
|
|
149
|
+
- burying invalid state until it causes distant failures
|
|
150
|
+
- swallowing exceptions without context
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Error Handling Rules
|
|
155
|
+
|
|
156
|
+
1. Handle errors at the right level of abstraction.
|
|
157
|
+
2. Preserve useful context.
|
|
158
|
+
3. Do not let error handling dominate the normal path.
|
|
159
|
+
4. Standardize similar failure handling.
|
|
160
|
+
5. Prefer explicit, well-understood failure semantics over ad hoc conventions.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Table-Driven and Data-Driven Rules
|
|
165
|
+
|
|
166
|
+
1. Prefer data-driven logic over long repeated condition chains when the mapping is stable and explicit.
|
|
167
|
+
2. Use tables or maps for configuration-like decisions.
|
|
168
|
+
3. Keep the structure obvious and validated.
|
|
169
|
+
4. Do not hide complex logic in inscrutable data encodings.
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Class and Module Design Rules
|
|
174
|
+
|
|
175
|
+
1. Each class or module should own a focused responsibility.
|
|
176
|
+
2. Separate interface from implementation.
|
|
177
|
+
3. Hide representation and incidental detail.
|
|
178
|
+
4. Keep classes cohesive.
|
|
179
|
+
5. Reduce coupling through clear contracts and limited knowledge of internals.
|
|
180
|
+
|
|
181
|
+
Anti-patterns (MUST NOT):
|
|
182
|
+
- god classes
|
|
183
|
+
- modules with mixed persistence, formatting, business logic, and integration concerns
|
|
184
|
+
- public surfaces that expose internal bookkeeping
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Complexity Management Rules
|
|
189
|
+
|
|
190
|
+
1. Treat rising complexity as a defect risk.
|
|
191
|
+
2. Prefer simple code over clever code.
|
|
192
|
+
3. Break apart large or tangled routines and modules.
|
|
193
|
+
4. Remove duplication that multiplies maintenance effort.
|
|
194
|
+
5. Choose designs that reduce the amount a maintainer must keep in working memory.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Construction with Preconditions and Postconditions
|
|
199
|
+
|
|
200
|
+
1. Be explicit about routine assumptions.
|
|
201
|
+
2. Encode important invariants close to the code they protect.
|
|
202
|
+
3. Keep contracts simple and testable.
|
|
203
|
+
4. Use assertions for programmer mistakes, validation for external input, and domain errors for expected business failures.
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Comment Rules
|
|
208
|
+
|
|
209
|
+
1. Comments should explain intent, rationale, contracts, and non-obvious facts.
|
|
210
|
+
2. Do not comment obvious code instead of improving it.
|
|
211
|
+
3. Keep comments accurate or delete them.
|
|
212
|
+
4. Prefer self-documenting structure first, comments second.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Coding Standards Rules
|
|
217
|
+
|
|
218
|
+
1. Be consistent within the codebase.
|
|
219
|
+
2. Use formatting, naming, and file structure to support readability.
|
|
220
|
+
3. Standardize common idioms so readers do not need to relearn style per module.
|
|
221
|
+
4. Prefer a shared convention over local personal taste.
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Incremental Construction Rules
|
|
226
|
+
|
|
227
|
+
1. Build in small, verifiable increments.
|
|
228
|
+
2. Integrate frequently enough to surface conflicts and misunderstanding early.
|
|
229
|
+
3. Keep partial work from rotting in long-lived isolation.
|
|
230
|
+
4. Review and improve code as part of construction, not only after it.
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Quality, Collaboration, Debugging, and Refactoring
|
|
235
|
+
|
|
236
|
+
1. Use reviews, inspections, pair work, tests, and static checks according to the risk of the code.
|
|
237
|
+
2. Treat debugging as diagnosis: reproduce, isolate, explain, fix, and verify rather than guessing.
|
|
238
|
+
3. Fix the root cause when practical, not only the symptom.
|
|
239
|
+
4. Add tests around defects so the same failure is easier to detect next time.
|
|
240
|
+
5. Refactor when structure hides intent, duplicates knowledge, or raises defect probability.
|
|
241
|
+
6. Keep refactoring separate from behavior changes when that improves reviewability.
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Performance, Integration, Tools, and Craftsmanship
|
|
246
|
+
|
|
247
|
+
1. Do not tune performance until the requirement and evidence justify it.
|
|
248
|
+
2. When tuning is justified, measure before and after, and keep clarity unless the tradeoff is explicit.
|
|
249
|
+
3. Integrate frequently enough to expose construction conflicts early.
|
|
250
|
+
4. Use programming tools, scripts, debuggers, profilers, editors, and build automation to reduce error-prone manual work.
|
|
251
|
+
5. Keep layout and style consistent enough that readers can focus on meaning.
|
|
252
|
+
6. Prefer self-documenting code, but add documentation where the code cannot express intent, constraints, or usage.
|
|
253
|
+
7. Treat personal discipline, curiosity, and ability to withstand careful review as part of construction quality.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Review Rules
|
|
258
|
+
|
|
259
|
+
When reviewing code, actively look for:
|
|
260
|
+
- unclear names
|
|
261
|
+
- weak routine boundaries
|
|
262
|
+
- long parameter lists
|
|
263
|
+
- unnecessary nesting
|
|
264
|
+
- hidden side effects
|
|
265
|
+
- poor defensive checks at trust boundaries
|
|
266
|
+
- duplicated logic
|
|
267
|
+
- confusing control flow
|
|
268
|
+
- god classes or mixed responsibilities
|
|
269
|
+
- comments compensating for poor structure
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Forbidden Patterns
|
|
274
|
+
|
|
275
|
+
### Cleverness over Clarity
|
|
276
|
+
- dense tricks that are hard to inspect
|
|
277
|
+
- compressed expressions that save lines but increase interpretation cost
|
|
278
|
+
|
|
279
|
+
### Routine Bloat
|
|
280
|
+
- one routine doing several phases and concerns
|
|
281
|
+
- long signatures with many unrelated parameters
|
|
282
|
+
|
|
283
|
+
### Defensive Vacuum
|
|
284
|
+
- no validation at trust boundaries
|
|
285
|
+
- no checks around critical assumptions
|
|
286
|
+
- silent fallback from impossible state
|
|
287
|
+
|
|
288
|
+
### Comment-as-Crutch
|
|
289
|
+
- obvious comments over bad code
|
|
290
|
+
- stale comments that mislead
|
|
291
|
+
|
|
292
|
+
### Consistency Neglect
|
|
293
|
+
- arbitrary naming and formatting changes
|
|
294
|
+
- module-specific mini dialects inside one codebase
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## Code Generation Rules
|
|
299
|
+
|
|
300
|
+
When generating code, default to:
|
|
301
|
+
1. clear names
|
|
302
|
+
2. focused routines
|
|
303
|
+
3. explicit data meaning
|
|
304
|
+
4. simple control flow
|
|
305
|
+
5. defensive checks at boundaries
|
|
306
|
+
6. cohesive classes/modules
|
|
307
|
+
7. consistent style
|
|
308
|
+
|
|
309
|
+
Avoid by default:
|
|
310
|
+
- dense clever code
|
|
311
|
+
- broad god objects
|
|
312
|
+
- fragile hidden assumptions
|
|
313
|
+
- unnecessary complexity in loops and conditionals
|
|
314
|
+
- comments where better names or decomposition would do
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Testing Rules
|
|
319
|
+
|
|
320
|
+
1. Test routine behavior around normal, boundary, and invalid inputs.
|
|
321
|
+
2. Test defensive checks where boundary validation matters.
|
|
322
|
+
3. Keep tests aligned with routine contracts.
|
|
323
|
+
4. Test complex data-driven logic with representative tables and edge cases.
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Review Checklist
|
|
328
|
+
|
|
329
|
+
Before finalizing any change, verify:
|
|
330
|
+
- Are names clear and intention-revealing?
|
|
331
|
+
- Are routines focused and reasonably small?
|
|
332
|
+
- Is control flow straightforward?
|
|
333
|
+
- Are trust boundaries defended?
|
|
334
|
+
- Are contracts and invariants explicit enough?
|
|
335
|
+
- Did we reduce or at least not increase complexity?
|
|
336
|
+
- Are classes/modules cohesive?
|
|
337
|
+
- Did we avoid cleverness that harms inspection?
|
|
338
|
+
- Are comments used only where they add value?
|
|
339
|
+
- Is the style consistent with the rest of the codebase?
|
|
340
|
+
|
|
341
|
+
If any answer is no, revise before shipping.
|
|
342
|
+
|
|
343
|
+
---
|
|
344
|
+
|
|
345
|
+
## Final Instruction
|
|
346
|
+
|
|
347
|
+
When uncertain, choose the option that:
|
|
348
|
+
1. lowers defect risk
|
|
349
|
+
2. improves readability
|
|
350
|
+
3. simplifies control flow
|
|
351
|
+
4. strengthens defensive correctness
|
|
352
|
+
5. keeps the code easier to inspect and maintain
|
|
353
|
+
|
|
354
|
+
Write code that would stand up to careful review.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# OBEY Code Complete by Steve McConnell
|
|
2
|
+
|
|
3
|
+
## When to use
|
|
4
|
+
|
|
5
|
+
Use when implementing, changing, reviewing, debugging, refactoring, or tuning production code where construction discipline must reduce defects and keep code easy to inspect.
|
|
6
|
+
|
|
7
|
+
## Primary bias to correct
|
|
8
|
+
|
|
9
|
+
Construction quality is not accidental. Do not treat typing code, making it work once, or using a clever idiom as complete construction; choose the option that lowers defect risk and makes the code easier to reason about.
|
|
10
|
+
|
|
11
|
+
## Decision rules
|
|
12
|
+
|
|
13
|
+
- Before large construction work, verify that requirements, architecture, major risks, coding conventions, language constraints, error policy, data representation, reuse, integration, and testing approach are clear enough.
|
|
14
|
+
- When upstream uncertainty remains, build a small validated slice instead of speculative code, and make expensive-to-reverse decisions deliberately.
|
|
15
|
+
- Optimize first for human readers: clarity, locality, explicitness, visible control flow, consistent conventions, and practical correctness over cleverness, minimal keystrokes, or fashion.
|
|
16
|
+
- For complex routines, sketch precise pseudocode or intent comments at a consistent abstraction level, then convert them into code and keep only comments that still explain intent, constraints, contracts, or rationale.
|
|
17
|
+
- Keep routines cohesive, precisely named, small at the interface, and hard to misuse. Separate setup, validation, computation, and side effects when they are conceptually different.
|
|
18
|
+
- Make variable and data meaning explicit through purpose-revealing names, small scope, deliberate initialization, named constants, stronger types, and visible units or sentinel meanings.
|
|
19
|
+
- Choose data types that make invalid or ambiguous values harder to represent; use booleans only for true binary meanings, enumerations for closed sets, and records/maps/tables only when their shape communicates meaning.
|
|
20
|
+
- Keep control flow simple enough to verify: shallow nesting, named predicates for complex conditions, clear normal path, clear loop initialization/termination/update, and no side-effect-dependent expressions or clever one-liners.
|
|
21
|
+
- Use table-driven or data-driven logic for stable explicit mappings only when the table is clearer, obvious, synchronized with the rules, and validated; do not hide complex behavior in inscrutable encodings.
|
|
22
|
+
- Validate input at trust boundaries. Use assertions, invariant checks, and simple contracts for programmer assumptions; use validation or domain errors for expected external or business failures.
|
|
23
|
+
- Handle errors at the right abstraction, preserve diagnostic context, standardize similar failures, keep the normal path readable, and never silently continue from corrupted or impossible state.
|
|
24
|
+
- Keep classes and modules focused, cohesive, and bounded by clear contracts; hide representation and internal bookkeeping, and avoid mixed persistence, formatting, business, and integration concerns.
|
|
25
|
+
- Treat rising complexity as defect risk: split tangled routines or modules, remove duplication that multiplies maintenance effort, and reduce what a maintainer must keep in working memory.
|
|
26
|
+
- Build in small, verifiable increments; integrate often enough to expose conflicts, keep partial work from rotting, and review and improve code during construction.
|
|
27
|
+
- Match reviews, inspections, pair work, tests, static checks, and regression tests to defect risk. Debug by reproducing, isolating, explaining, fixing, and verifying root causes rather than guessing.
|
|
28
|
+
- Refactor when structure hides intent, duplicates knowledge, or raises defect probability, and keep refactoring separate from behavior change when that improves reviewability.
|
|
29
|
+
- Tune performance only when requirements and evidence justify it; measure before and after, and keep clarity unless an explicit measured tradeoff warrants the cost.
|
|
30
|
+
- Use tools, scripts, debuggers, profilers, editors, and build automation to reduce error-prone manual work, not to replace understanding.
|
|
31
|
+
- Use layout, comments, documentation, and coding standards to lower reader effort. Prefer self-documenting structure first; comments should explain intent, assumptions, constraints, limitations, usage, or non-obvious facts.
|
|
32
|
+
|
|
33
|
+
## Trigger rules
|
|
34
|
+
|
|
35
|
+
- When coding starts from a proposed solution, restate the requirement, architecture fit, risks, conventions, and success constraints before implementation.
|
|
36
|
+
- When a routine is hard to name, mixes phases, has flag arguments, long parameters, or hidden side effects, redesign the interface or split the routine.
|
|
37
|
+
- When readers must decode units, ranges, precision, encoding, ownership, status, magic values, or primitive flags, move that meaning into names, constants, types, or structures.
|
|
38
|
+
- When input crosses a user, file, network, external-system, or other trust boundary, decide what is validated, rejected, recovered from, asserted, and kept diagnosable.
|
|
39
|
+
- When branches, loops, recursion, exits, or exception paths become hard to verify, simplify before adding logic.
|
|
40
|
+
- When repeated branching maps stable categories, ranges, conversions, validation, dispatch, or configuration-like rules, consider a validated table.
|
|
41
|
+
- When a class or module exposes representation, grows into a god object, or mixes unrelated responsibilities, restore the abstraction boundary.
|
|
42
|
+
- When tests cover only the happy path, add normal, boundary, invalid-input, defensive-check, routine-contract, and data-driven edge cases.
|
|
43
|
+
- When debugging begins from a guess, first make the failure repeatable, collect evidence, isolate the path, and explain the cause.
|
|
44
|
+
- When refactoring poorly understood or risky code, add tests or analysis first and keep behavior changes separate.
|
|
45
|
+
- When performance work begins, set a target, measure the current behavior, change one thing, remeasure, and document any clarity tradeoff.
|
|
46
|
+
- When comments restate obvious mechanics or go stale, rewrite the code or delete the comment; when code cannot express intent, constraints, or usage, add a close accurate comment.
|
|
47
|
+
- When local style starts to diverge, follow shared formatting, naming, file-structure, and idiom conventions instead of creating a module-specific dialect.
|
|
48
|
+
|
|
49
|
+
## Final checklist
|
|
50
|
+
|
|
51
|
+
- Requirements, architecture fit, risks, conventions, and construction approach are clear enough.
|
|
52
|
+
- Names, routines, data, classes, layout, comments, and standards reduce reader effort.
|
|
53
|
+
- Inputs, errors, assertions, contracts, invariants, impossible states, and trust boundaries are deliberate.
|
|
54
|
+
- Control flow, loops, tables, recursion, exits, and exception paths are simple enough to inspect.
|
|
55
|
+
- Tests, reviews, debugging, refactoring, integration, tooling, and tuning are evidence-based.
|
|
56
|
+
- The change is small enough to verify and would stand up to careful review.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# OBEY Code Complete by Steve McConnell
|
|
2
|
+
|
|
3
|
+
## When to use
|
|
4
|
+
|
|
5
|
+
Use as a compact always-on construction discipline for implementation, review, debugging, refactoring, and tuning.
|
|
6
|
+
|
|
7
|
+
## Primary bias to correct
|
|
8
|
+
|
|
9
|
+
Working code is not enough. Construction must lower defect risk, control complexity, and make human inspection cheap.
|
|
10
|
+
|
|
11
|
+
## Decision rules
|
|
12
|
+
|
|
13
|
+
- Clarify requirements, architecture fit, risks, conventions, and major construction decisions before coding from a solution idea.
|
|
14
|
+
- Choose clarity, locality, explicitness, simple control flow, and consistent style over clever compactness or fashionable idioms.
|
|
15
|
+
- Keep routines, classes, and modules cohesive, precisely named, small at the interface, encapsulated, and hard to misuse.
|
|
16
|
+
- Make data meaning visible with names, constants, stronger types, closed states, deliberate initialization, units, and ownership.
|
|
17
|
+
- Validate trust boundaries; use assertions, invariants, and contracts for programmer assumptions; keep error handling explicit and diagnosable.
|
|
18
|
+
- Keep branches, loops, exits, exceptions, and table-driven logic simple enough to verify.
|
|
19
|
+
- Build, test, review, debug, refactor, integrate, and tune in small evidence-based loops: root cause before fixes, behavior protection before refactoring, measurement before optimization.
|
|
20
|
+
- Use comments, documentation, tools, and standards to reduce reader or manual effort, never to hide poor structure.
|
|
21
|
+
|
|
22
|
+
## Trigger rules
|
|
23
|
+
|
|
24
|
+
- When a solution appears before the problem is clear, restate the requirement, constraints, and construction risks.
|
|
25
|
+
- When readers must decode names, flags, primitives, units, states, or layout, model the meaning explicitly.
|
|
26
|
+
- When a routine mixes phases or has a hard-to-use interface, split concerns or change the data model.
|
|
27
|
+
- When input crosses a trust boundary, decide validation, rejection, recovery, assertion, and diagnostics.
|
|
28
|
+
- When control flow, loops, exceptions, or branching tables are hard to inspect, simplify before adding logic.
|
|
29
|
+
- When tests only prove happy paths, add boundary, invalid-input, defensive-check, contract, and data-driven cases.
|
|
30
|
+
- When debugging, refactoring, or performance work starts from a guess, get evidence first.
|
|
31
|
+
- When comments repeat obvious mechanics, rewrite the code or delete the comment; keep comments for intent and constraints.
|
|
32
|
+
|
|
33
|
+
## Final checklist
|
|
34
|
+
|
|
35
|
+
- Clear construction context?
|
|
36
|
+
- Inspectable code shape?
|
|
37
|
+
- Explicit data meaning?
|
|
38
|
+
- Defended boundaries and diagnosable failures?
|
|
39
|
+
- Simple flow?
|
|
40
|
+
- Defect-finding tests and reviews?
|
|
41
|
+
- Evidence before fixes, refactors, and tuning?
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: council
|
|
3
|
+
description: >
|
|
4
|
+
Stress-test consequential architecture decisions, dependencies, schemas,
|
|
5
|
+
security boundaries, or difficult debugging with distinct perspectives.
|
|
6
|
+
Use for Council requests and design trade-offs before specification approval.
|
|
7
|
+
license: MIT
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Council
|
|
11
|
+
|
|
12
|
+
Inspired by hex/claude-council: https://github.com/hex/claude-council
|
|
13
|
+
Read project `AGENTS.md` for shared workflow policy.
|
|
14
|
+
The Council proposes decisions; Len's approval determines the authoritative architecture.
|
|
15
|
+
|
|
16
|
+
## Ground the decision
|
|
17
|
+
|
|
18
|
+
State observed facts separately from assumptions and untested targets.
|
|
19
|
+
Inspect relevant code, constraints, and existing specifications before proposing a replacement.
|
|
20
|
+
|
|
21
|
+
## Challenge it from four perspectives
|
|
22
|
+
|
|
23
|
+
- Devil's advocate: identify failure modes, missing requirements, and assumptions that could invalidate the design.
|
|
24
|
+
- Simplicity: look for existing or native solutions and unnecessary scope.
|
|
25
|
+
- Security and reliability: inspect trust boundaries, data loss, input validation, and partial failure.
|
|
26
|
+
- Architecture: evaluate clarity, robustness, and long-term maintainability.
|
|
27
|
+
|
|
28
|
+
Use a concise synthesis by default.
|
|
29
|
+
For an explicit debate, present initial positions, rebuttals, and synthesis.
|
|
30
|
+
Use independent subagents only when delegation is explicitly requested and available.
|
|
31
|
+
|
|
32
|
+
## Decision record
|
|
33
|
+
|
|
34
|
+
Report observed facts, unverified assumptions, key critiques, agreement, unresolved trade-offs, the proposed decision, and conditions that would justify revisiting it.
|
|
35
|
+
Feed the decision into the product architecture or feature spec through the spec workflow.
|
|
36
|
+
Obtain Len's approval before using a proposed architecture for implementation planning or execution.
|
|
37
|
+
The Council does not implement production code or silently amend approved architecture.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: designing-data-intensive-applications
|
|
3
|
+
description: Apply Martin Kleppmann-inspired data-system rules when designing reliability, scalability, consistency, replication, transactions, streams, or schema evolution.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Designing Data-Intensive Applications Skill
|
|
8
|
+
|
|
9
|
+
Use this skill when a task involves data ownership, consistency semantics, event flows, replication, partitioning, transactions, streams, batch processing, fault tolerance, or schema evolution.
|
|
10
|
+
|
|
11
|
+
Before making design or code decisions, read and apply [designing-data-intensive-applications.mini.md](designing-data-intensive-applications.mini.md). Use [designing-data-intensive-applications.md](designing-data-intensive-applications.md) only as a deeper reference when the mini rules are not enough for the current data-system tradeoff.
|