@@ -85,23 +85,88 @@ A complete pattern implementation consists of these components:
8585
8686For cases where you only need pattern documentation (no solutions, generators, or ontology updates), use this minimal workflow:
8787
88- 1 . ** Phase 1** : Create ` meta/patterns/{pattern}/ ` source files and generate ` templates.md `
89- 2 . ** Phase 4** : Write ` docs/patterns/{pattern}/intuition.md ` manually
90- 3 . ** Phase 8 (partial)** : Update indexes (` docs/patterns/README.md ` , ` README.md ` , ` README_zh-TW.md ` , ` mkdocs.yml ` ) and create PR
88+ #### Branch Naming Convention
9189
92- ** Recommended commit structure for documentation-only patterns:**
90+ ``` bash
91+ feat/pattern-{pattern_name}
92+ # Examples:
93+ # feat/pattern-greedy-core
94+ # feat/pattern-dp-1d-linear
95+ # feat/pattern-math-number-theory
96+ ```
97+
98+ #### Workflow Steps
99+
100+ 1 . ** Create branch** : ` git checkout -b feat/pattern-{pattern_name} `
101+
102+ 2 . ** Phase 1 - Scaffold** : Create ` meta/patterns/{pattern}/ ` source files
103+ - ` _config.toml ` (file ordering)
104+ - ` _header.md ` (must include ` > **API Kernel**: \ ` KernelID\` `)
105+ - Problem files: ` {id}-{slug}.md `
106+ - Footer files: ` _decision.md ` , ` _templates.md ` or ` _toolbox.md ` , etc.
107+
108+ 3 . ** Phase 1 - Generate** : Run pattern docs generator
109+ ``` bash
110+ mkdir -p docs/patterns/{pattern}
111+ python tools/patterndocs/generate_pattern_docs.py --pattern {pattern}
112+ ```
113+
114+ 4 . ** Phase 4 - Intuition** : Write ` docs/patterns/{pattern}/intuition.md ` manually
115+
116+ 5 . ** Phase 8 - Index Wiring** : Update all index files:
117+ - ` mkdocs.yml ` - Add navigation entry
118+ - ` docs/patterns/README.md ` - Add to pattern table
119+ - ` README.md ` - Add to pattern documentation section
120+ - ` README_zh-TW.md ` - Add to pattern documentation section (Chinese)
121+
122+ 6 . ** Verify** : Run mkdocs build to check for broken links
123+ ``` bash
124+ mkdocs build --strict
125+ ```
126+
127+ 7 . ** Commit, Push, Merge** : Follow commit structure below
128+
129+ #### Recommended Commit Structure
93130
94131``` bash
95- # Commit 1: Scaffold pattern structure
96- git commit -m " docs({pattern}): scaffold {pattern} pattern"
132+ # Commit 1: Scaffold meta files
133+ git add meta/patterns/{pattern}/
134+ git commit -m " meta({pattern}): Phase 1 - Add pattern source files"
97135
98- # Commit 2: Add generated templates and intuition guide
99- git commit -m " docs({pattern}): add templates and intuition guide"
136+ # Commit 2: Generated templates + manual intuition
137+ git add docs/patterns/{pattern}/
138+ git commit -m " docs({pattern}): Phase 2 - Add templates and intuition guide"
100139
101- # Commit 3: Wire into indexes
102- git commit -m " docs: wire {pattern} pattern into indexes"
140+ # Commit 3: Index wiring
141+ git add mkdocs.yml docs/patterns/README.md README.md README_zh-TW.md
142+ git commit -m " docs({pattern}): Phase 3 - Add navigation and pattern index"
103143```
104144
145+ #### Documentation-Only Checklist
146+
147+ Before merging, verify:
148+
149+ - [ ] ` meta/patterns/{pattern}/_config.toml ` exists with correct file ordering
150+ - [ ] ` meta/patterns/{pattern}/_header.md ` contains ` > **API Kernel**: \ ` ...\` `
151+ - [ ] ` docs/patterns/{pattern}/templates.md ` generated successfully
152+ - [ ] ` docs/patterns/{pattern}/intuition.md ` written with pattern signals and pitfalls
153+ - [ ] ` mkdocs.yml ` has navigation entry under ` 📐 Patterns `
154+ - [ ] ` docs/patterns/README.md ` has pattern in Available Pattern Guides table
155+ - [ ] ` README.md ` has pattern in Pattern Documentation table
156+ - [ ] ` README_zh-TW.md ` has pattern in Pattern Documentation table (Chinese labels)
157+ - [ ] ` mkdocs build --strict ` passes (no broken links)
158+ - [ ] All links use correct relative paths
159+
160+ #### Common Pitfalls
161+
162+ | Pitfall | Solution |
163+ | ---------| ----------|
164+ | Missing output directory | Create ` docs/patterns/{pattern}/ ` before running generator |
165+ | Missing API Kernel in header | Add ` > **API Kernel**: \ ` KernelID\` ` to ` _header.md ` |
166+ | Broken links in mkdocs | Use relative paths: ` {pattern}/intuition.md ` not ` patterns/{pattern}/intuition.md ` |
167+ | Forgot to update Chinese README | Always update both ` README.md ` and ` README_zh-TW.md ` |
168+ | CRLF line endings | Ensure LF endings: ` git config core.autocrlf input ` |
169+
105170---
106171
107172## Prerequisites
0 commit comments