nextjs-frontend
Skill0 starsChanged 7 months agoMITView on GitHub
Use this skill whenever building, editing, or reviewing frontend code in a Next.js project. Triggers on: creating or refactoring React components, working with Figma MCP to extract designs or tokens, writing PostCSS/BEM styles, setting up component file structure, writing accessible HTML, working with TypeScript interfaces and props, or any task involving Next.js App Router patterns. Use this skill even for partial tasks like "add a new component", "extract tokens from this Figma frame", or "fix the accessibility on this form" — not just for full page builds.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- blackbenjamin/etpstheir own version, first seen Oct 15, 2026
- suleyman/fullstack-agent-skillstheir own version, first seen Oct 6, 2026
- yiweiwan/skillstheir own version, first seen May 12, 2026
- thesaifalitai/claude-setuptheir own version, first seen Feb 27, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- thesaifalitai/claude-setup★ 9same name
- suleyman/fullstack-agent-skills★ 2same name
- blackbenjamin/etps★ 1same name
- yiweiwan/skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- accessibility-checkerSkill
- code-documentationSkill
- code-reviewSkill
- form-validatorSkill
- ux-motionSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
24 rules. 0 are common, 9 are distinctive, and 15 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
9
Distinctive
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 68
Use type for unions/aliases, interface for object shapes.
- Very specific: line 101
Server Components by default: Add 'use client' only when genuinely needed:
- Very specific: line 105
Keep 'use client' as deep in the tree as possible — don't bubble it up unnecessarily.
- Distinctive: line 106
If a component needs both server-fetched data and client interactivity, split it: fetch in a Server Component, pass data as props to a …
- Distinctive: line 113
When unsure of level, default one level lower (simpler).
- Very specific: line 119
Use semantic HTML by default.
- Very specific: line 122
Use <button> for actions, <a> for navigation.
- Distinctive: line 123
All interactive elements must be keyboard-focusable and have a visible focus state.
- Very specific: line 124
Images: always provide alt. Decorative images use alt="" and role="presentation".
- Distinctive: line 125
ARIA: use only when native semantics aren't sufficient.
- Very specific: line 131
Don't suppress outlines with outline: none unless replacing with a custom focus style.
- Very specific: line 137
Read references/css-conventions.md for the full guide.
- Distinctive: line 142
Never hardcode hex values, spacing units, or font sizes in component CSS.
- Very specific: line 143
PostCSS: use nesting (&) to keep related rules together.
- Very specific: line 144
No global class leakage: all component styles are scoped to their CSS Module.
- Very specific: line 145
Only global.css and tokens.css write to :root or bare element selectors.
- Distinctive: line 151
When Figma Variables are available (via MCP or synced export):
- Very specific: line 161
When a Figma token uses modes (e.g.
- Distinctive: line 163
When working on a prototype without a token system: use clearly named temporary custom properties rather than hardcoded values.
- Distinctive: line 170
When Figma MCP is connected, use it actively.
- Very specific: line 174
Use get_variable_defs on the relevant Figma node to retrieve variables.
- Very specific: line 180
Use get_design_context on the target frame or component node.
- Very specific: line 181
Use get_screenshot to visually verify the design before coding.
- Distinctive: line 184
Write semantic HTML first, then layer CSS via BEM + CSS Modules.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Next.js Frontend Skill
This skill defines coding conventions, file structure, and workflow patterns for a Next.js frontend codebase. Follow these rules consistently — even for small edits — to keep the codebase coherent.
Stack Overview
| Concern | Choice |
| Framework | Next.js (App Router) |
| Language | TypeScript — strict mode always |
| Styling | PostCSS + BEM + CSS Modules |
| Design source | Figma via MCP (when available) |
| Tokens | Figma Variables → CSS custom properties |
| Components | Bespoke, atomic/compound pattern |
| Animation | See ux-motion skill (separate) |
File & Folder Structure
src/
├── app/ # Next.js App Router pages
│ └── [route]/
│ └── page.tsx # Default export
├── components/
│ ├── atoms/ # Smallest reusable units (Button, Icon, Label)
│ ├── molecules/ # Composed atoms (FormField, Card, NavItem)
│ └── organisms/ # Full sections (Header, ProductGrid, Footer)
├── styles/
│ ├── tokens.css # CSS custom properties from Figma Variables
│ ├── global.css # Resets, base type, body
│ └── utils.css # Shared PostCSS utilities / mixins
└── types/
└── *.types.ts # Shared prop interfaces used by 2+ componentsComponents live alongside their own CSS Module:
components/atoms/Button/
├── Button.tsx
├── Button.module.css
└── index.ts # Re-exports named exportTypeScript Rules
- Always use strict mode. No
any. No non-null assertions unless unavoidable with a comment. - Props for a single component: define a
interfacedirectly above the component in the same file. - Props shared by 2+ components: define in
src/types/as a named export. - Use
typefor unions/aliases,interfacefor object shapes.
// Single-component props — same file, above the component
interface ButtonProps {
label: string;
onClick: () => void;
variant?: "primary" | "secondary" | "ghost";
disabled?: boolean;
}
export function Button({ label, onClick, variant = "primary", disabled = false }: ButtonProps) {
// ...
}Component Conventions
Export pattern
- Named exports for all components.
- Default exports for Next.js pages only (
app/**/page.tsx). - Each component folder has an
index.tsthat re-exports the named export.
// components/atoms/Button/index.ts
export { Button } from "./Button";Server vs Client Components
- Server Components by default. Add
'use client'only when genuinely needed:- Browser APIs (
window,document,localStorage) - Event handlers that require state or refs
- React hooks (
useState,useEffect, etc.)
- Browser APIs (
- Keep
'use client'as deep in the tree as possible — don't bubble it up unnecessarily. - If a component needs both server-fetched data and client interactivity, split it: fetch in a Server Component, pass data as props to a small Client Component leaf.
Atomic pattern
- Atoms: single-purpose, no children of their own (Button, Icon, Tag, Avatar)
- Molecules: compose 2–4 atoms with local logic (SearchField = Input + Button + Icon)
- Organisms: full sections composing molecules (SiteHeader, ProductCard, FilterPanel)
- When unsure of level, default one level lower (simpler). Promote only when reuse demands it.
HTML & Accessibility
- Use semantic HTML by default. Reach for
<article>,<section>,<nav>,<main>,<aside>,<header>,<footer>,<figure>,<time>,<address>appropriately. - No
<div>or<span>where a semantic element fits. - Use
<button>for actions,<a>for navigation. Never use a<div>as a button. - All interactive elements must be keyboard-focusable and have a visible focus state.
- Images: always provide
alt. Decorative images usealt=""androle="presentation". - ARIA: use only when native semantics aren't sufficient. Prefer native HTML first.
Common correct uses:
aria-label,aria-labelledby,aria-describedby,aria-expanded,aria-controls,aria-livefor dynamic regions,role="status"for polite updates. - Heading hierarchy must be logical (
h1→h2→h3), never skip levels. - Forms: every
<input>has an associated<label>(viahtmlFor/id, not just proximity). - Colour contrast: meet WCAG AA minimum (4.5:1 for body text, 3:1 for large/UI text).
- Don't suppress outlines with
outline: noneunless replacing with a custom focus style.
CSS / PostCSS / BEM
Read references/css-conventions.md for the full guide. Summary:
- BEM naming:
.block__element--modifier - CSS Modules: one
.module.cssper component. Import asstylesobject. - Tokens: reference design tokens as CSS custom properties (
var(--color-primary)). Never hardcode hex values, spacing units, or font sizes in component CSS. - PostCSS: use nesting (
&) to keep related rules together. Avoid deep nesting (max 3 levels). - No global class leakage: all component styles are scoped to their CSS Module.
Only
global.cssandtokens.csswrite to:rootor bare element selectors.
Design Token Conventions
When Figma Variables are available (via MCP or synced export):
- Map Figma variable collections to CSS custom property groups:
Color/*→--color-*Spacing/*→--space-*Typography/Size/*→--text-size-*Typography/Weight/*→--font-weight-*Radius/*→--radius-*Shadow/*→--shadow-*
- Define all tokens in
src/styles/tokens.csson:root. - When a Figma token uses modes (e.g. light/dark), map to
[data-theme="dark"]selector.
When working on a prototype without a token system: use clearly named temporary custom properties rather than hardcoded values. This makes it easy to wire up tokens later.
Figma MCP Workflow
When Figma MCP is connected, use it actively. Don't guess at design values.
Extracting tokens
- Use
get_variable_defson the relevant Figma node to retrieve variables. - Map to CSS custom properties using the token naming conventions above.
- Write to
src/styles/tokens.css.
Generating components from a design
- Use
get_design_contexton the target frame or component node. - Use
get_screenshotto visually verify the design before coding. - Extract spacing, colour, and type values — map to tokens, not raw values.
- Structure the component following the atomic level appropriate to its complexity.
- Write semantic HTML first, then layer CSS via BEM + CSS Modules.
When Figma MCP is unavailable
Note it, then proceed with clearly named placeholder custom properties and a comment flagging where real tokens should be wired in once available.
Reference Files
references/css-conventions.md— Full PostCSS/BEM/CSS Modules guide with examplesreferences/a11y-patterns.md— Accessible component patterns (modals, menus, forms, etc.)
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.

