frontend-foundation
Skill2 starsChanged 9 days agoMITView on GitHub
Scaffolds and extends production frontends on the user's standard stack: Next.js (latest stable, App Router), TypeScript strict, pnpm, Tailwind CSS + shadcn/ui, React Query + axios services, zod, Feature-Sliced Design with kebab-case files, Airbnb-based ESLint + Prettier, I/T/E type prefixes and UPPER_CASE constants, SEO metadata and static generation, next/image only, WCAG 2.2 AA with keyboard shortcuts, Vitest + MSW + Playwright with a 90% coverage gate, Husky hooks, GitHub CI and Lighthouse budgets, and a binding AGENTS.md. TRIGGER when: starting a new frontend or web product ("new frontend", "scaffold a Next app", "set up the client side"), adding a page, feature, entity or widget to a project that has this skill's AGENTS.md, or the user invokes /frontend-foundation. Modes: `new <name>` scaffolds a project; `feature <description>` adds code under the project conventions.
- Reads credentials
In this repositoryOne other file it gives its agents.
- llms.txtllms.txt
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 5 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 38
Done means every gate passes: Run pnpm lint, pnpm typecheck, pnpm test:coverage, pnpm build:mock, pnpm test:e2e and pnpm lhci.
- Very specific: line 42
Deterministic work goes to the scripts: Use scripts/scaffold.sh and scripts/new-slice.sh instead of hand-writing boilerplate.
- Very specific: line 46
Never commit or push unless the user asks: Never write real secrets. Only .env.example is committed.
- Distinctive: line 51
Collect inputs: If the request does not already give them, ask once with AskUserQuestion:
- Very specific: line 71
Verify the baseline before changing anything: Run pnpm lint && pnpm typecheck && pnpm test:coverage && pnpm build:mock.
- Very specific: line 81
Add MSW handlers and fixtures in mocks/.
- Very specific: line 83
Add features, widgets and views the same way.
- Distinctive: line 85
Delete the post slices only after their replacements pass, and remove their E2E specs at the same time.
- Distinctive: line 90
Update the Features list and the env table.
- Distinctive: line 91
Keep it plain: no emojis, no marketing, no filler.
- Very specific: line 92
Run grep -n "FILL\|__APP_" -r README.md src and confirm it finds nothing.
- Very specific: line 101
Read the project's
AGENTS.md: If the project has none, it was not built with this skill: ask whether to adopt the conventions, using … - Distinctive: line 127
When a gate fails because of an upstream change (a new Next, ESLint or Tailwind release):
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
frontend-foundation
You build frontends that pass strict, automated quality gates. The templates in this skill are a complete, verified reference app. Copy them, then adapt them. Do not write the infrastructure from scratch.
Paths below are relative to this skill's directory, SKILL_DIR: the folder that holds this
file. The real files sit behind the symlink in ~/.claude/skills/frontend-foundation.
Ground rules (both modes)
- The conventions are binding. In a generated project,
AGENTS.mdis the source of truth. Read it before you write code, and follow it exactly. Every rule names its enforcing check. If a check fails, fix the code. NEVER addeslint-disable,@ts-ignore,--no-verifyor a lower coverage threshold. The two existing documented disables are the only exceptions. - Read the installed Next.js docs before you touch routing, caching, metadata, images or
config. Use
node_modules/next/dist/docs/. Next changes faster than your training data. Known breaking points are listed inreferences/versions.md. - Done means every gate passes. Run
pnpm lint,pnpm typecheck,pnpm test:coverage,pnpm build:mock,pnpm test:e2eandpnpm lhci. Report real numbers (coverage %, Lighthouse scores, test counts). If a gate fails and you cannot fix it, say which gate failed and show its output. - Deterministic work goes to the scripts. Use
scripts/scaffold.shandscripts/new-slice.shinstead of hand-writing boilerplate. They are tested, and they cost nothing in tokens. If/task-splitteris running, scaffolding counts as T0 (inline shell). - Never commit or push unless the user asks. Never write real secrets. Only
.env.exampleis committed.
Mode new: scaffold a product
- Collect inputs. If the request does not already give them, ask once with
AskUserQuestion:
- product title and a kebab-case package name
- a one-line description
- the main entities (nouns) and the main user actions (verbs)
- the API base URL, or "mock for now"
- the target directory (default
~/Desktop/<name>)
Scaffold.
bash SKILL_DIR/scripts/scaffold.sh <target> --name <kebab> --title "<Title>" --description "<line>"The script:
- checks Node (22.12 or newer) and pnpm
- copies
templates/project, fills the placeholders and setspackageManager - installs the latest versions, keeping the pins in
references/versions.md - adds the shadcn components and fixes their
cnimport - sets up Husky and installs Playwright Chromium
It refuses to write into a directory that is not empty. Add
--no-browserswhen Playwright is not needed yet.- Verify the baseline before changing anything. Run
pnpm lint && pnpm typecheck && pnpm test:coverage && pnpm build:mock. The reference app must be green before you add anything. If it fails on a fresh scaffold, readreferences/versions.mdfirst: a new upstream release has usually broken a pin. - Replace the reference domain. The reference implements
postsin four slices:entities/post,features/create-post,widgets/post-list, andviews/posts+views/post-detail. For each real entity:- Run
bash SKILL_DIR/scripts/new-slice.sh entities <name> --endpoint /<path>, then fill in the types, schema, service, queries, hooks and card. Copy patterns fromentities/post. - Add MSW handlers and fixtures in
mocks/. Extendmocks/server.mjssodev:mockand E2E keep working without a backend. - Add features, widgets and views the same way. Wire the routes in
src/app(thin files), plusROUTES,NAV_ITEMSand the sitemap. - Delete the post slices only after their replacements pass, and remove their E2E specs at the same time. Keep the patterns: static generation, prefetch with hydration, the four UI states and Server Action revalidation.
- Run
- Fill in the README.
- Replace every
<!-- FILL ... -->block with real product content. - Update the Features list and the env table.
- Keep it plain: no emojis, no marketing, no filler.
- Run
grep -n "FILL\|__APP_" -r README.md srcand confirm it finds nothing.
- Replace every
- Run every gate (ground rule 3) and fix what fails. Then summarise for the user:
- what was built
- the gate results
- how to run the app
- what still needs a real backend
Mode feature: add to an existing project
- Read the project's
AGENTS.md. If the project has none, it was not built with this skill: ask whether to adopt the conventions, usingreferences/as a guide, before you change anything. - Place the work in FSD. Decide which layer and slice the work belongs in, using
references/architecture-fsd.md. When two slices of the same layer need each other, move the shared part down a layer. NEVER cross-import. - Create the skeleton with
new-slice.sh(it prints next steps for each layer), or extend an existing slice. Implement with the matching reference:
Work Reference data fetching and mutations references/data-layer.mdloading, error and empty states; toasts; error boundaries references/ui-states-errors.mdnew routes, metadata, static generation references/seo-rendering.mdinteractive UI references/accessibility.mdenv variables, headers, external origins references/security.md- Test as you go (
references/testing.md):- unit or component tests next to each new file, with an axe check on UI
- MSW handlers for new endpoints
- a Playwright spec for every new user flow
- new pages added to the a11y spec
- Run every gate (ground rule 3).
Updating the skill itself
When a gate fails because of an upstream change (a new Next, ESLint or Tailwind release):
- Fix it in a scaffolded project.
- Port the fix into
templates/project. - Record the reason in
references/versions.md. - Re-run a fresh
scaffold.shand every gate.
The skill repo is https://github.com/albkhachikyan/nextjs-frontend-foundation (local clone: ~/Desktop/claude-skills/nextjs-frontend-foundation).
Files
scripts/scaffold.sh new project from templates/project (deterministic)
scripts/new-slice.sh FSD slice skeleton that already passes lint, types and tests
templates/project/ the verified reference app (AGENTS.md, configs, src, tests, CI)
references/versions.md version pins, why they exist, and known upstream pitfalls
references/architecture-fsd.md layers, slices, segments, public API, file naming
references/data-layer.md axios client, services, React Query, SSR prefetch, mutations
references/ui-states-errors.md skeletons, pending buttons, error boundaries, toasts, 404
references/seo-rendering.md metadata, static generation and ISR, sitemap, JSON-LD, semantics
references/accessibility.md WCAG 2.2 AA checklist, shortcuts, focus, testing
references/testing.md unit, component, E2E and coverage patterns
references/security.md env split, CSP and headers, supply chain
references/ci-hooks.md hooks, CI jobs, Lighthouse budgets, troubleshootingDoes 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.

