web-stage-4
Skill0 starsChanged 2 months agoMITView on GitHub
Stage 4 maturity standard for web projects built with Claude Code (Next.js 16 + strict TS + Tailwind v4/shadcn + Supabase/Prisma + Vercel, Vite + React variant): bootstrap a new project that is tooled from day one (Claude Code hooks + pre-commit + blocking CI, typed env, CSP, RLS, supply-chain cooldown, observability, AGENTS.md), upgrade an existing repo (read-only audit scored /14, one score per app in a monorepo, prioritized plan executed step by step) and check (definition of done backed by real command output). Use BEFORE coding a new site/app/SaaS, to audit or level up an existing repo, and before saying 'done'. Triggers: new Next.js project, bootstrap, scaffold, set up a clean project, stage 4, maturity audit, level up this repo, quality gates, production ready?, final check, definition of done.
- Reads credentials
- Installs packages
In this repository3 other files it gives its agents.
- skills/web-stage-4/templates/AGENTS.mdAGENTS.md
- skills/web-stage-4/templates/CLAUDE.mdCLAUDE.md
- skill-routerSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Read-only. Each practice scores 1 (in place) / 0.5 (partial) / 0 (missing), with the reason.
- Distinctive: line 42
Overwriting an existing file: not generated by the scaffold: show the diff first.
- Very specific: line 124
Check mode + browser check.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Web Stage 4
Goal: no web project starts (or stays) below Stage 4. Stage 4 = the agent CANNOT ship broken, insecure or generic code: automatic gates stop it.
Execution conventions
- Commands run in the Bash tool (Git Bash on Windows). Shell state does not persist between calls:
start EVERY call with
T=~/.claude/skills/web-stage-4/templates; cd "<project>". - Audit:
A="node $HOME/.claude/skills/web-stage-4/scripts/audit.mjs"then$A "<path>"(--jsonavailable). Read-only. Each practice scores 1 (in place) / 0.5 (partial) / 0 (missing), with the reason. Monorepo (root withoutpackage.json, or workspaces): one score per app (app/,web/,apps/*…). - Detailed bootstrap commands:
references/bootstrap.md(§1 to §16, Vite variant, verified pitfalls).
| Mode | Trigger | Deliverable |
bootstrap | new project | committed Stage 4 repo, $A . = 14/14 |
upgrade <path> | existing project | audit /14 + approved plan + commit-by-commit climb, score delta |
check | "is it done?" | ✅/❌ report with the real output of every command |
Levels
- S1: generic AI landing page, no plan, often no git.
- S2: design system (shadcn/tokens), a few tests or a CI, a plan every time.
- S3: strict TS, Zod, CI + unit tests, proven libraries, advanced skills (security review).
- S4 (target): the 14 practices below, score >= 12 with
$A. - S5 (vision): planner/generator/evaluator harness, custom evals, ephemeral DB branches, controlled rollouts.
The 14 practices:
1 AGENTS.md + CLAUDE.md · 2 verification loop · 3 project Claude Code hooks · 4 strict TS + linter ·
5 Vitest + Playwright + axe · 6 spec → plan · 7 ADRs · 8 @theme tokens + shadcn ·
9 anti-AI-look + evaluator · 10 blocking CI + Lighthouse · 11 typed env + CSP + Zod + rate limit ·
12 migrations + RLS · 13 cooldown + Dependabot + Knip · 14 Sentry + analytics.
User checkpoints (always stop and ask)
- Installing a system or global dependency (anything beyond a local
npm iand the Playwright browser). - Destructive migration: drop, rename,
migrate reset,db pushon a database that holds data. - Push to a remote, production deploy, change of a GitHub/Vercel setting.
- Overwriting an existing file not generated by the scaffold: show the diff first.
- In upgrade mode: the full plan, before the first change.
Bootstrap mode
Input: the user's need. Output: committed repo, check mode green, $A . = 14/14.
Each step points to references/bootstrap.md §N; run it as is, in order.
- Framing — Output: name, DB (Supabase | Prisma | none), type (authenticated app → nonce CSP; 100% static site → nonce-less CSP). A real feature behind it? → spec first (§13). Target folder exists and is not empty → checkpoint 4.
- Scaffold (§1) — Output: Next 16 + Next's AGENTS.md.
- Git (§2) —
.gitattributesBEFORE the first commit. - Supply chain (§3) —
.npmrccooldown, Knip, Dependabot. - Dependencies (§4).
- Strict TS + scripts (§5) — Output: scripts
typecheck lint test test:changed test:e2e knip check prepare(used by lefthook, CI and the hooks: do not rename them). - Local gates (§6) — lefthook pre-commit + pre-push.
- Typed env (§7) —
src/env.ts+.env.example+next.config.ts. - Tokens + shadcn (§8) — pick a named visual direction first (your design skill, e.g.
frontend-design). - Security (§9) —
src/proxy.ts(nonce CSP) +layout.tsx(await connection()). - Observability (§10) — Sentry (inactive without DSN) + Analytics.
- Tests (§11) — Vitest + Playwright + axe + Lighthouse, 1 real unit test.
- CI (§12) —
.github/workflows/ci.yml. - Agent docs (§13) — filled AGENTS.md, CLAUDE.md, ADR 0001, spec + anti-AI-look templates.
- Project Claude Code hooks (§14) —
.claude/settings.json+ 3 hooks. - DB (§15, if applicable) — migrations + RLS in the same file.
- Verify + commit (§16) — check mode,
$A ., commit (never--no-verify). - [Prod] Go live — checkpoint 3, then your deployment workflow (e.g.
vercel:deploy); a security review before the first production deploy or on a sensitive PR (auth, payment, personal data).
Vite + React variant: references/bootstrap.md § "Vite + React variant".
Upgrade mode <path>
- Audit —
$A "<path>". Output: scored table, score /14 and level per app, plan. Flag first: shared parent repository, uncommitted files, tracked.envfiles, duplicate copies. - Probe the existing gates (read-only) — run the existing scripts as they are
(
npm ci, typecheck, lint, test, build). Output: what is red BEFORE any change. A gate that is already red (broken CI, corrupted file) = tell the user, do not "fix" it silently. - Plan — order given by the script (best ratio first): P0 version control → 3 hooks → 10 CI → 4 TS/lint → 12 migrations/RLS → 13 supply chain → tests, security, docs, observability. Checkpoint 5: show the plan, wait for the go.
- Execute — one step = one
chore(s4): …commit (branch or git worktree if long). Reuse the matching bootstrap commands, with these rules for existing code:- File already present (tsconfig, next.config, AGENTS.md, CI,
.gitattributes): merge, never overwrite without a diff. JSON with comments (Vite tsconfig) → Edit tool, noJSON.parserewrite. - Scripts: never rename a script called by CI (e.g.
type-check); fix it in place. The hooks accepttypecheckortype-check. typecheckmust really check: Vite →tsc -b(the root tsconfig hasfiles: [])..gitattributes: replace with$T/.gitattributes(diff shown), thengit add --renormalize ..- TS: enable
strictfirst, count the errors (npm run typecheck), fix, commit; thennoUncheckedIndexedAccessin a separate batch. Never mass@ts-ignore. Existing syntax errors hide strict errors: handle them first. - Knip:
npm i -D -E knip,knip.jsonwith"ignore": [".claude/**"]. Existing findings → list them for the user (deletion = checkpoint 4); in CI useknip --no-exit-codeuntil the list is empty. - Existing lint/format (ESLint + Prettier): keep it, the PostToolUse hook adapts on its own.
- Prisma without migrations: baseline without reset (checkpoint 2):
mkdir -p prisma/migrations/0_init; `npx prisma migrate diff --from-empty --to-schema-datamodel prisma/schema.prisma --scriptprisma/migrations/0_init/migration.sql
(Prisma 7:--to-schema);npx prisma migrate resolve --applied 0_initon every existing database; remove thedb push` script. - Supabase:
db pullthen RLS table by table.
- File already present (tsconfig, next.config, AGENTS.md, CI,
- Measure — after each step: check mode +
$A. Report the score delta and the real output. - Close — no push without checkpoint 3. Recap: score before/after, commits, rest of the plan.
Check mode (definition of done)
Actually run, in this order, and report each line ✅/❌ with an excerpt of the output:
npm run typecheck · npm run lint · npm run test · npm run knip · npm run build ·
npm run test:e2e · $A .. Never "should pass".
Visible change → Playwright MCP (or a browser tool) at 375 px and 1280 px, empty console, screenshot.
Failure → root-cause debugging, no workaround.
Visuals: anti-AI-look + separate evaluation
- Generation: your design skill (site/landing or component), with
docs/design/anti-ai-look.mdas a constraint. - Evaluation: a separate agent (Agent tool, fresh context) receives only the 375/1280 px screenshots
anti-ai-look.mdand scores the 6 criteria /10.
- Threshold: average >= 8 and no criterion < 6; otherwise fix and re-score (3 rounds max). Show the scores to the user with the result.
Feature chain (Stage 4)
docs/specs/<feature>/spec.md(template), approved by the user.- Implementation plan →
docs/specs/<feature>/plan.md(e.g. superpowerswriting-plans). - Test-driven development.
- Separate review: built-in
/code-reviewor a PR review skill. - Check mode + browser check; ADR for any architecture decision.
Unsure about a Next API: read
node_modules/next/dist/docs/first.
Skill files
scripts/audit.mjs: read-only audit (only commands run:git status,git ls-files). Zero dependencies.references/bootstrap.md: commands §1-§16, Vite variant, verified pitfalls.templates/:.gitattributes.npmrc.env.exampleknip.jsondependabot.ymlpnpm-workspace.yamllefthook.ymlci.ymllighthouserc.jsonvitest.config.mtsplaywright.config.tse2e/smoke.spec.tsenv.tsnext.config.tsproxy.tslayout.tsxsentry/*.tsclaude-settings.jsonclaude-hooks/*.mjsAGENTS.mdCLAUDE.mdadr-0000-template.mdspec-template.mdanti-ai-look.mdsupabase-rls-example.sql.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

