fix: patterns mode is iterative — keep extracting until done
Process: Discovery → Deepening → Edge cases → Cross-reference. Repeat until scanning yields no new patterns. Target: 50-200+ patterns for a language stdlib, 15+ per topic.
This commit is contained in:
@@ -242,13 +242,39 @@ Output: `<language>-patterns` or `<ecosystem>-patterns` repo.
|
|||||||
codebase?" Filter everything through: "If I were writing new code
|
codebase?" Filter everything through: "If I were writing new code
|
||||||
in this language/ecosystem, what rules does this source teach me?"
|
in this language/ecosystem, what rules does this source teach me?"
|
||||||
|
|
||||||
**`patterns/<topic>.md`** — one file per topic area:
|
**This is iterative, not one-shot.** Keep extracting until you've
|
||||||
- Error handling patterns
|
identified ALL patterns the source demonstrates. A first pass finds
|
||||||
|
the obvious ones. Second pass greps for variations and edge cases.
|
||||||
|
Third pass finds the patterns that break. You're done when scanning
|
||||||
|
the source no longer reveals new rules.
|
||||||
|
|
||||||
|
**Process:**
|
||||||
|
1. **Discovery pass** — scan the source by topic area, identify every
|
||||||
|
distinct pattern (aim for 15-30+ per topic in a large codebase)
|
||||||
|
2. **Deepening pass** — for each pattern, grep for 5-10 real usages
|
||||||
|
across the codebase. Note variations. Find the best example.
|
||||||
|
3. **Edge case pass** — find where each pattern DOESN'T apply.
|
||||||
|
Grep for violations — are they bugs, or legitimate exceptions?
|
||||||
|
4. **Cross-reference pass** — which patterns interact? Which ones
|
||||||
|
conflict? Document the decision framework for choosing between
|
||||||
|
competing patterns.
|
||||||
|
|
||||||
|
Repeat until scanning the source yields no new patterns. A language
|
||||||
|
stdlib should produce 50-200+ patterns across all topics.
|
||||||
|
|
||||||
|
**Output structure — one file per topic:**
|
||||||
|
|
||||||
|
`patterns/<topic>.md` — topics include:
|
||||||
|
- Error handling
|
||||||
- Naming conventions
|
- Naming conventions
|
||||||
- Concurrency patterns
|
- Concurrency patterns
|
||||||
- Testing patterns
|
- Testing patterns
|
||||||
- Interface/protocol design
|
- Interface/protocol design
|
||||||
- Module organization
|
- Module organization
|
||||||
|
- Documentation conventions
|
||||||
|
- Performance idioms
|
||||||
|
- Configuration patterns
|
||||||
|
- Extension/plugin patterns
|
||||||
|
|
||||||
Each pattern entry:
|
Each pattern entry:
|
||||||
- Name (short, linkable heading)
|
- Name (short, linkable heading)
|
||||||
@@ -270,6 +296,10 @@ Each pattern entry:
|
|||||||
structure, TODO culture, and project history unless they directly
|
structure, TODO culture, and project history unless they directly
|
||||||
inform HOW to write code. Focus on patterns a user should copy.
|
inform HOW to write code. Focus on patterns a user should copy.
|
||||||
|
|
||||||
|
**Done criteria:** You've scanned every major directory in the source.
|
||||||
|
No new patterns emerge from further grep/read. Each topic file has
|
||||||
|
15+ patterns with real examples. Edge cases are documented.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
End all output files with `<!-- PATTERN_COMPLETE -->` sentinel.
|
End all output files with `<!-- PATTERN_COMPLETE -->` sentinel.
|
||||||
|
|||||||
Reference in New Issue
Block a user