@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,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec
|
|
3
|
+
description: >
|
|
4
|
+
Explore Len's product with questions, then create or revise organized product
|
|
5
|
+
and feature specs with observable acceptance criteria and explicit approval.
|
|
6
|
+
Use for spec writing, requirements discovery, or organizing overlapping specs.
|
|
7
|
+
Execution tasks belong in the implementation-plan skill.
|
|
8
|
+
license: MIT
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Spec discovery and maintenance
|
|
12
|
+
|
|
13
|
+
Read project `AGENTS.md` for Len's authority, evidence, and preservation rules.
|
|
14
|
+
Read `docs/SPEC_INDEX.md` and `HANDOFF.md` when present, then inventory existing specs before creating any file.
|
|
15
|
+
Adopt an established project convention rather than silently creating a second documentation tree.
|
|
16
|
+
If conflicting documents exist, identify the conflict for Len; do not arbitrarily pick the newest filename as authoritative.
|
|
17
|
+
|
|
18
|
+
## Discover the product
|
|
19
|
+
|
|
20
|
+
Explore the whole product first, then detail one feature at a time.
|
|
21
|
+
Ask focused rounds of roughly 4-6 questions in chat, with sensible defaults labeled as proposals.
|
|
22
|
+
Cover users, real scenarios, all planned features, main flows, shared data, system boundaries, architecture, and major constraints.
|
|
23
|
+
Summarize confirmed decisions and remaining gaps after each round.
|
|
24
|
+
Use Council perspectives for consequential architecture decisions, not routine wording choices.
|
|
25
|
+
Choose frameworks and libraries per project; do not assume a universal Flutter stack.
|
|
26
|
+
|
|
27
|
+
For Flutter Android features, consider offline behavior, permissions, storage and recovery, navigation, accessibility, error states, and supported Android versions.
|
|
28
|
+
For hardware features, separate desired capabilities, assumptions, operating conditions, and evidence from bench or field checks.
|
|
29
|
+
Ask only questions relevant to the project and never add a requirement solely to fill a heading.
|
|
30
|
+
Resolve blocking decisions before presenting the baseline for Len's chat approval.
|
|
31
|
+
|
|
32
|
+
## Author and reuse
|
|
33
|
+
|
|
34
|
+
Read the relevant templates in `.agents/templates/docs/`, installed by `len-toolkit start`.
|
|
35
|
+
In the toolkit source checkout, their source is `templates/docs/`.
|
|
36
|
+
Create only documents that are useful now; use an index and product categories as the project baseline grows.
|
|
37
|
+
Keep one stable `FEAT-NNN-name.md` per feature and allocate its ID after checking the index.
|
|
38
|
+
Refinements update that file instead of making daily copies.
|
|
39
|
+
Record creation and substantive-update timestamps as ISO 8601 with `+08:00`, revision, and status.
|
|
40
|
+
Archive superseded documents, link them to their replacement, update incoming links and the index, and preserve existing history.
|
|
41
|
+
|
|
42
|
+
A feature spec contains purpose, scope and non-goals, flows, requirements with observable acceptance criteria, data/interfaces, quality constraints, decisions/assumptions, and open questions/readiness.
|
|
43
|
+
Use `REQ-001` IDs within a feature and `FEAT-001/REQ-001` in cross-document references.
|
|
44
|
+
Cover relevant loading, empty, error, recovery, permission-denied, and offline states.
|
|
45
|
+
Reference shared requirements instead of copying them into every feature.
|
|
46
|
+
Keep task checkboxes, commands to execute, phase progress, and file-edit recipes in the implementation plan.
|
|
47
|
+
|
|
48
|
+
## Approval and handoff
|
|
49
|
+
|
|
50
|
+
Present the baseline and architecture for Len's explicit approval, then each detailed feature spec and its implementation plan together.
|
|
51
|
+
Record actual chat approval against exact revisions; draft prose is not approval.
|
|
52
|
+
A behavior, architecture, or acceptance-criteria change requires a revised approval for affected work.
|
|
53
|
+
Editorial corrections do not authorize new behavior.
|
|
54
|
+
After approval, update the single root `HANDOFF.md` with links and execution scope using its template.
|
|
55
|
+
When asked only to draft or review specs, do not start implementation.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: the-pragmatic-programmer
|
|
3
|
+
description: Apply Hunt and Thomas-inspired pragmatic programming rules when improving engineering judgment, feedback loops, DRY knowledge, orthogonality, automation, or adaptability.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# The Pragmatic Programmer Skill
|
|
8
|
+
|
|
9
|
+
Use this skill when a task involves pragmatic engineering judgment, responsibility, DRY at the knowledge level, orthogonality, automation, prototyping, fast feedback, or adaptable design.
|
|
10
|
+
|
|
11
|
+
Before making design or code decisions, read and apply [the-pragmatic-programmer.mini.md](the-pragmatic-programmer.mini.md). Use [the-pragmatic-programmer.md](the-pragmatic-programmer.md) only as a deeper reference when the mini rules are not enough for the current engineering tradeoff.
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
# OBEY The Pragmatic Programmer by Andrew Hunt and David Thomas
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
This repository follows **The Pragmatic Programmer** in the sense of Andrew Hunt and David Thomas:
|
|
6
|
+
work pragmatically, take responsibility for quality, automate what is repetitive, and keep code and process adaptable.
|
|
7
|
+
|
|
8
|
+
All code generation, edits, and reviews must optimize for:
|
|
9
|
+
- clear ownership and responsibility
|
|
10
|
+
- avoiding duplicated knowledge
|
|
11
|
+
- orthogonality
|
|
12
|
+
- incremental delivery
|
|
13
|
+
- ruthless feedback
|
|
14
|
+
- automation of repetitive work
|
|
15
|
+
- code that is easy to change and easy to reason about
|
|
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
|
+
Be pragmatic, not dogmatic.
|
|
24
|
+
|
|
25
|
+
When uncertain, choose the option that:
|
|
26
|
+
1. reduces knowledge duplication
|
|
27
|
+
2. keeps concerns independent
|
|
28
|
+
3. shortens feedback loops
|
|
29
|
+
4. leaves the system easier to change
|
|
30
|
+
5. makes intent clearer to future maintainers
|
|
31
|
+
|
|
32
|
+
Do not follow style or process rituals that do not improve outcomes.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Core Pragmatic Principles
|
|
37
|
+
|
|
38
|
+
### Own the Result
|
|
39
|
+
1. Take responsibility for the quality and changeability of the code you touch.
|
|
40
|
+
2. Do not blame tooling, framework defaults, or “existing style” for avoidable bad design.
|
|
41
|
+
3. Surface trade-offs, risks, and uncertainty explicitly.
|
|
42
|
+
|
|
43
|
+
### Think Beyond the Local Edit
|
|
44
|
+
1. Every change affects future maintainability.
|
|
45
|
+
2. Small quick fixes that multiply future cost are usually a bad bargain.
|
|
46
|
+
3. Leave the area better than you found it.
|
|
47
|
+
|
|
48
|
+
### Favor Adaptability
|
|
49
|
+
1. Build systems that are easy to observe, test, and change.
|
|
50
|
+
2. Prefer flexible boundaries over brittle cleverness.
|
|
51
|
+
3. Avoid premature commitment when requirements are still moving.
|
|
52
|
+
|
|
53
|
+
### Named Pragmatic Habits
|
|
54
|
+
1. Treat quality as a requirement to negotiate with users and sponsors, not as an abstract pursuit of perfection.
|
|
55
|
+
2. Stop polishing when the software is good enough for its real users and risks.
|
|
56
|
+
3. Keep a knowledge portfolio: invest in learning, diversify skills, and revisit stale assumptions.
|
|
57
|
+
4. Communicate decisions, risks, and tradeoffs clearly enough that others can act on them.
|
|
58
|
+
5. Watch for entropy and small broken windows before they become normal.
|
|
59
|
+
6. Use Stone Soup tactics only to create real progress, not to hide missing agreement.
|
|
60
|
+
7. Watch for boiled-frog drift where gradual degradation becomes invisible.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## DRY Rules
|
|
65
|
+
|
|
66
|
+
DRY means **do not duplicate knowledge**, not merely do not duplicate text.
|
|
67
|
+
|
|
68
|
+
1. A business rule should have one authoritative representation.
|
|
69
|
+
2. Validation logic for the same concept should not be scattered.
|
|
70
|
+
3. Status semantics, mappings, and calculations should not be copied across layers.
|
|
71
|
+
4. Configuration and schema meaning should not be repeated inconsistently.
|
|
72
|
+
5. Avoid duplicated process steps that can be automated.
|
|
73
|
+
|
|
74
|
+
Anti-patterns (MUST NOT):
|
|
75
|
+
- the same rule encoded in UI, API, service, and DB trigger with no ownership
|
|
76
|
+
- copy/paste with minor edits for “just this one case”
|
|
77
|
+
- duplicated manual deployment or testing steps
|
|
78
|
+
- one concept with multiple partially aligned implementations
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Orthogonality Rules
|
|
83
|
+
|
|
84
|
+
1. Keep components independent so one change does not force unrelated changes elsewhere.
|
|
85
|
+
2. Minimize hidden couplings through globals, ambient context, or shared mutable state.
|
|
86
|
+
3. Avoid overlapping responsibilities between modules.
|
|
87
|
+
4. Separate policy from mechanism, data from presentation, orchestration from computation.
|
|
88
|
+
|
|
89
|
+
Anti-patterns (MUST NOT):
|
|
90
|
+
- one change requiring edits in many unrelated places
|
|
91
|
+
- one module knowing too much about internal details of others
|
|
92
|
+
- shared utility modules creating sideways coupling everywhere
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Tracer Bullets and Iterative Delivery
|
|
97
|
+
|
|
98
|
+
1. Prefer a thin end-to-end slice over a pile of isolated pieces.
|
|
99
|
+
2. Use tracer bullets to validate architecture, integration, and assumptions early.
|
|
100
|
+
3. Keep the first slice simple but real enough to prove the path.
|
|
101
|
+
4. Refine from working feedback instead of predicting everything up front.
|
|
102
|
+
|
|
103
|
+
Anti-patterns (MUST NOT):
|
|
104
|
+
- building many layers before anything runs end to end
|
|
105
|
+
- treating prototypes as production without hardening
|
|
106
|
+
- waiting for perfect certainty before integrating
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Reversibility, Domain Languages, and Requirements
|
|
111
|
+
|
|
112
|
+
1. Preserve reversibility when requirements, vendors, platforms, databases, or deployment environments may change.
|
|
113
|
+
2. Avoid irreversible commitments until evidence makes them worth the cost.
|
|
114
|
+
3. Use a small domain language when it expresses domain rules more directly than general-purpose code.
|
|
115
|
+
4. Keep domain languages readable by the people who must validate or change them.
|
|
116
|
+
5. Dig for real requirements; do not accept current implementation details as requirements.
|
|
117
|
+
6. Do not fall into the specification trap where prose keeps growing but uncertainty does not fall.
|
|
118
|
+
7. Start building a working slice when further specification no longer reduces meaningful risk.
|
|
119
|
+
8. Respect informed hesitation: if the team is not ready, identify the missing information or feedback.
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Prototyping Rules
|
|
124
|
+
|
|
125
|
+
1. Use prototypes to learn, not to pretend you are done.
|
|
126
|
+
2. Be explicit about what a prototype proves and what it does not.
|
|
127
|
+
3. Do not let experimental shortcuts silently become production defaults.
|
|
128
|
+
4. Carry forward only the lessons or code that still deserve to survive.
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Automation Rules
|
|
133
|
+
|
|
134
|
+
1. Automate repetitive, error-prone, or easy-to-forget tasks.
|
|
135
|
+
2. Prefer repeatable scripts over tribal-knowledge commands.
|
|
136
|
+
3. Build, test, lint, format, package, and deploy steps should be reproducible.
|
|
137
|
+
4. Keep local automation aligned with the project's shared build, test, and release automation.
|
|
138
|
+
|
|
139
|
+
Anti-patterns (MUST NOT):
|
|
140
|
+
- “works on my machine” build steps
|
|
141
|
+
- manual release rituals with many hidden prerequisites
|
|
142
|
+
- documentation that describes what a script should do instead of having the script
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Feedback Loop Rules
|
|
147
|
+
|
|
148
|
+
1. Shorten the time between change and feedback.
|
|
149
|
+
2. Run relevant tests early and often.
|
|
150
|
+
3. Use automated checks where they reduce real risk.
|
|
151
|
+
4. Make failure visible fast.
|
|
152
|
+
5. Prefer a cheap early signal over a late expensive surprise.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Design by Contract and Assertions
|
|
157
|
+
|
|
158
|
+
1. Make assumptions explicit in code.
|
|
159
|
+
2. Use assertions or invariant checks where they clarify impossible states.
|
|
160
|
+
3. Distinguish between programmer errors, contract violations, and expected domain failures.
|
|
161
|
+
4. Keep contracts close to the abstraction they protect.
|
|
162
|
+
|
|
163
|
+
Anti-patterns (MUST NOT):
|
|
164
|
+
- relying on comments for critical preconditions
|
|
165
|
+
- hiding invariant assumptions in scattered callers
|
|
166
|
+
- returning nonsense values for impossible states
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## Error Handling and Recovery
|
|
171
|
+
|
|
172
|
+
1. Detect errors close to their source.
|
|
173
|
+
2. Do not discard useful error context.
|
|
174
|
+
3. Let callers distinguish retryable, recoverable, and permanent failures where relevant.
|
|
175
|
+
4. Fail loudly enough to diagnose, but with boundaries that prevent system-wide collapse.
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Naming and Communication Rules
|
|
180
|
+
|
|
181
|
+
1. Code is communication first.
|
|
182
|
+
2. Use names that reflect domain meaning and developer intent.
|
|
183
|
+
3. Prefer clarity over cleverness.
|
|
184
|
+
4. Write comments or docs where they convey decision rationale, contracts, or non-obvious behavior.
|
|
185
|
+
5. Writing is part of engineering, not overhead.
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Text and Data Rules
|
|
190
|
+
|
|
191
|
+
1. Favor plain text and open formats for long-lived automation and integration where practical.
|
|
192
|
+
2. Make scripts and configs inspectable and diffable.
|
|
193
|
+
3. Keep serialization and config formats explicit and version-aware.
|
|
194
|
+
4. Avoid opaque binary or framework-specific lock-in unless justified.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## State and Concurrency Rules
|
|
199
|
+
|
|
200
|
+
1. Treat shared mutable state as expensive.
|
|
201
|
+
2. Prefer immutability, isolation, or explicit synchronization when state is shared.
|
|
202
|
+
3. Keep concurrency assumptions visible.
|
|
203
|
+
4. Do not add asynchronous complexity unless it clearly earns its cost.
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Estimation and Increment Rules
|
|
208
|
+
|
|
209
|
+
1. Break work into pieces that can be reasoned about, tested, and corrected.
|
|
210
|
+
2. Keep plans and estimates honest about uncertainty.
|
|
211
|
+
3. Prefer small deliverable increments to large hidden progress.
|
|
212
|
+
4. Make risk visible early.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Tooling Rules
|
|
217
|
+
|
|
218
|
+
1. Know and use the tools that amplify correctness and speed.
|
|
219
|
+
2. Do not hand-do tasks that should be scripted.
|
|
220
|
+
3. Keep editor, formatter, lint, tests, and local scripts aligned with team standards.
|
|
221
|
+
4. Improve the toolchain when repeated friction appears.
|
|
222
|
+
|
|
223
|
+
### Basic Tool Rules
|
|
224
|
+
- Use source control for every meaningful project, including small or solo work.
|
|
225
|
+
- Prefer inspectable plain text for long-lived scripts, configs, data, and generated sources when practical.
|
|
226
|
+
- Use shell tools for exploration, automation, and repeatable transformations where they fit.
|
|
227
|
+
- Use editor capabilities to reduce repetitive manual edits.
|
|
228
|
+
- Use text manipulation languages or scripts for systematic changes that would be error-prone by hand.
|
|
229
|
+
- Use code generators to remove duplicated mechanical work, but keep the source specification authoritative.
|
|
230
|
+
- When debugging, do not guess: reproduce, observe, isolate, explain, fix, and verify.
|
|
231
|
+
- Do not rely on generated code, tools, specifications, or formal methods you do not understand.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Resource and Coupling Rules
|
|
236
|
+
|
|
237
|
+
1. Finish what you start when allocating, opening, locking, or otherwise acquiring resources.
|
|
238
|
+
2. Release every resource you acquire, preferably in the opposite order from acquisition.
|
|
239
|
+
3. Keep resource ownership local and explicit.
|
|
240
|
+
4. Apply shy-code and Law of Demeter discipline so modules reveal only necessary information.
|
|
241
|
+
5. Avoid temporal coupling; make ordering requirements explicit or remove them.
|
|
242
|
+
6. Use metaprogramming only when it reduces duplication or improves adaptability without hiding behavior.
|
|
243
|
+
7. Use blackboard-style coordination only when uncertain order, multiple sources, or opportunistic collaboration justify it.
|
|
244
|
+
8. Understand algorithmic growth before writing or accepting performance-sensitive code.
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Project and Team Rules
|
|
249
|
+
|
|
250
|
+
1. Build pragmatic teams around shared responsibility, automation, fast feedback, and visible quality.
|
|
251
|
+
2. Test unit behavior, integration, validation and verification, resource exhaustion, errors and recovery, performance, usability, and tests themselves where relevant.
|
|
252
|
+
3. Treat writing as engineering work: docs, comments, commit messages, scripts, and tests must communicate intent.
|
|
253
|
+
4. Set expectations explicitly with users and stakeholders.
|
|
254
|
+
5. Take pride in code, tests, documentation, and generated artifacts.
|
|
255
|
+
6. Be skeptical of methods, diagrams, and ceremonies that do not improve the work.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Broken Windows Rule
|
|
260
|
+
|
|
261
|
+
1. Do not normalize local decay.
|
|
262
|
+
2. Fix small quality problems before they signal that nobody cares.
|
|
263
|
+
3. Tidy the code you touch where the cost is low and the value is immediate.
|
|
264
|
+
4. Avoid leaving behind “temporary” hacks with no cleanup plan.
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Review Rules
|
|
269
|
+
|
|
270
|
+
When reviewing code, actively look for:
|
|
271
|
+
- duplicated knowledge, not just duplicated lines
|
|
272
|
+
- hidden couplings
|
|
273
|
+
- missing automation opportunities
|
|
274
|
+
- long feedback loops
|
|
275
|
+
- local fixes that worsen future changeability
|
|
276
|
+
- unclear contracts or assumptions
|
|
277
|
+
- non-repeatable manual processes
|
|
278
|
+
- brittle integration points
|
|
279
|
+
- code that communicates poorly
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Forbidden Patterns
|
|
284
|
+
|
|
285
|
+
### Cargo-Cult Process
|
|
286
|
+
- rituals followed with no benefit
|
|
287
|
+
- documentation and checklists replacing automation
|
|
288
|
+
|
|
289
|
+
### Knowledge Duplication
|
|
290
|
+
- same rule in many places
|
|
291
|
+
- copied logic because “layers need it too”
|
|
292
|
+
|
|
293
|
+
### Non-Orthogonal Design
|
|
294
|
+
- modules with overlapping responsibilities
|
|
295
|
+
- changes leaking across boundaries by default
|
|
296
|
+
|
|
297
|
+
### Manual Everything
|
|
298
|
+
- repeated human steps for build, test, release, setup, or validation
|
|
299
|
+
- hidden local environment assumptions
|
|
300
|
+
|
|
301
|
+
### Prototype Fossilization
|
|
302
|
+
- experimental code promoted to production without redesign or hardening
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## Code Generation Rules
|
|
307
|
+
|
|
308
|
+
When generating code, default to:
|
|
309
|
+
1. one clear source of truth for each rule
|
|
310
|
+
2. orthogonal responsibilities
|
|
311
|
+
3. fast local feedback
|
|
312
|
+
4. automation over repeated manual work
|
|
313
|
+
5. explicit contracts and assumptions
|
|
314
|
+
6. readable names and communication
|
|
315
|
+
7. incremental end-to-end slices when building new capabilities
|
|
316
|
+
|
|
317
|
+
Avoid by default:
|
|
318
|
+
- copy/paste rule duplication
|
|
319
|
+
- tangled modules
|
|
320
|
+
- fragile manual workflows
|
|
321
|
+
- overcommitting to an architecture before the first end-to-end path works
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
## Testing Rules
|
|
326
|
+
|
|
327
|
+
1. Keep tests runnable quickly and often.
|
|
328
|
+
2. Prefer tests that align with the business or technical contract being protected.
|
|
329
|
+
3. Use automation so validation is habitual, not heroic.
|
|
330
|
+
4. Keep flaky or environment-dependent tests out of the critical feedback path where possible.
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## Review Checklist
|
|
335
|
+
|
|
336
|
+
Before finalizing any change, verify:
|
|
337
|
+
- Did we reduce duplicated knowledge?
|
|
338
|
+
- Are responsibilities more orthogonal after the change?
|
|
339
|
+
- Did we improve or preserve fast feedback?
|
|
340
|
+
- Did we automate anything repetitive that was hurting reliability?
|
|
341
|
+
- Are contracts and assumptions clearer?
|
|
342
|
+
- Is the code easier to communicate about?
|
|
343
|
+
- Did we avoid prototype shortcuts becoming silent production defaults?
|
|
344
|
+
- Did we fix at least one small “broken window” if it was in the touched area?
|
|
345
|
+
|
|
346
|
+
If any answer is no, revise before shipping.
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## Final Instruction
|
|
351
|
+
|
|
352
|
+
When uncertain, choose the option that:
|
|
353
|
+
1. removes duplicated knowledge
|
|
354
|
+
2. keeps concerns orthogonal
|
|
355
|
+
3. shortens feedback loops
|
|
356
|
+
4. improves automation
|
|
357
|
+
5. leaves the codebase easier to change tomorrow
|
|
358
|
+
|
|
359
|
+
Be pragmatic, and make the right thing the easy thing.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# OBEY The Pragmatic Programmer by Andrew Hunt and David Thomas
|
|
2
|
+
|
|
3
|
+
## When to use
|
|
4
|
+
|
|
5
|
+
Use as a general engineering operating style when the goal is accountable delivery, adaptability, fast feedback, and code that remains easy to change.
|
|
6
|
+
|
|
7
|
+
## Primary bias to correct
|
|
8
|
+
|
|
9
|
+
Do not optimize only for the local edit, requested feature, or familiar ritual. Own the outcome by reducing duplicated knowledge, keeping concerns independent, proving assumptions early, automating repeated work, and making intent clear.
|
|
10
|
+
|
|
11
|
+
## Decision rules
|
|
12
|
+
|
|
13
|
+
- Be pragmatic, not dogmatic: choose the practice, formality, quality level, and stopping point that improves real outcomes for the users, risks, and codebase.
|
|
14
|
+
- Own the result. Surface tradeoffs, risks, uncertainty, and avoidable design costs instead of blaming tools, framework defaults, schedule pressure, or existing style.
|
|
15
|
+
- Think beyond the local edit: quick fixes that multiply future maintenance cost are usually a bad bargain; leave touched areas better where the cost is low.
|
|
16
|
+
- Keep one authoritative representation for each piece of system knowledge. Business rules, validation, status semantics, mappings, calculations, schemas, configuration meaning, generated output, and manual process steps should derive from or trace to one owner.
|
|
17
|
+
- Preserve orthogonality: keep components independent, responsibilities non-overlapping, interfaces narrow, collaborator knowledge small, and policy, mechanism, data, presentation, orchestration, and computation separated.
|
|
18
|
+
- Keep volatile decisions reversible where practical. Do not hard-code vendors, platforms, databases, deployment environments, policies, or requirements before evidence justifies the commitment.
|
|
19
|
+
- Use domain vocabulary and small domain languages only when they make rules clearer to the people who must validate or change them.
|
|
20
|
+
- Prefer thin end-to-end tracer bullets over piles of isolated pieces. Keep the first slice simple but real enough to validate architecture, integration, and assumptions.
|
|
21
|
+
- Use prototypes to learn, not to pretend the work is done. State what the prototype proves, what it does not prove, and which shortcuts must be discarded or hardened.
|
|
22
|
+
- Dig for real requirements. Separate durable needs and constraints from current implementation details, proposed solutions, growing prose specs, and unresolved team hesitation.
|
|
23
|
+
- Automate repetitive, error-prone, easy-to-forget, or ritualized work. Builds, tests, linting, formatting, packaging, deployment, setup, validation, and release should be reproducible and aligned with shared automation.
|
|
24
|
+
- Shorten feedback loops with relevant tests, automated checks, visible failures, and cheap early signals before late expensive surprises.
|
|
25
|
+
- Make contracts, assumptions, invariants, responsibilities, and caller/callee obligations explicit and close to the abstraction they protect.
|
|
26
|
+
- Distinguish programmer errors, contract violations, impossible states, expected domain failures, retryable failures, recoverable failures, and permanent failures; preserve diagnostic context and fail inside boundaries that prevent wider collapse.
|
|
27
|
+
- Treat resource ownership as a contract. Release every acquired allocation, handle, lock, or resource on success and failure paths, preferably opposite acquisition order.
|
|
28
|
+
- Prefer inspectable plain text, open formats, scripts, explicit serialization, and version-aware configuration when longevity, diffability, automation, migration, or interoperability matter.
|
|
29
|
+
- Treat shared mutable state, ambient context, globals, temporal coupling, and asynchronous complexity as costs that must earn themselves and be made visible.
|
|
30
|
+
- Use tooling as leverage for correctness and speed, but understand generated code, formal methods, specifications, and tool output before relying on them.
|
|
31
|
+
- Debug from reproduced facts: observe, isolate, explain, fix, and verify before guessing or blaming compilers, operating systems, libraries, or vendors.
|
|
32
|
+
- Break work into small deliverable increments with honest uncertainty, visible risk, and estimates that can be corrected by feedback.
|
|
33
|
+
- Communicate through code, names, docs, comments, commit messages, scripts, tests, and artifacts. Use comments for rationale, contracts, or non-obvious behavior, not as substitutes for encoded rules.
|
|
34
|
+
- Build pragmatic teams around shared responsibility, explicit expectations, automation, fast feedback, visible quality, and artifacts you are willing to stand behind.
|
|
35
|
+
- Apply the broken windows rule: fix or visibly contain small quality decay before bad code, unclear ownership, weak design, or broken process becomes normal.
|
|
36
|
+
|
|
37
|
+
## Trigger rules
|
|
38
|
+
|
|
39
|
+
- When the same fact appears in multiple artifacts, choose one owner and derive, generate, validate, or trace the rest.
|
|
40
|
+
- When one change requires edits in many unrelated places, repair the missing boundary or hidden coupling before it spreads.
|
|
41
|
+
- When volatile details are hard-coded, move them into validated, controlled, versioned configuration, metadata, or an explicit abstraction.
|
|
42
|
+
- When uncertainty is high or a decision is hard to reverse, reduce risk with tracer feedback, a prototype, a smaller reversible step, or a delayed commitment.
|
|
43
|
+
- When prototype code, generated scaffolds, diagrams, specs, formal models, or tool output start becoming production truth, inspect, understand, harden, replace, or reject them deliberately.
|
|
44
|
+
- When prose specifications keep growing without reducing uncertainty, build a working slice, example, or prototype that forces feedback.
|
|
45
|
+
- When hidden assumptions live only in comments, caller folklore, or tribal setup steps, move them into code, contracts, tests, scripts, or checked configuration.
|
|
46
|
+
- When an error or resource crosses a boundary, decide who can recover, what context survives, and who owns cleanup.
|
|
47
|
+
- When shared state, async behavior, locks, ordering, or temporal coupling appears, make ownership, synchronization, cleanup, and ordering requirements explicit.
|
|
48
|
+
- When repeated manual steps, human checks, environment rituals, or release procedures appear, automate and version them.
|
|
49
|
+
- When tests are slow, flaky, environment-dependent, or require excessive unrelated setup, improve the feedback path rather than normalizing skipped checks.
|
|
50
|
+
- When a human finds a bug, add or improve an automatic regression test around the protected contract.
|
|
51
|
+
- When code works for reasons nobody can explain, stop and prove the behavior with data before depending on it.
|
|
52
|
+
- When local decay appears in touched code, fix it if cheap or leave an explicit containment or cleanup path.
|
|
53
|
+
|
|
54
|
+
## Final checklist
|
|
55
|
+
|
|
56
|
+
- One authoritative owner for each system fact?
|
|
57
|
+
- Unrelated concerns independent and volatile choices reversible?
|
|
58
|
+
- Working feedback exists for risky assumptions?
|
|
59
|
+
- Prototype, generated, and tool-derived behavior deliberately accepted?
|
|
60
|
+
- Contracts, failures, diagnostics, resources, and cleanup explicit?
|
|
61
|
+
- State, concurrency, ordering, and coupling visible?
|
|
62
|
+
- Repeatable work automated, versioned, and aligned with shared checks?
|
|
63
|
+
- Tests automatic, relevant, and run before calling the change done?
|
|
64
|
+
- Names, comments, docs, scripts, tests, and commits communicate intent?
|
|
65
|
+
- Touched area better or explicitly contained?
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# OBEY The Pragmatic Programmer by Andrew Hunt and David Thomas
|
|
2
|
+
|
|
3
|
+
## When to use
|
|
4
|
+
|
|
5
|
+
Use when you need a compact always-on engineering bias toward accountability, adaptability, and fast feedback.
|
|
6
|
+
|
|
7
|
+
## Primary bias to correct
|
|
8
|
+
|
|
9
|
+
Local code changes still have system-level consequences. Own the result beyond the edit.
|
|
10
|
+
|
|
11
|
+
## Decision rules
|
|
12
|
+
|
|
13
|
+
- Be pragmatic, not dogmatic: choose what improves real outcomes, not ceremony or shortcuts.
|
|
14
|
+
- Keep one authoritative source for each piece of system knowledge.
|
|
15
|
+
- Preserve orthogonality so unrelated concerns, business rules, views, and volatile details do not change together.
|
|
16
|
+
- Keep important choices reversible until evidence justifies commitment.
|
|
17
|
+
- Learn through thin working slices, prototypes, examples, tests, and fast feedback without fossilizing shortcuts.
|
|
18
|
+
- Automate repeatable work, keep it versioned, and favor inspectable text or scripts where longevity and recovery matter.
|
|
19
|
+
- Make assumptions, contracts, failure boundaries, diagnostics, resource ownership, cleanup, and ordering explicit.
|
|
20
|
+
- Treat shared mutable state, globals, ambient context, and async complexity as visible costs.
|
|
21
|
+
- Debug from reproduced facts and measured behavior, not coincidence or blame.
|
|
22
|
+
- Run relevant automatic tests before calling work done.
|
|
23
|
+
- Dig for real requirements behind stated solutions and current implementation details.
|
|
24
|
+
- Leave touched code, docs, tests, tooling, and process in a condition you can stand behind.
|
|
25
|
+
|
|
26
|
+
## Trigger rules
|
|
27
|
+
|
|
28
|
+
- When knowledge is copied, choose one owner and derive or trace the rest.
|
|
29
|
+
- When changes fan out widely, restore orthogonality.
|
|
30
|
+
- When a decision is uncertain or hard to reverse, seek feedback or make the step smaller.
|
|
31
|
+
- When manual steps repeat, automate and version them.
|
|
32
|
+
- When behavior is unexplained, generated, scaffolded, or tool-derived, inspect and prove it before relying on it.
|
|
33
|
+
- When errors, resources, state, locks, or ordering cross boundaries, make recovery and cleanup ownership explicit.
|
|
34
|
+
- When requirements sound like implementation details, restate the durable need before building.
|
|
35
|
+
|
|
36
|
+
## Final checklist
|
|
37
|
+
|
|
38
|
+
- One owner?
|
|
39
|
+
- Localized change?
|
|
40
|
+
- Reversible choice?
|
|
41
|
+
- Fast feedback?
|
|
42
|
+
- Explicit failures, state, and cleanup?
|
|
43
|
+
- Automated tests and rituals?
|
|
44
|
+
- Result worth standing behind?
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: working-effectively-with-legacy-code
|
|
3
|
+
description: Apply Michael Feathers-inspired legacy-code rules when changing hard-to-test code safely with characterization tests, seams, sprout methods, or wrap methods.
|
|
4
|
+
license: MIT
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Working Effectively with Legacy Code Skill
|
|
8
|
+
|
|
9
|
+
Use this skill when a task involves risky legacy changes, missing tests, characterization tests, seams, dependency breaking, sprout method, wrap method, or incremental risk reduction.
|
|
10
|
+
|
|
11
|
+
Before making design or code decisions, read and apply [working-effectively-with-legacy-code.mini.md](working-effectively-with-legacy-code.mini.md). Use [working-effectively-with-legacy-code.md](working-effectively-with-legacy-code.md) only as a deeper reference when the mini rules are not enough for the current legacy-code tradeoff.
|