Next.js App Scaffold (TS + Tailwind + shadcn/ui + Playwright)
Purpose
You are a specialized assistant that bootstraps or restructures Next.js projects
for the user using their preferred frontend stack:
- Next.js (App Router, TypeScript)
- Tailwind CSS
- shadcn/ui component library
- ESLint + Prettier
- Vitest (or Jest) + React Testing Library for unit/component tests
- Playwright for end-to-end tests
Use this skill to:
- Create new Next.js projects from scratch using the user's standard layout
- Add missing tooling (Tailwind, shadcn/ui, Vitest, Playwright) to an existing repo
- Refactor folder structure to match the conventions defined below
Do not use this skill for:
- Pure backend services with no Next.js frontend
- Non-React frontends
- Projects where the user explicitly requests a different framework or stack
If in doubt whether this applies, briefly check the repository structure
(or ask the user one concise question) and only use this skill
when a Next.js app is clearly desired.
Defaults & Assumptions
Unless the user or a CLAUDE.md file explicitly says otherwise, assume:
Framework: Next.js 14+ with the App Router (app/ directory)
Language: TypeScript everywhere (.ts, .tsx)
Package manager order of preference:
- If CLAUDE.md or package.json clearly indicates
pnpm, use pnpm
- Otherwise, if
yarn.lock exists, use yarn
- Otherwise, default to
npm
Styling: Tailwind CSS with PostCSS
UI kit: shadcn/ui with:
components/ and lib/ aligned with their official conventions
- A default theme set up (e.g.
light/dark mode, radius scale)
Testing:
- Unit/component: Vitest + React Testing Library
- E2E: Playwright Test
Linting/formatting:
- ESLint configured for Next.js + TypeScript + Testing Library
- Prettier formatting (optionally with Tailwind plugin)
If a CLAUDE.md file exists in the repo, treat its preferences as authoritative
and adapt these defaults to match it.
When to Apply This Skill
Trigger this skill when the user asks for any of the following (or equivalent):
- “Create a new Next.js project for X”
- “Bootstrap a frontend app using my usual stack”
- “Set up a Next.js app with shadcn, Tailwind, and Playwright”
- “Restructure this repo into a clean Next.js + shadcn layout”
- “Add Playwright and Vitest to this Next.js project using my standards”
Do not apply this skill when:
- The project is not using Next.js
- The user explicitly wants a minimal setup without Tailwind or shadcn
- The user wants a non-React framework (e.g. Svelte, Vue)
High-Level Workflow
When this skill is active, follow this workflow:
Understand the context
- Check whether the user wants:
- A brand new project, or
- To upgrade / align an existing Next.js repo.
- Skim the repo (if present) to see:
package.json
app/ or pages/
- Any testing or lint config already in place.
Confirm or infer package manager
- Prefer
pnpm if pnpm-lock.yaml exists or CLAUDE.md says so.
- Otherwise, prefer
yarn if yarn.lock exists.
- Otherwise, default to
npm.
- Use that package manager consistently in all commands you run or suggest.
Create or align the Next.js app
- For a new project:
- Run a command like:
pnpm create next-app@latest <project-name> --typescript --eslint --app --src-dir --import-alias "@/*"
- Adjust syntax for
npm/yarn as needed.
- For an existing project:
- Confirm that
next, react, and react-dom dependencies exist.
- If an old
pages/ router is used and the user wants App Router, propose a
migration plan before performing large structural changes.
Set up Tailwind CSS
- Install Tailwind + PostCSS + Autoprefixer.
- Initialize Tailwind config and content paths for
app/ and src/:
app/**/*.{ts,tsx}
src/**/*.{ts,tsx}
- Create or update:
tailwind.config.ts
postcss.config.mjs (or equivalent)
- Global stylesheet (e.g.
app/globals.css) with Tailwind base/components/utilities.
Set up shadcn/ui
- Install shadcn/ui per official instructions for the given Next.js version.
- Configure:
components/ and lib/ directories for shadcn (e.g. components/ui, lib/utils).
- A default theme (typography, radius, colors) appropriate for a typical SaaS UI.
- Add at least one sample component:
- e.g. a
<Button /> and a simple layout so the user can verify styling works.
- Ensure imports are correct and tree-shakable.
Configure ESLint & Prettier
- Ensure ESLint is configured with:
- Next.js + React + TypeScript rules.
- Testing Library / Jest or Vitest plugin if tests are present.
- Add or update Prettier configuration:
- Basic rules (line length, semi, quotes).
- Tailwind plugin if Tailwind is used.
- Wire lint/format scripts to
package.json:
"lint" script for ESLint.
"format" script for Prettier.
Set up testing
- Unit/component (Vitest or Jest):
- If the repo already uses Jest and the user seems invested in it, keep Jest.
- Otherwise, prefer Vitest (fast, TS-friendly, Vite-style API).
- Configure:
- A
tests/ or __tests__/ folder structure.
- React Testing Library helpers.
- Example tests for a simple component and a page.
- E2E (Playwright):
- Install Playwright Test and initialize a default config file.
- Create an example E2E spec that:
- Starts the dev server (or assumes it is running).
- Checks that the homepage loads and a basic UI interaction works.
- Add NPM scripts:
"test:e2e" to run Playwright tests.
"test:unit" to run Vitest/Jest tests.
"test" to run all or a sensible subset.
Establish project structure
For new projects, aim for something like:
app/
layout.tsx
page.tsx
(marketing)/
layout.tsx
page.tsx
(app)/
dashboard/
page.tsx
src/
components/
ui/ # shadcn generated components
layout/
forms/
lib/
utils.ts
types/
hooks/
tests/
unit/
e2e/ # or use playwright default folder
Prefer App Router patterns
- Shared layout components in app/layout.tsx.
- Route groups for marketing vs app areas when appropriate.
Keep server and client components clearly annotated:
- Use "use client" only where necessary.
Wire scripts and documentation
Prefer App Router patterns
- Update package.json scripts to include:
- "dev", "build", "start", "lint", "test", "test:unit", "test:e2e".
Create or update README.md with:
- How to install dependencies and run the dev server.
- How to run unit tests and E2E tests.
- Any special notes about shadcn, Tailwind, or Playwright usage.
Final check and explanation
Summarize what was created or changed:
- Update package.json scripts to include:
- Folder structure.
- Key configs.
- How to start the dev server and run tests.
- Highlight any decisions made (e.g. “I chose Vitest over Jest because…”).
- If something is ambiguous (package manager, exact Next.js version), suggest a small follow-up question to the user and clearly mark it.
Style & Quality Guidelines
- Always favor clarity and convention over cleverness.
- Follow idiomatic Next.js App Router patterns:
- Use server components by default.
- Promote server actions and data fetching on the server whenever possible.
- How to start the dev server and run tests.
- Keep configuration files small and well-commented so the user can understand them.
- Avoid introducing experimental flags or unstable Next.js features unless the user asks.
1---2name: nextjs-app-scaffold3description: Use this skill whenever the user wants to create or restructure a Next.js app with my standard stack (TypeScript, App Router, Tailwind CSS, shadcn/ui, Vitest, and Playwright E2E tests). Prefer this skill when the task involves starting a new frontend project or aligning an existing one to my conventions.4---5
6# Next.js App Scaffold (TS + Tailwind + shadcn/ui + Playwright)
7
8## Purpose
9
10You are a specialized assistant that **bootstraps or restructures Next.js projects**
11for the user using their **preferred frontend stack**:
12
13- Next.js (App Router, TypeScript)
14- Tailwind CSS
15- shadcn/ui component library
16- ESLint + Prettier
17- Vitest (or Jest) + React Testing Library for unit/component tests
18- Playwright for end-to-end tests
19
20Use this skill to:
21
22- Create new Next.js projects from scratch using the user's standard layout
23- Add missing tooling (Tailwind, shadcn/ui, Vitest, Playwright) to an existing repo
24- Refactor folder structure to match the conventions defined below
25
26Do **not** use this skill for:
27
28- Pure backend services with no Next.js frontend
29- Non-React frontends
30- Projects where the user explicitly requests a different framework or stack
31
32If in doubt whether this applies, briefly check the repository structure
33(or ask the user one concise question) and only use this skill
34when a Next.js app is clearly desired.
35
36---
37
38## Defaults & Assumptions
39
40Unless the user or a CLAUDE.md file explicitly says otherwise, assume:
41
42- **Framework**: Next.js 14+ with the **App Router** (`app/` directory)
43- **Language**: TypeScript everywhere (`.ts`, `.tsx`)
44- **Package manager order of preference**:
45
46 1. If CLAUDE.md or package.json clearly indicates `pnpm`, use `pnpm`
47 2. Otherwise, if `yarn.lock` exists, use `yarn`
48 3. Otherwise, default to `npm`
49
50- **Styling**: Tailwind CSS with PostCSS
51- **UI kit**: shadcn/ui with:
52 - `components/` and `lib/` aligned with their official conventions
53 - A default theme set up (e.g. `light/dark` mode, radius scale)
54- **Testing**:
55 - **Unit/component**: Vitest + React Testing Library
56 - **E2E**: Playwright Test
57- **Linting/formatting**:
58 - ESLint configured for Next.js + TypeScript + Testing Library
59 - Prettier formatting (optionally with Tailwind plugin)
60
61If a CLAUDE.md file exists in the repo, treat its preferences as **authoritative**
62and adapt these defaults to match it.
63
64---
65
66## When to Apply This Skill
67
68Trigger this skill when the user asks for any of the following (or equivalent):
69
70- “Create a new Next.js project for X”
71- “Bootstrap a frontend app using my usual stack”
72- “Set up a Next.js app with shadcn, Tailwind, and Playwright”
73- “Restructure this repo into a clean Next.js + shadcn layout”
74- “Add Playwright and Vitest to this Next.js project using my standards”
75
76Do **not** apply this skill when:
77
78- The project is not using Next.js
79- The user explicitly wants a minimal setup without Tailwind or shadcn
80- The user wants a non-React framework (e.g. Svelte, Vue)
81
82---
83
84## High-Level Workflow
85
86When this skill is active, follow this workflow:
87
881. **Understand the context**
89
90 - Check whether the user wants:
91 - A brand new project, or
92 - To upgrade / align an existing Next.js repo.
93 - Skim the repo (if present) to see:
94 - `package.json`
95 - `app/` or `pages/`
96 - Any testing or lint config already in place.
97
982. **Confirm or infer package manager**
99
100 - Prefer `pnpm` if `pnpm-lock.yaml` exists or CLAUDE.md says so.
101 - Otherwise, prefer `yarn` if `yarn.lock` exists.
102 - Otherwise, default to `npm`.
103 - Use that package manager consistently in all commands you run or suggest.
104
1053. **Create or align the Next.js app**
106
107 - For a new project:
108 - Run a command like:
109 - `pnpm create next-app@latest <project-name> --typescript --eslint --app --src-dir --import-alias "@/*"`
110 - Adjust syntax for `npm`/`yarn` as needed.
111 - For an existing project:
112 - Confirm that `next`, `react`, and `react-dom` dependencies exist.
113 - If an old `pages/` router is used and the user wants App Router, propose a
114 **migration plan** before performing large structural changes.
115
1164. **Set up Tailwind CSS**
117
118 - Install Tailwind + PostCSS + Autoprefixer.
119 - Initialize Tailwind config and content paths for `app/` and `src/`:
120 - `app/**/*.{ts,tsx}`
121 - `src/**/*.{ts,tsx}`
122 - Create or update:
123 - `tailwind.config.ts`
124 - `postcss.config.mjs` (or equivalent)
125 - Global stylesheet (e.g. `app/globals.css`) with Tailwind base/components/utilities.
126
1275. **Set up shadcn/ui**
128
129 - Install shadcn/ui per official instructions for the given Next.js version.
130 - Configure:
131 - `components/` and `lib/` directories for shadcn (e.g. `components/ui`, `lib/utils`).
132 - A default theme (typography, radius, colors) appropriate for a typical SaaS UI.
133 - Add at least one sample component:
134 - e.g. a `<Button />` and a simple layout so the user can verify styling works.
135 - Ensure imports are correct and tree-shakable.
136
1376. **Configure ESLint & Prettier**
138
139 - Ensure ESLint is configured with:
140 - Next.js + React + TypeScript rules.
141 - Testing Library / Jest or Vitest plugin if tests are present.
142 - Add or update Prettier configuration:
143 - Basic rules (line length, semi, quotes).
144 - Tailwind plugin if Tailwind is used.
145 - Wire lint/format scripts to `package.json`:
146 - `"lint"` script for ESLint.
147 - `"format"` script for Prettier.
148
1497. **Set up testing**
150
151 - **Unit/component (Vitest or Jest):**
152 - If the repo already uses Jest and the user seems invested in it, keep Jest.
153 - Otherwise, prefer Vitest (fast, TS-friendly, Vite-style API).
154 - Configure:
155 - A `tests/` or `__tests__/` folder structure.
156 - React Testing Library helpers.
157 - Example tests for a simple component and a page.
158 - **E2E (Playwright):**
159 - Install Playwright Test and initialize a default config file.
160 - Create an example E2E spec that:
161 - Starts the dev server (or assumes it is running).
162 - Checks that the homepage loads and a basic UI interaction works.
163 - Add NPM scripts:
164 - `"test:e2e"` to run Playwright tests.
165 - `"test:unit"` to run Vitest/Jest tests.
166 - `"test"` to run all or a sensible subset.
167
1688. **Establish project structure**
169
170 For new projects, aim for something like:
171
172 ```text
173 app/
174 layout.tsx
175 page.tsx
176 (marketing)/
177 layout.tsx
178 page.tsx
179 (app)/
180 dashboard/
181 page.tsx
182 src/
183 components/
184 ui/ # shadcn generated components
185 layout/
186 forms/
187 lib/
188 utils.ts
189 types/
190 hooks/
191 tests/
192 unit/
193 e2e/ # or use playwright default folder
194 ```
195 **Prefer App Router patterns**
196 - Shared layout components in app/layout.tsx.
197 - Route groups for marketing vs app areas when appropriate.
198
199 **Keep server and client components clearly annotated:**
200 - Use "use client" only where necessary.
201
2029. **Wire scripts and documentation**
203
204 **Prefer App Router patterns**
205 - Update package.json scripts to include:
206 - "dev", "build", "start", "lint", "test", "test:unit", "test:e2e".
207
208 **Create or update README.md with:**
209 - How to install dependencies and run the dev server.
210 - How to run unit tests and E2E tests.
211 - Any special notes about shadcn, Tailwind, or Playwright usage.
212
21310. **Final check and explanation**
214
215 **Summarize what was created or changed:**
216 - Update package.json scripts to include:
217 - Folder structure.
218 - Key configs.
219 - How to start the dev server and run tests.
220 - Highlight any decisions made (e.g. “I chose Vitest over Jest because…”).
221 - If something is ambiguous (package manager, exact Next.js version), suggest a small follow-up question to the user and clearly mark it.
222
223
224**Style & Quality Guidelines**
225 - Always favor clarity and convention over cleverness.
226 - Follow idiomatic Next.js App Router patterns:
227 - Use server components by default.
228 - Promote server actions and data fetching on the server whenever possible.
229 - How to start the dev server and run tests.
230 - Keep configuration files small and well-commented so the user can understand them.
231 - Avoid introducing experimental flags or unstable Next.js features unless the user asks.
232