agentleFS
martinbouvet2000-techmartinbouvet2000-tech/claude-code-stage-4/skills/web-stage-4/SKILL.md

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

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
  1. Very specific:

    Read-only. Each practice scores 1 (in place) / 0.5 (partial) / 0 (missing), with the reason.

    line 15
  2. Distinctive:

    Overwriting an existing file: not generated by the scaffold: show the diff first.

    line 42
  3. Very specific:

    Check mode + browser check.

    line 124

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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>" (--json available). Read-only. Each practice scores 1 (in place) / 0.5 (partial) / 0 (missing), with the reason. Monorepo (root without package.json, or workspaces): one score per app (app/, web/, apps/*…).
  • Detailed bootstrap commands: references/bootstrap.md (§1 to §16, Vite variant, verified pitfalls).
ModeTriggerDeliverable
bootstrapnew projectcommitted Stage 4 repo, $A . = 14/14
upgrade <path>existing projectaudit /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)

  1. Installing a system or global dependency (anything beyond a local npm i and the Playwright browser).
  2. Destructive migration: drop, rename, migrate reset, db push on a database that holds data.
  3. Push to a remote, production deploy, change of a GitHub/Vercel setting.
  4. Overwriting an existing file not generated by the scaffold: show the diff first.
  5. 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.

  1. 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.
  2. Scaffold (§1) — Output: Next 16 + Next's AGENTS.md.
  3. Git (§2) — .gitattributes BEFORE the first commit.
  4. Supply chain (§3) — .npmrc cooldown, Knip, Dependabot.
  5. Dependencies (§4).
  6. 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).
  7. Local gates (§6) — lefthook pre-commit + pre-push.
  8. Typed env (§7) — src/env.ts + .env.example + next.config.ts.
  9. Tokens + shadcn (§8) — pick a named visual direction first (your design skill, e.g. frontend-design).
  10. Security (§9) — src/proxy.ts (nonce CSP) + layout.tsx (await connection()).
  11. Observability (§10) — Sentry (inactive without DSN) + Analytics.
  12. Tests (§11) — Vitest + Playwright + axe + Lighthouse, 1 real unit test.
  13. CI (§12) — .github/workflows/ci.yml.
  14. Agent docs (§13) — filled AGENTS.md, CLAUDE.md, ADR 0001, spec + anti-AI-look templates.
  15. Project Claude Code hooks (§14) — .claude/settings.json + 3 hooks.
  16. DB (§15, if applicable) — migrations + RLS in the same file.
  17. Verify + commit (§16) — check mode, $A ., commit (never --no-verify).
  18. [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>

  1. Audit — $A "<path>". Output: scored table, score /14 and level per app, plan. Flag first: shared parent repository, uncommitted files, tracked .env files, duplicate copies.
  2. 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.
  3. 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.
  4. 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, no JSON.parse rewrite.
    • Scripts: never rename a script called by CI (e.g. type-check); fix it in place. The hooks accept typecheck or type-check.
    • typecheck must really check: Vite → tsc -b (the root tsconfig has files: []).
    • .gitattributes: replace with $T/.gitattributes (diff shown), then git add --renormalize ..
    • TS: enable strict first, count the errors (npm run typecheck), fix, commit; then noUncheckedIndexedAccess in a separate batch. Never mass @ts-ignore. Existing syntax errors hide strict errors: handle them first.
    • Knip: npm i -D -E knip, knip.json with "ignore": [".claude/**"]. Existing findings → list them for the user (deletion = checkpoint 4); in CI use knip --no-exit-code until 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 --script

      prisma/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 pull then RLS table by table.
  5. Measure — after each step: check mode + $A. Report the score delta and the real output.
  6. 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.md as a constraint.
  • Evaluation: a separate agent (Agent tool, fresh context) receives only the 375/1280 px screenshots
    • anti-ai-look.md and 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)

  1. docs/specs/<feature>/spec.md (template), approved by the user.
  2. Implementation plan → docs/specs/<feature>/plan.md (e.g. superpowers writing-plans).
  3. Test-driven development.
  4. Separate review: built-in /code-review or a PR review skill.
  5. 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.example knip.json dependabot.yml pnpm-workspace.yaml lefthook.yml ci.yml lighthouserc.json vitest.config.mts playwright.config.ts e2e/smoke.spec.ts env.ts next.config.ts proxy.ts layout.tsx sentry/*.ts claude-settings.json claude-hooks/*.mjs AGENTS.md CLAUDE.md adr-0000-template.md spec-template.md anti-ai-look.md supabase-rls-example.sql.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.