How to apply the scaffold to an existing project. Work through the phases in order — each builds on the previous one.
Priority rule: If you can only do one thing, write the CLAUDE.md.
Run through this checklist to identify what your project is missing:
| Item | Have it? | Priority |
|---|---|---|
| CLAUDE.md with project overview, commands, architecture | ☐ | Critical |
.claude/settings.json with allow/deny permissions |
☐ | Critical |
.env.example with all env vars documented |
☐ | Critical |
Single gates script that runs all checks |
☐ | Critical |
| Linter configured and enforced | ☐ | High |
| Strict TypeScript / mypy | ☐ | High |
| Pre-commit hooks | ☐ | High |
CI pipeline running gates |
☐ | High |
| Runtime version pinned (.node-version / .python-version) | ☐ | High |
| NOW.md for session state | ☐ | Medium |
| Slash commands for common tasks | ☐ | Medium |
| Guardrail tests (architecture boundaries) | ☐ | Medium |
| CHANGELOG.md with enforcement | ☐ | Medium |
| Debug playbook in CLAUDE.md | ☐ | Medium |
| Starting points in CLAUDE.md | ☐ | Medium |
| Compatibility matrix in CLAUDE.md (libraries) | ☐ | Medium |
| Workspace boundary tests (monorepos) | ☐ | Medium |
| llms.txt | ☐ | Low |
| AGENTS.md (Codex/GPT operating instructions) | ☐ | Low |
| Cursor rules | ☐ | Low |
Copy scaffold/CLAUDE.md.template and fill in:
- Project Overview — one paragraph explaining what the project does
- Quick Reference table — package manager, runtime, framework, all commands
- Development Commands — every command copy-paste ready
- Architecture section — directory map with annotations
- Starting Points — the 3-5 files where most tasks begin
This alone eliminates most wasted exploration turns.
{
"permissions": {
"allow": [
"Bash(npm run gates*)",
"Bash(npm run lint*)",
"Bash(npm run typecheck*)",
"Bash(npm run test*)",
"Bash(npm run build*)",
"Bash(npm run dev*)",
"Bash(git status*)",
"Bash(git diff*)",
"Bash(git log*)",
"Bash(git add *)",
"Bash(git commit *)"
],
"deny": [
"Bash(rm -rf *)",
"Bash(git push --force*)",
"Bash(git reset --hard*)"
]
}
}Adjust the allow list for your project's actual commands.
List every environment variable your project uses. Include:
- Variable name
- Whether it's required or optional
- A realistic example value
- What it does
Add to package.json:
{
"scripts": {
"gates": "npm run lint && npm run typecheck && npm run test && npm run build"
}
}Adjust to match your project's actual check commands. The key: one command runs everything.
npm install husky --save-dev
npx husky initCreate .husky/pre-commit:
#!/bin/sh
npm run lint
npm run typecheckCopy scaffold/.github/workflows/ci.yml and adjust:
- Change the Node version source if you don't use
.node-version - Update the install command for your package manager
- Ensure the final step runs
npm run gates
If you don't have a linter:
- TypeScript: Copy
scaffold/config/biome.json - Python: Add ruff config to
pyproject.toml
If you have a linter but it's not strict, tighten the rules incrementally. Enable one strict rule per PR to avoid a massive diff.
If strict: true isn't set, enable it incrementally:
- Start with
"strict": truein tsconfig - Fix all errors (or use
// @ts-expect-errorwith explanations temporarily) - Enable
"noUncheckedIndexedAccess": truenext - Enable
"noUnusedLocals": trueand"noUnusedParameters": true
Create .node-version (or .python-version) with your target runtime version. Ensure CI reads from this file.
Copy scaffold/.cursor/rules/typescript.mdc and customize:
- Update the glob patterns for your file structure
- Add project-specific rules for common mistakes
Create this for all projects so Codex/GPT agents have explicit working rules. Copy scaffold/AGENTS.md.template and fill in:
- Scope + project snapshot
- First commands and working rules
- PR/commit requirements
- API section only if the project exposes an external interface
Copy scaffold/llms.txt.template and fill in:
- Project name and description
- Key features
- Documentation links
Copy scaffold/scripts/security-check.sh. Add to pre-commit if your project handles user input.
Copy scaffold/scripts/doc-sync-check.sh. Configure the sync rules for your project's source-of-truth files.
Copy scaffold/.claude/hooks/session-start.sh. This auto-installs dependencies at the start of every Claude session.
Copy the appropriate test files:
test_architecture.ts— for TypeScript projectstest_architecture.py— for Python projectstest_workspace_boundaries.ts— for monorepos only
Customize the forbidden imports and allowed wrapper modules.
Copy scaffold/NOW.md.template if the project will last more than 2 weeks. Update it at the end of every work session.
| Mistake | Fix |
|---|---|
| Trying to do everything at once | Start with Phase 1 only. Add phases as you go. |
| Enabling strict TypeScript in one PR | Enable incrementally — one rule per PR. |
| Copying templates without customizing | Every [bracket] must be replaced. Templates with brackets are worse than no template. |
Skipping the gates script |
This is the single most impactful change. Don't skip it. |
| Different commands in CI vs local | CI must run npm run gates — the same command as local hooks. |
| Writing CLAUDE.md but not updating it | Stale CLAUDE.md is worse than none. Update it with every structural change. |