|
| 1 | +# Template Playbook |
| 2 | + |
| 3 | +Short reusable playbook for building a serious starter repo, even when the product domain changes. |
| 4 | + |
| 5 | +Use this when you want to create a new template and need the internal structure, not the app-specific features. |
| 6 | + |
| 7 | +## Goal |
| 8 | + |
| 9 | +Every good template should be: |
| 10 | + |
| 11 | +- easy to understand |
| 12 | +- easy to run |
| 13 | +- easy to verify |
| 14 | +- easy to release |
| 15 | +- easy to maintain |
| 16 | + |
| 17 | +If a template only has code and no repo workflow, it is usually still a prototype. |
| 18 | + |
| 19 | +## Keep These By Default |
| 20 | + |
| 21 | +### Docs |
| 22 | + |
| 23 | +- `README.md` |
| 24 | +- `CONTRIBUTING.md` |
| 25 | +- `SECURITY.md` |
| 26 | +- `AGENTS.md` or equivalent internal guidance |
| 27 | +- short roadmap file like `soon.md` |
| 28 | + |
| 29 | +### Root Commands |
| 30 | + |
| 31 | +- `dev` |
| 32 | +- `check` |
| 33 | +- `check:contract` if generated artifacts exist |
| 34 | +- `check:images` if the repo ships deployable containers |
| 35 | +- `check:workflows` |
| 36 | +- `check:secrets` |
| 37 | + |
| 38 | +### CI |
| 39 | + |
| 40 | +- workflow lint |
| 41 | +- secret scan |
| 42 | +- app verification |
| 43 | +- cross-platform check if relevant |
| 44 | +- packaging or Docker build check if relevant |
| 45 | + |
| 46 | +### Release Layer |
| 47 | + |
| 48 | +- release drafter |
| 49 | +- semver labels |
| 50 | +- label sync |
| 51 | +- publish workflow |
| 52 | +- release smoke test |
| 53 | + |
| 54 | +### Repo Governance |
| 55 | + |
| 56 | +- `CODEOWNERS` |
| 57 | +- PR template |
| 58 | +- issue templates |
| 59 | +- Dependabot |
| 60 | + |
| 61 | +## Recommended File Set |
| 62 | + |
| 63 | +For a strong public starter, this is a good baseline: |
| 64 | + |
| 65 | +```text |
| 66 | +README.md |
| 67 | +CONTRIBUTING.md |
| 68 | +SECURITY.md |
| 69 | +AGENTS.md |
| 70 | +soon.md |
| 71 | +.github/CODEOWNERS |
| 72 | +.github/dependabot.yml |
| 73 | +.github/pull_request_template.md |
| 74 | +.github/ISSUE_TEMPLATE/* |
| 75 | +.github/release-drafter.yml |
| 76 | +.github/labels.json |
| 77 | +.github/workflows/template-ci.yml |
| 78 | +.github/workflows/release-drafter.yml |
| 79 | +.github/workflows/release.yml |
| 80 | +.github/workflows/release-smoke.yml |
| 81 | +.github/workflows/sync-labels.yml |
| 82 | +.github/workflows/codeql.yml |
| 83 | +scripts/dev.mjs |
| 84 | +scripts/check.mjs |
| 85 | +scripts/check-actionlint.mjs |
| 86 | +scripts/check-secrets.mjs |
| 87 | +``` |
| 88 | + |
| 89 | +Add these if relevant: |
| 90 | + |
| 91 | +```text |
| 92 | +scripts/check-contract-drift.mjs |
| 93 | +scripts/check-docker-builds.mjs |
| 94 | +scripts/check-release-smoke.mjs |
| 95 | +docs/assets/* |
| 96 | +docs/openapi.yaml |
| 97 | +``` |
| 98 | + |
| 99 | +## Build Order |
| 100 | + |
| 101 | +When creating a new template, build it in this order: |
| 102 | + |
| 103 | +1. define the product story |
| 104 | +2. create the repo structure |
| 105 | +3. add root `dev` and `check` |
| 106 | +4. add contributor docs |
| 107 | +5. add split CI |
| 108 | +6. add release automation |
| 109 | +7. add governance files |
| 110 | +8. add security scanning |
| 111 | +9. add smoke testing for published artifacts |
| 112 | + |
| 113 | +This order prevents the repo from becoming code-heavy but maintenance-light. |
| 114 | + |
| 115 | +## Minimum Viable Template |
| 116 | + |
| 117 | +If you want the lean version, keep at least: |
| 118 | + |
| 119 | +- README |
| 120 | +- CONTRIBUTING |
| 121 | +- SECURITY |
| 122 | +- root `dev` |
| 123 | +- root `check` |
| 124 | +- split CI |
| 125 | +- secret scanning |
| 126 | +- release workflow |
| 127 | + |
| 128 | +This is the minimum point where a repo starts feeling dependable. |
| 129 | + |
| 130 | +## Full Public Template |
| 131 | + |
| 132 | +If you want the version that scales better for open source or long-term reuse, also add: |
| 133 | + |
| 134 | +- agent guidance |
| 135 | +- workflow lint |
| 136 | +- CodeQL |
| 137 | +- label sync |
| 138 | +- release drafter |
| 139 | +- release smoke tests |
| 140 | +- CODEOWNERS |
| 141 | +- issue templates |
| 142 | +- Dependabot |
| 143 | + |
| 144 | +## Generic Rules Worth Reusing |
| 145 | + |
| 146 | +- one source of truth for contracts |
| 147 | +- generated files should have drift checks |
| 148 | +- local scripts and CI should use the same commands |
| 149 | +- published artifacts should get smoke-tested |
| 150 | +- workflows should be linted |
| 151 | +- secrets should be scanned |
| 152 | +- release steps should be automated |
| 153 | +- docs should explain maintainer flow, not just user setup |
| 154 | + |
| 155 | +## What To Customize Per New Project |
| 156 | + |
| 157 | +Do not copy these blindly from one template to another: |
| 158 | + |
| 159 | +- product copy |
| 160 | +- screenshots |
| 161 | +- sample data |
| 162 | +- domain-specific API schemas |
| 163 | +- domain-specific tests |
| 164 | +- domain-specific fixtures |
| 165 | +- domain-specific feature names |
| 166 | + |
| 167 | +Keep the infrastructure, change the story. |
| 168 | + |
| 169 | +## Good Default Questions For Any New Template |
| 170 | + |
| 171 | +Before calling a template "done," ask: |
| 172 | + |
| 173 | +1. Can a new person run it quickly? |
| 174 | +2. Can a contributor verify changes with one or two commands? |
| 175 | +3. Can CI explain exactly what broke? |
| 176 | +4. Can maintainers cut a release without manual chaos? |
| 177 | +5. Can the published artifact be smoke-tested? |
| 178 | +6. Is there a security reporting path? |
| 179 | +7. Are repo ownership and contribution expectations visible? |
| 180 | + |
| 181 | +If the answer to several of these is no, the template probably still needs internal work. |
| 182 | + |
| 183 | +## Personal Default Stack |
| 184 | + |
| 185 | +If I were starting another template tomorrow, I would copy this pattern first: |
| 186 | + |
| 187 | +1. root scripts |
| 188 | +2. split CI |
| 189 | +3. release automation |
| 190 | +4. security scanning |
| 191 | +5. governance files |
| 192 | +6. contributor and agent docs |
| 193 | + |
| 194 | +Then I would build the domain-specific product layer on top. |
0 commit comments