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
|
||||
in this language/ecosystem, what rules does this source teach me?"
|
||||
|
||||
**`patterns/<topic>.md`** — one file per topic area:
|
||||
- Error handling patterns
|
||||
**This is iterative, not one-shot.** Keep extracting until you've
|
||||
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
|
||||
- Concurrency patterns
|
||||
- Testing patterns
|
||||
- Interface/protocol design
|
||||
- Module organization
|
||||
- Documentation conventions
|
||||
- Performance idioms
|
||||
- Configuration patterns
|
||||
- Extension/plugin patterns
|
||||
|
||||
Each pattern entry:
|
||||
- Name (short, linkable heading)
|
||||
@@ -270,6 +296,10 @@ Each pattern entry:
|
||||
structure, TODO culture, and project history unless they directly
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user