agentleFS
albkhachikyanalbkhachikyan/nextjs-frontend-foundation/SKILL.md

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.

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

    Done means every gate passes: Run pnpm lint, pnpm typecheck, pnpm test:coverage, pnpm build:mock, pnpm test:e2e and pnpm lhci.

    line 38
  2. Very specific:

    Deterministic work goes to the scripts: Use scripts/scaffold.sh and scripts/new-slice.sh instead of hand-writing boilerplate.

    line 42
  3. Very specific:

    Never commit or push unless the user asks: Never write real secrets. Only .env.example is committed.

    line 46
  4. Distinctive:

    Collect inputs: If the request does not already give them, ask once with AskUserQuestion:

    line 51
  5. Very specific:

    Verify the baseline before changing anything: Run pnpm lint && pnpm typecheck && pnpm test:coverage && pnpm build:mock.

    line 71
  6. Very specific:

    Add MSW handlers and fixtures in mocks/.

    line 81
  7. Very specific:

    Add features, widgets and views the same way.

    line 83
  8. Distinctive:

    Delete the post slices only after their replacements pass, and remove their E2E specs at the same time.

    line 85
  9. Distinctive:

    Update the Features list and the env table.

    line 90
  10. Distinctive:

    Keep it plain: no emojis, no marketing, no filler.

    line 91
  11. Very specific:

    Run grep -n "FILL\|__APP_" -r README.md src and confirm it finds nothing.

    line 92
  12. Very specific:

    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 …

    line 101
  13. Distinctive:

    When a gate fails because of an upstream change (a new Next, ESLint or Tailwind release):

    line 127

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

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

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)

  1. The conventions are binding. In a generated project, AGENTS.md is 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 add eslint-disable, @ts-ignore, --no-verify or a lower coverage threshold. The two existing documented disables are the only exceptions.
  2. 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 in references/versions.md.
  3. Done means every gate passes. Run pnpm lint, pnpm typecheck, pnpm test:coverage, pnpm build:mock, pnpm test:e2e and pnpm 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.
  4. Deterministic work goes to the scripts. Use scripts/scaffold.sh and scripts/new-slice.sh instead of hand-writing boilerplate. They are tested, and they cost nothing in tokens. If /task-splitter is running, scaffolding counts as T0 (inline shell).
  5. Never commit or push unless the user asks. Never write real secrets. Only .env.example is committed.

Mode new: scaffold a product

  1. 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>)
  2. 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 sets packageManager
    • installs the latest versions, keeping the pins in references/versions.md
    • adds the shadcn components and fixes their cn import
    • sets up Husky and installs Playwright Chromium

    It refuses to write into a directory that is not empty. Add --no-browsers when Playwright is not needed yet.

  3. 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, read references/versions.md first: a new upstream release has usually broken a pin.
  4. Replace the reference domain. The reference implements posts in four slices: entities/post, features/create-post, widgets/post-list, and views/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 from entities/post.
    • Add MSW handlers and fixtures in mocks/. Extend mocks/server.mjs so dev:mock and E2E keep working without a backend.
    • Add features, widgets and views the same way. Wire the routes in src/app (thin files), plus ROUTES, NAV_ITEMS and 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.
  5. 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 src and confirm it finds nothing.
  6. 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

  1. 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 references/ as a guide, before you change anything.
  2. 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.
  3. Create the skeleton with new-slice.sh (it prints next steps for each layer), or extend an existing slice.
  4. Implement with the matching reference:

    WorkReference
    data fetching and mutationsreferences/data-layer.md
    loading, error and empty states; toasts; error boundariesreferences/ui-states-errors.md
    new routes, metadata, static generationreferences/seo-rendering.md
    interactive UIreferences/accessibility.md
    env variables, headers, external originsreferences/security.md
  5. 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
  6. 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):

  1. Fix it in a scaffolded project.
  2. Port the fix into templates/project.
  3. Record the reason in references/versions.md.
  4. Re-run a fresh scaffold.sh and 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, troubleshooting

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.