@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,64 @@
1
+ # OBEY Refactoring.Guru
2
+
3
+ ## When to use
4
+
5
+ Use when changing existing code where code smells, refactoring technique choice, behavior preservation, and cleanup scope control matter.
6
+
7
+ ## Primary bias to correct
8
+
9
+ Refactoring is not general cleanup or pattern application. It is a small, smell-driven, behavior-preserving treatment with verification and a stop condition.
10
+
11
+ ## Decision rules
12
+
13
+ - Separate refactoring from feature work and bug fixes. If behavior changes, name it as behavior change and isolate it from structural edits.
14
+ - Diagnose the smell before choosing a technique: symptom, maintenance cost, scope, expected cleaner end state, verification path, and stop condition.
15
+ - Prefer the smallest treatment that directly reduces the diagnosed smell; escalate only when the smaller technique is blocked.
16
+ - Keep the code runnable and understandable through small named transformations rather than broad redesign.
17
+ - Run relevant checks after risky moves, public interface changes, state-flow changes, or algorithm substitution.
18
+ - Stop when the named smell is gone or materially reduced; record new smells separately unless they block the current change.
19
+ - Use the Rule of Three: tolerate uncertain duplication early, but refactor the third similar occurrence unless the similarity is coincidental.
20
+ - Treat technical debt as compounding cost; pay down the debt that slows current change speed, correctness, or team understanding.
21
+ - Scan smells by category: bloaters, object-orientation abusers, change preventers, dispensables, couplers, and incomplete library gaps.
22
+ - For bloaters, prefer extraction, parameter/data modeling, and responsibility splits before creating method objects, subclasses, or interfaces.
23
+ - For switch/type-code smells, isolate the decision first; use polymorphism, subclasses, or state/strategy only when variation is stable and repeated.
24
+ - For change preventers, move behavior and data toward the owner of the changing concept so one conceptual change has one main edit site.
25
+ - For dispensables, delete or inline unused structure, but check public, generated, reflected, serialized, plugin-facing, and framework extension uses first.
26
+ - For couplers, reduce navigation and private knowledge; keep delegating layers only when they hide volatile structure, policy, or a real boundary.
27
+ - Use comments for rationale, constraints, contracts, or hard algorithms; use names, variables, methods, or assertions when comments explain unclear code.
28
+ - Keep behavior with the data it changes unless separation deliberately supports interchangeable behavior.
29
+ - Encapsulation is not finished by adding getters and setters; move behavior inward when callers are still manipulating exposed data.
30
+ - Avoid speculative abstractions: do not create wrappers, parameter objects, interfaces, superclasses, or hierarchy variants without a real concept or client.
31
+ - Preserve public compatibility or provide a transition path when changing signatures, constructors, visibility, type hierarchy, or externally reachable APIs.
32
+ - Before extraction or movement, identify inputs, outputs, mutated variables, callers, visibility, construction paths, and invariants.
33
+ - Before condition consolidation or algorithm substitution, verify side effects, ordering, truth tables, edge cases, and performance-sensitive behavior.
34
+ - Before data reorganization, decide identity, value/reference semantics, mutability, equality, lifecycle ownership, association direction, and synchronization.
35
+ - Before generalization changes, prove shared behavior is real; preserve substitutability and avoid inheriting unused behavior.
36
+ - Choose exceptions deliberately: a simple conditional, useful comment, intentional strategy separation, small extension point, or clear duplication may be better than a mechanical treatment.
37
+
38
+ ## Trigger rules
39
+
40
+ - When a method needs comments, scrolling, or local-state reconstruction, try `Extract Method`; use `Replace Temp with Query`, `Introduce Parameter Object`, or `Preserve Whole Object` when locals block extraction.
41
+ - When a class has multiple reasons to change, use `Extract Class`; use subclass/interface extraction only for stable variants or real client-facing subsets.
42
+ - When primitives, arrays, magic numbers, or type codes carry meaning, model the concept only if the model adds naming, validation, behavior, or safer variation handling.
43
+ - When a parameter list grows beyond local reasoning, replace derived parameters, preserve a whole object, or introduce a parameter object only for a real recurring concept.
44
+ - When the same change requires edits across many files, move methods/fields or extract ownership so the knowledge is centralized.
45
+ - When client code navigates object chains, hide the delegate or move behavior closer to the data; do not add pure forwarding.
46
+ - When a class mostly forwards, remove the middle man unless it protects boundary policy or volatile structure.
47
+ - When a method both queries and mutates, separate query from modifier unless atomic read-modify behavior is the public contract.
48
+ - When branches repeat behavior, decompose, consolidate, or move duplicate fragments only after checking side effects and execution order.
49
+ - When null checks dominate, introduce a null object only if absence can obey the same interface; keep absence explicit when it is an error.
50
+ - When inheritance creates refused bequest or intimacy, push members down or replace inheritance with delegation.
51
+ - When deleting dead or speculative code, verify external reachability and test-only access before removal.
52
+ - When a library class is incomplete, use a foreign method for one narrow gap and a local extension only for substantial repeated gaps.
53
+ - When cleanup keeps expanding, stop at the diagnosed smell and report the next smell separately.
54
+
55
+ ## Final checklist
56
+
57
+ - Is this change clearly refactoring, feature work, or bug fixing?
58
+ - Which smell was diagnosed, and what cost did it create?
59
+ - Was the smallest suitable treatment used before riskier structure?
60
+ - Did behavior stay preserved under relevant checks?
61
+ - Did the named smell become materially better?
62
+ - Did the change avoid speculative abstraction and mechanical pattern use?
63
+ - Were public compatibility, state flow, and ownership checked?
64
+ - Is any intentionally untreated smell documented rather than hidden?
@@ -0,0 +1,41 @@
1
+ # OBEY Refactoring.Guru
2
+
3
+ ## When to use
4
+
5
+ Use as a compact always-on bias for safe, smell-driven refactoring during existing-code changes.
6
+
7
+ ## Primary bias to correct
8
+
9
+ Refactoring is not cleanup for its own sake: diagnose one smell, treat it with the smallest behavior-preserving move, verify, then stop.
10
+
11
+ ## Decision rules
12
+
13
+ - Separate structural refactoring from feature and bug behavior; if behavior changes, name and isolate it.
14
+ - Diagnose the smell before choosing a technique: symptom, cost, smallest treatment, verification, and stop condition.
15
+ - Prefer small named transformations over broad redesign.
16
+ - Keep the program runnable and run relevant checks after risky movement, state-flow changes, public API changes, or algorithm replacement.
17
+ - Stop when the diagnosed smell is reduced; do not chase new smells unless they block the current change.
18
+ - Prefer extraction, naming, movement, inlining, and encapsulation before adding hierarchy, polymorphism, wrappers, or method objects.
19
+ - Do not create abstractions from coincidental similarity, random parameter bags, simple conditionals, or speculative future needs.
20
+ - Keep behavior with the data it changes unless separation intentionally supports interchangeable behavior.
21
+ - Preserve public compatibility when changing signatures, constructors, visibility, hierarchy, or externally reachable code.
22
+ - Delete or inline dispensable code only after checking public, generated, reflected, serialized, plugin-facing, framework, and test-only uses.
23
+
24
+ ## Trigger rules
25
+
26
+ - When a method needs comments or local-state reconstruction, extract a named method after checking inputs, outputs, and mutated variables.
27
+ - When a class changes for unrelated reasons, extract the responsibility; use subclass/interface only for stable variants or real client subsets.
28
+ - When conditionals repeat by type or state, isolate the decision before using polymorphism; leave simple honest conditionals alone.
29
+ - When duplicate code appears the third time, refactor unless the similarity is likely to diverge.
30
+ - When parameter lists or primitive clumps carry one concept, model the concept; do not pass a huge object to hide dependency.
31
+ - When clients navigate chains or internals, hide the delegate or move behavior; remove pass-through middle men that add no policy.
32
+ - When null, error code, assertion, value/reference, or association changes are considered, verify semantics before changing structure.
33
+
34
+ ## Final checklist
35
+
36
+ - Smell named?
37
+ - Smallest treatment?
38
+ - Behavior verified?
39
+ - Stop condition reached?
40
+ - No hidden feature change?
41
+ - No speculative abstraction?
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: release-it
3
+ description: Apply Michael T. Nygard-inspired production reliability rules when designing failure handling, timeouts, retries, circuit breakers, observability, or deployment behavior.
4
+ license: MIT
5
+ ---
6
+
7
+ # Release It! Skill
8
+
9
+ Use this skill when a task involves production reliability, integration failure, timeouts, retries, circuit breakers, bulkheads, backpressure, observability, capacity, deployment, or operational readiness.
10
+
11
+ Before making design or code decisions, read and apply [release-it.mini.md](release-it.mini.md). Use [release-it.md](release-it.md) only as a deeper reference when the mini rules are not enough for the current production-reliability tradeoff.
@@ -0,0 +1,382 @@
1
+ # OBEY Release It! by Michael T. Nygard
2
+
3
+ ## Purpose
4
+
5
+ This repository follows **Release It!** in the sense of Michael Nygard:
6
+ design and implement software that survives production reality - failures, overload, latency, partial outages, bad data, hostile traffic, and operational mistakes.
7
+
8
+ All code generation, edits, and reviews must optimize for:
9
+ - production readiness
10
+ - failure isolation
11
+ - graceful degradation
12
+ - back pressure and overload protection
13
+ - timeouts and retries with discipline
14
+ - observability
15
+ - survivability over ideal-path elegance
16
+
17
+ This file is a binding engineering policy: `MUST` is binding, `SHOULD` is a strong default, and `MUST NOT` is forbidden.
18
+
19
+ ---
20
+
21
+ ## Primary Directive
22
+
23
+ Assume production will be messy.
24
+
25
+ When uncertain, prefer the design that:
26
+ 1. fails visibly instead of hanging silently
27
+ 2. limits blast radius instead of maximizing coupling
28
+ 3. sheds load instead of collapsing
29
+ 4. preserves core service under stress
30
+ 5. makes diagnosis possible
31
+
32
+ Do not design only for the happy path.
33
+
34
+ ---
35
+
36
+ ## Stability Mindset Rules
37
+
38
+ 1. Every dependency can be slow, unavailable, or wrong.
39
+ 2. Every queue can fill.
40
+ 3. Every cache can miss or stampede.
41
+ 4. Every timeout can cascade.
42
+ 5. Every caller can retry badly.
43
+ 6. Every “temporary” degraded state can become normal for hours.
44
+
45
+ The code must assume these conditions, not merely tolerate them by accident.
46
+
47
+ ---
48
+
49
+ ## Production Readiness and Release Risk Rules
50
+
51
+ 1. Do not treat QA success or feature completion as proof of production readiness.
52
+ 2. Design deployment, operations, security, observability, and rollback as part of the system.
53
+ 3. Reduce release risk through small exposure steps, compatibility discipline, and reversible changes.
54
+ 4. Make version, build, configuration, dependency, and runtime state visible enough to diagnose a live instance.
55
+ 5. Validate critical configuration at startup and make configuration changes auditable and reversible.
56
+
57
+ ---
58
+
59
+ ## Dependency Protection Rules
60
+
61
+ ### Timeouts Are Mandatory
62
+ 1. Outbound calls must have explicit time limits.
63
+ 2. Timeouts must be chosen intentionally, not left to library defaults.
64
+ 3. Different dependencies may need different timeout budgets.
65
+ 4. Infinite waits are forbidden.
66
+
67
+ ### Retries Must Be Disciplined
68
+ 1. Retry only where repeated attempts are safe for the caller and provider.
69
+ 2. Bound retry count and total retry time.
70
+ 3. Add jitter/backoff to avoid synchronized retry storms.
71
+ 4. Do not retry validation errors or permanent failures.
72
+
73
+ ### Circuit Breakers and Fast Failure
74
+ 1. Protect unstable dependencies with fast-fail mechanisms when appropriate.
75
+ 2. When a dependency is clearly unhealthy, stop flooding it.
76
+ 3. Surface fallback or degraded mode explicitly.
77
+
78
+ ### Bulkheads and Isolation
79
+ 1. Separate resource pools for unrelated workloads where failure isolation matters.
80
+ 2. One failing integration must not consume all threads, connections, or worker capacity.
81
+ 3. Isolate slow or risky work from core request paths.
82
+
83
+ Anti-patterns (MUST NOT):
84
+ - nested retries at multiple layers
85
+ - no timeout around remote calls
86
+ - one shared pool for all outbound work
87
+ - treating all failures as transient
88
+
89
+ ---
90
+
91
+ ## Load and Capacity Rules
92
+
93
+ ### Back Pressure
94
+ 1. The system must have a strategy for overload.
95
+ 2. Reject, defer, queue, or degrade intentionally.
96
+ 3. Unbounded acceptance of work is forbidden.
97
+
98
+ ### Queues
99
+ 1. Queues are buffers, not infinite storage.
100
+ 2. Monitor queue length, age, throughput, and failure rate.
101
+ 3. Know what happens when producers outpace consumers.
102
+ 4. Define dead-letter or poison-message handling explicitly.
103
+
104
+ ### Demand Control
105
+ 1. Protect scarce resources with limits.
106
+ 2. Prefer early rejection over total collapse.
107
+ 3. Reserve capacity for critical traffic when appropriate.
108
+
109
+ ### Load Shedding
110
+ 1. Define which work is optional under stress.
111
+ 2. Shed low-value work first.
112
+ 3. Preserve core functions whenever possible.
113
+
114
+ ### Additional Stability Patterns
115
+ - USE Steady State design so routine operation does not require manual cleanup, unbounded growth, or periodic rescue.
116
+ - USE Fail Fast when continuing would hold scarce resources or hide an unrecoverable dependency problem.
117
+ - USE Let It Crash only when supervisors, isolation, and restart behavior make crashing safer than limping.
118
+ - USE Handshaking between instances, load balancers, and dependencies so traffic reaches only ready components.
119
+ - USE Decoupling Middleware when it reduces direct failure propagation; monitor the middleware as a dependency.
120
+ - USE Governors to cap expensive behavior before it harms the rest of the system.
121
+
122
+ Anti-patterns (MUST NOT):
123
+ - unbounded queues
124
+ - accepting work with no plan to finish it
125
+ - letting best-effort tasks crowd out critical work
126
+
127
+ ---
128
+
129
+ ## Runtime State and Restart Safety Rules
130
+
131
+ 1. Make runtime state visible through logs, metrics, health endpoints, administrative interfaces, and diagnostic data.
132
+ 2. Validate external responses by status, content type, shape, and semantics before trusting them.
133
+ 3. Make deployment and operational automation idempotent or restartable where practical.
134
+ 4. Avoid partial deployment or migration steps without a rollback or roll-forward path.
135
+ 5. Validate operational assumptions at system boundaries.
136
+
137
+ ### Restartable Automation
138
+ Required when:
139
+ - deployments touch many machines
140
+ - scripts may be rerun after partial failure
141
+ - migrations run while old and new application versions coexist
142
+ - operational procedures must be repeatable under release pressure
143
+
144
+ Anti-patterns (MUST NOT):
145
+ - one-shot deployment scripts that cannot safely resume
146
+ - manual repair steps with no recorded state
147
+ - side effects before a durable release checkpoint with no recovery plan
148
+
149
+ ---
150
+
151
+ ## Resource Management Rules
152
+
153
+ 1. Explicitly budget scarce resources:
154
+ - threads
155
+ - DB connections
156
+ - sockets
157
+ - file descriptors
158
+ - memory
159
+ - CPU-intensive worker slots
160
+ 2. Release resources deterministically.
161
+ 3. Do not hold locks or expensive connections across slow remote calls.
162
+ 4. Use streaming or pagination for large payloads where appropriate.
163
+ 5. Guard memory-heavy operations.
164
+
165
+ Anti-patterns (MUST NOT):
166
+ - one huge in-memory batch by default
167
+ - blocking worker threads on slow I/O when a better model exists
168
+ - connection pools sized by guess and then ignored
169
+
170
+ ---
171
+
172
+ ## Data Boundary Rules
173
+
174
+ 1. Treat all external input as untrusted.
175
+ 2. Validate syntax, shape, and business plausibility separately where needed.
176
+ 3. Avoid letting malformed data poison caches, queues, or downstream systems.
177
+ 4. Normalize and sanitize data once at the right boundary.
178
+ 5. Keep parsing errors and domain rule violations distinct.
179
+
180
+ ---
181
+
182
+ ## Operational Visibility Rules
183
+
184
+ ### Observability Is Part of the Design
185
+ 1. Emit meaningful logs at boundaries and failure points.
186
+ 2. Include identifiers needed for correlation and diagnosis.
187
+ 3. Measure latency, throughput, error rate, saturation, queue depth, and retry behavior.
188
+ 4. Expose health information that reflects real dependency state.
189
+
190
+ ### Logging
191
+ 1. Log structured context, not just prose.
192
+ 2. Log failures with the dependency, operation, and outcome.
193
+ 3. Do not log secrets.
194
+ 4. Avoid log spam loops under retry storms.
195
+
196
+ ### Metrics
197
+ At minimum, capture:
198
+ - request rate
199
+ - success/failure counts
200
+ - dependency latency
201
+ - timeout counts
202
+ - queue depth
203
+ - retry counts
204
+ - circuit-breaker state
205
+ - saturation signals
206
+
207
+ Anti-patterns (MUST NOT):
208
+ - only logging stack traces without context
209
+ - no metrics for slow dependencies
210
+ - health checks that always return green despite broken downstreams
211
+
212
+ ---
213
+
214
+ ## Incidents, Capacity, and Runtime Control
215
+
216
+ 1. After incidents, identify the failure chain, missing defenses, detection gaps, and design changes.
217
+ 2. For performance or capacity incidents, inspect demand, saturation, latency distribution, queue age, dependency behavior, and traffic concentration.
218
+ 3. Provide administrative interfaces or operational controls only with authorization, auditability, safe defaults, and clear stop mechanisms.
219
+ 4. Keep process code, scripts, and automation observable enough that operators can see what changed and why.
220
+ 5. Treat control planes and delivery tooling as production systems when they can affect production.
221
+
222
+ ---
223
+
224
+ ## Deployment and Startup Rules
225
+
226
+ 1. Startup must fail fast on missing critical configuration.
227
+ 2. Health checks must reflect actual ability to serve.
228
+ 3. Health checks must not mask deadlocks or stuck subsystems.
229
+ 4. Avoid expensive or destructive startup work in request-serving processes when possible.
230
+ 5. Migrations and one-time jobs must be deliberate, observable, and recoverable.
231
+
232
+ ---
233
+
234
+ ## Interconnect, Routing, Security, and Chaos Rules
235
+
236
+ 1. Keep DNS, service discovery, routing, and load balancing health-aware and current.
237
+ 2. Design interconnects to avoid concentrated demand, hidden single points of failure, and uncontrolled fan-out.
238
+ 3. Treat hostile traffic, abusive users, and malformed requests as production load cases.
239
+ 4. Include security in production readiness: secrets, permissions, administrative access, dependency trust, and input handling.
240
+ 5. Use production tests, launch checks, capacity tests, and game days to validate operational assumptions.
241
+ 6. Run chaos or disaster simulations only with a hypothesis, limited blast radius, observability, stop condition, and recovery path.
242
+ 7. Feed findings from chaos and disaster work back into design, operations, and tests.
243
+
244
+ ---
245
+
246
+ ## API and Contract Rules
247
+
248
+ 1. Make failure modes explicit in API contracts where they matter.
249
+ 2. Return clear retryable vs non-retryable outcomes.
250
+ 3. Prefer coarse-grained, resilient interactions over fragile chattiness.
251
+ 4. Use versioning and compatibility discipline for long-lived contracts.
252
+ 5. Document retry, timeout, version, and compatibility expectations clearly.
253
+
254
+ ---
255
+
256
+ ## Cache Rules
257
+
258
+ 1. Cache is an optimization, not a source of truth unless explicitly designed that way.
259
+ 2. Plan for cache miss storms, stale data, and cache outages.
260
+ 3. Avoid dogpiles with request coalescing or appropriate expiry strategies.
261
+ 4. Define what happens when the cache is unavailable.
262
+
263
+ Anti-patterns (MUST NOT):
264
+ - assuming cache hit rate is always high
265
+ - rebuilding the whole cache synchronously on miss
266
+ - hiding correctness assumptions inside cache behavior
267
+
268
+ ---
269
+
270
+ ## Scheduled and Background Work Rules
271
+
272
+ 1. Spread scheduled work so demand does not concentrate at the same instant.
273
+ 2. Do not set all periodic jobs to run on the same obvious clock boundary.
274
+ 3. Failure and retry policy must be explicit.
275
+ 4. Retried work must use increasing backoff where synchronized retry pulses would create load.
276
+ 5. Long-running work needs bounded waits, progress visibility, timeout, and cancellation strategy.
277
+
278
+ ---
279
+
280
+ ## Review Rules
281
+
282
+ When reviewing code, actively look for:
283
+ - outbound calls with no timeout
284
+ - retries without backoff, limits, or a clear failure policy
285
+ - no backoff or jitter
286
+ - unbounded queues or buffers
287
+ - shared resource pools with no isolation
288
+ - no overload strategy
289
+ - no failure visibility
290
+ - health checks that say nothing meaningful
291
+ - scheduled jobs concentrating load at the same instant
292
+ - caches treated as always available
293
+
294
+ ---
295
+
296
+ ## Forbidden Patterns
297
+
298
+ ### Happy-Path Design
299
+ - code that assumes dependencies are fast and correct
300
+ - no timeout, no retry discipline, no degradation path
301
+
302
+ ### Retry Storms
303
+ - retries at every layer
304
+ - retries with no increasing backoff or limits
305
+ - synchronized retries without jitter
306
+
307
+ ### Collapse by Queue
308
+ - unbounded queue growth
309
+ - taking work forever even while falling behind
310
+ - no poison-message handling
311
+
312
+ ### Silent Failure
313
+ - swallowed exceptions
314
+ - generic “something went wrong” without context
315
+ - missing correlation information
316
+
317
+ ### Blast-Radius Amplification
318
+ - one dependency outage consuming all worker threads or DB connections
319
+ - shared pools for all risk classes with no isolation
320
+
321
+ ---
322
+
323
+ ## Code Generation Rules
324
+
325
+ When generating code, default to:
326
+ 1. explicit timeout for every remote dependency
327
+ 2. explicit retry policy only where safe
328
+ 3. restartable deployment and operational automation where practical
329
+ 4. bounded resources and queues
330
+ 5. clear failure paths
331
+ 6. useful diagnostic hooks
332
+ 7. graceful degradation or fast failure where appropriate
333
+
334
+ Avoid by default:
335
+ - infinite waits
336
+ - implicit library retries
337
+ - unbounded buffering
338
+ - best-effort logging with no metrics
339
+ - fragile startup sequences
340
+ - one-shot release automation with no restart path
341
+
342
+ ---
343
+
344
+ ## Testing Rules
345
+
346
+ 1. Test timeout behavior.
347
+ 2. Test retry, backoff, and failure boundaries.
348
+ 3. Test degraded dependency scenarios.
349
+ 4. Test overload and queue saturation behavior where practical.
350
+ 5. Test restartable deployment or operational automation where practical.
351
+ 6. Test startup and health-check failure modes.
352
+
353
+ ---
354
+
355
+ ## Review Checklist
356
+
357
+ Before finalizing any change, verify:
358
+ - Does every remote call have an explicit timeout?
359
+ - Are retries bounded and safe?
360
+ - Are deployment and operational scripts restartable or idempotent where practical?
361
+ - Is there an overload strategy?
362
+ - Are queues and resource pools bounded?
363
+ - Is failure isolated from unrelated work?
364
+ - Are there enough diagnostics to investigate issues?
365
+ - Are health signals meaningful?
366
+ - Are scheduled and background workloads bounded and paced safely?
367
+ - Did we preserve the core service under likely failure scenarios?
368
+
369
+ If any answer is no, revise before shipping.
370
+
371
+ ---
372
+
373
+ ## Final Instruction
374
+
375
+ When uncertain, prefer the design that:
376
+ 1. survives partial failure
377
+ 2. limits blast radius
378
+ 3. fails fast or degrades gracefully
379
+ 4. exposes enough information to operate
380
+ 5. prevents overload from becoming collapse
381
+
382
+ Production reality outranks happy-path elegance.
@@ -0,0 +1,48 @@
1
+ # OBEY Release It! by Michael T. Nygard
2
+
3
+ ## When to use
4
+
5
+ Use for services, APIs, jobs, queues, deployment paths, control tooling, and critical flows that must survive production failures, overload, latency, bad data, hostile traffic, and operational mistakes.
6
+
7
+ ## Primary bias to correct
8
+
9
+ A passing happy path is not production readiness. Design the failure semantics, demand limits, isolation, recovery path, and diagnosis surface before production defines them for you.
10
+
11
+ ## Decision rules
12
+
13
+ - Assume every dependency, queue, cache, timeout, caller retry, and degraded state can fail in slow, partial, or prolonged ways; code must assume production mess instead of merely tolerating it by accident.
14
+ - Prefer designs that fail visibly, limit blast radius, shed load, preserve core service, and make diagnosis possible over designs that maximize coupling or ideal-path elegance.
15
+ - Treat deployment, operations, security, observability, rollback, build and runtime state, dependency state, and configuration validation as part of the system, not after-release chores.
16
+ - Put explicit, intentional time limits on outbound calls and waits. Do not rely on library defaults or allow infinite waits where finite response matters.
17
+ - Retry only when the operation is safe for the caller and provider; bound count and total time, use backoff or jitter, and do not retry validation errors or permanent failures.
18
+ - Isolate dependency and workload failures with circuit breakers, fast failure, bulkheads, separate resource pools, and slow-work isolation so one outage cannot consume all threads, connections, or workers.
19
+ - Design overload behavior explicitly with back pressure, finite queues, demand limits, capacity reserved for critical traffic, and load shedding of lower-value work before core functions collapse.
20
+ - Use stability patterns by failure mode: steady state for routine cleanup and bounded growth, fail fast when continuing hides unrecoverable trouble or holds scarce resources, let-it-crash only with supervision and isolation, handshaking for readiness, decoupling middleware with monitoring, and governors for expensive behavior.
21
+ - Make runtime state, external responses, automation progress, migrations, operational assumptions, and boundary data visible and validated before trusted; keep rollback or roll-forward paths for partial operational changes.
22
+ - Budget scarce resources explicitly, release them deterministically, avoid holding locks or expensive connections across slow remote calls, and stream or paginate large payloads instead of defaulting to huge in-memory batches.
23
+ - Treat external input and external responses as untrusted: validate syntax, shape, business plausibility, status, content type, and semantics; prevent malformed data from poisoning caches, queues, or downstream systems.
24
+ - Build observability into boundaries and failure points with structured context, correlation identifiers, latency, throughput, error, saturation, queue, retry, breaker, dependency, version, configuration, health, and runtime signals while avoiding secrets and retry-storm log spam.
25
+ - Make startup, health checks, migrations, one-time jobs, administrative controls, process code, and delivery tooling fail safely, auditable, authorized, observable, stoppable, and recoverable.
26
+ - Make interconnects, routing, API contracts, caches, scheduled work, and background work production-aware: avoid concentrated demand, hidden single points of failure, uncontrolled fan-out, fragile chattiness, cache dogpiles, stale data surprises, and synchronized job retries.
27
+ - Include security and hostile traffic in production readiness, and use production tests, launch checks, capacity tests, game days, chaos, or disaster simulations only with limited blast radius, observability, stop conditions, and feedback into design.
28
+
29
+ ## Trigger rules
30
+
31
+ - When adding an outbound call, dependency operation, resource checkout, queue consume, or thread wait, define timeout, retry eligibility, retry bounds, fallback or degraded mode, validation, and caller-survival behavior.
32
+ - When adding a queue, buffer, resource pool, cache, log stream, background job, scheduled job, or collection-returning API, define capacity, full behavior, cleanup, miss/stampede/staleness behavior, pacing, pagination or streaming, and saturation monitoring.
33
+ - When a change touches deployment, configuration, startup, migrations, one-time jobs, scripts, or operational automation, make it idempotent or restartable where practical and give it durable state, auditability, verification, and rollback or roll-forward.
34
+ - When adding health checks, load balancing, service discovery, routing, or inter-service handshakes, ensure traffic reaches only ready components and health signals reflect real ability to serve.
35
+ - When designing API or integration contracts, make material failure modes explicit, distinguish retryable from non-retryable outcomes, prefer coarse-grained resilient interactions, and document timeout, retry, version, and compatibility expectations.
36
+ - When reviewing an incident, performance failure, or capacity issue, identify the failure chain, missing defenses, detection gaps, demand, saturation, latency distribution, queue age, dependency behavior, traffic concentration, and design changes.
37
+ - When adding administrative controls, control planes, delivery tooling, hostile-traffic handling, or chaos/disaster work, require authorization, auditability, safe defaults, clear stop mechanisms, bounded blast radius, and recovery paths.
38
+
39
+ ## Final checklist
40
+
41
+ - Explicit timeouts and no infinite waits?
42
+ - Retries safe, bounded, backed off or jittered, and not duplicated across layers?
43
+ - Queues, buffers, pools, caches, logs, payloads, jobs, and result sets bounded?
44
+ - Failure isolated with breakers, bulkheads, fast failure, degradation, or load shedding?
45
+ - External input and dependency responses validated before they affect state, caches, queues, or downstream systems?
46
+ - Diagnostics cover logs, metrics, health, correlation, runtime, version, configuration, dependencies, saturation, queue depth, retries, and breaker state?
47
+ - Startup, deployment, migration, automation, and operational controls restartable, observable, authorized, auditable, and recoverable where practical?
48
+ - Interconnects, APIs, caches, scheduled work, security, and chaos tests have explicit production failure behavior?
@@ -0,0 +1,38 @@
1
+ # OBEY Release It! by Michael T. Nygard
2
+
3
+ ## When to use
4
+
5
+ Use when operational survivability matters and context is tight.
6
+
7
+ ## Primary bias to correct
8
+
9
+ Production failure semantics, overload behavior, isolation, recovery, and diagnosis must be designed, not discovered after release.
10
+
11
+ ## Decision rules
12
+
13
+ - Assume dependencies, queues, caches, callers, timeouts, bad data, and degraded states fail slowly, partially, and for longer than expected.
14
+ - Prefer visible failure, blast-radius limits, load shedding, preserved core service, and diagnosis over happy-path elegance.
15
+ - Bound outbound calls, waits, retries, queues, pools, caches, logs, result sets, payloads, and scarce resources where finite response matters.
16
+ - Retry only when safe, bounded, and backed off or jittered; never retry permanent failures or stack retries into storms.
17
+ - Isolate failure with circuit breakers, bulkheads, fast failure, separate pools, degraded modes, and deterministic cleanup.
18
+ - Treat deployment, startup, automation, health, observability, configuration, rollback, security, and runtime state as production design.
19
+ - Validate external input and responses before trusting them; prevent bad data from poisoning caches, queues, state, or downstream systems.
20
+ - Make APIs, interconnects, caches, jobs, and operational controls explicit about failure, capacity, recovery, authorization, and stop behavior.
21
+
22
+ ## Trigger rules
23
+
24
+ - When adding a remote call, wait, queue, pool, cache, job, retry, or large result path, define bounds, failure behavior, validation, and saturation signals.
25
+ - When changing startup, deployment, migration, configuration, script, or control tooling, make recovery, auditability, observability, and restartability explicit.
26
+ - When traffic can concentrate through routing, scheduling, retries, fan-out, or hostile use, add back pressure, shedding, pacing, or isolation before expensive work.
27
+ - When using production tests, game days, chaos, or disaster drills, require hypothesis, blast-radius limit, observability, stop condition, and recovery path.
28
+
29
+ ## Final checklist
30
+
31
+ - Bounded?
32
+ - Retry disciplined?
33
+ - Failure isolated?
34
+ - Load controlled?
35
+ - Data validated?
36
+ - Observable?
37
+ - Recoverable?
38
+ - Stoppable?