nextjs-fullstack-scaffold
Next.js Full-Stack Scaffold
To scaffold a production-grade Next.js 16 full-stack application with modern tooling and best practices, follow these steps systematically.
Prerequisites Check
Before scaffolding, verify the target directory:
- Confirm the current working directory is where files should be generated
- Check if directory is empty or if user wants to override existing files
- Confirm user wants to proceed with scaffold generation
Step 1: Gather Project Information
Prompt the user for the following details using the AskUserQuestion tool:
- Project name (for package.json)
- Project description
- Author name
Use sensible defaults if user prefers to skip.
Step 2: Create Folder Structure
Create the complete folder structure as defined in assets/folder-structure.txt. Generate all necessary directories by writing files to them (directories are created automatically).
Step 3: Generate Configuration Files
Create all configuration files in the project root. Consult references/stack-architecture.md for architectural guidance.
Essential Config Files
Generate these files using Write tool:
- package.json - Use template from
assets/templates/package.template.json, replacing placeholders - tsconfig.json - TypeScript config with strict mode and path aliases
- next.config.ts - Next.js configuration with server actions
- tailwind.config.ts - Tailwind v4 with dark mode and shadcn/ui colors
- postcss.config.mjs - PostCSS with Tailwind plugin
- eslint.config.mjs - ESLint v9 flat config
- prettier.config.js - Prettier with Tailwind plugin
- .gitignore - Standard Next.js ignore patterns
- .env.example - Environment variable template
- vitest.config.ts - Vitest test configuration
- playwright.config.ts - Playwright E2E configuration
Step 4: Generate App Router Files
Create all Next.js app router files following RSC conventions.
Root Files
app/layout.tsx- Root layout with metadata and providersapp/page.tsx- Landing pageapp/globals.css- Tailwind directives and CSS variables
Authentication Routes
app/(auth)/layout.tsx- Auth layout (centered)app/(auth)/login/page.tsx- Login page with form
Protected Routes
app/(protected)/layout.tsx- Protected layout with auth checkapp/(protected)/dashboard/page.tsx- Dashboard with statsapp/(protected)/profile/page.tsx- User profile pageapp/(protected)/data/page.tsx- Data table page
API Routes
app/api/data/route.ts- Example API endpoint
Middleware
middleware.ts- Supabase auth middleware
Step 5: Generate UI Components
Create shadcn/ui components in components/ui/:
button.tsx,card.tsx,input.tsx,label.tsx,form.tsx,table.tsx,dropdown-menu.tsx,avatar.tsx
Create custom components:
components/providers.tsx- App providers with Toastercomponents/layout/header.tsx- Header with navigationcomponents/layout/sidebar.tsx- Sidebar navigationcomponents/layout/nav.tsx- Navigation linkscomponents/auth/login-form.tsx- Login form with RHF + Zodcomponents/auth/auth-button.tsx- Sign in/out buttoncomponents/dashboard/stats-card.tsx- Stats display cardcomponents/dashboard/data-table.tsx- Interactive data table
All components must be TypeScript and accessible.
Step 6: Generate Lib Files
Create utility and action files:
Utilities
lib/utils.ts- cn() function and utilitieslib/prisma.ts- Prisma client singleton
Supabase Clients
lib/supabase/client.ts- Client-side Supabase clientlib/supabase/server.ts- Server-side Supabase clientlib/supabase/middleware.ts- Middleware helper
Server Actions (all must start with 'use server')
lib/actions/auth.ts- signIn(), signOut()lib/actions/user.ts- updateProfile()lib/actions/data.ts- CRUD operations
Validation Schemas (Zod)
lib/validations/auth.ts- Login/signup schemaslib/validations/user.ts- Profile update schemalib/validations/data.ts- Data CRUD schemas
Step 7: Generate Prisma Schema
Create prisma/schema.prisma:
- PostgreSQL datasource with connection pooling
- User model (id, email, name, timestamps)
- Item model (example data model with relations)
- Proper indexes and constraints
Create prisma/seed.ts:
- TypeScript seed script
- Sample users and items
Step 8: Generate Tests
Create test files:
tests/unit/utils.test.ts- Unit test for utilitiestests/integration/auth.test.tsx- Integration test for authtests/e2e/login.spec.ts- E2E test for login flow
Step 9: Generate CI Workflow
Create .github/workflows/ci.yml:
- Lint, type check, test, build jobs
- Run on push and PR
Step 10: Generate README
Create comprehensive README.md with:
- Project overview and tech stack
- Prerequisites and installation steps
- Environment setup instructions
- Database setup (Prisma commands)
- Development and testing commands
- Deployment guide
- Folder structure explanation
Step 11: Final Verification
After generating all files:
- Confirm all files were created successfully
- List the folder structure for user review
- Provide next steps for installation and setup
Implementation Notes
TypeScript
- All files must use TypeScript
- Proper type annotations
- No
anytypes unless necessary
Server Components
- Use Server Components by default
- Only add
"use client"when required for interactivity
Accessibility
- Use shadcn/ui accessible components
- Include ARIA labels
- Ensure keyboard navigation
Security
- Validate inputs with Zod
- Use Server Actions for mutations
- Never expose secrets to client
Consulting References
Throughout scaffolding:
- Consult
references/stack-architecture.mdfor patterns - Consult
references/implementation-checklist.mdto track progress
Completion
When finished:
- Summarize what was created
- List all major files and directories
- Provide next steps
- Offer to answer questions
More from hopeoverture/worldbuilding-app-skills
testing-next-stack
Scaffolds comprehensive testing setup for Next.js applications including Vitest unit tests, React Testing Library component tests, and Playwright E2E flows with accessibility testing via axe-core. This skill should be used when setting up test infrastructure, generating test files, creating test utilities, adding accessibility checks, or configuring testing frameworks for Next.js projects. Trigger terms include setup testing, scaffold tests, vitest, RTL, playwright, e2e tests, component tests, unit tests, accessibility testing, a11y tests, axe-core, test configuration.
38tailwind-shadcn-ui-setup
This skill should be used when setting up, configuring, or initializing Tailwind CSS (v3 or v4) and shadcn/ui for Next.js 16 App Router projects. Configure dark mode, design tokens, base layout with header/sidebar, accessibility defaults, and generate example components. Includes comprehensive setup automation, theme customization, and production-ready patterns. Use when the user requests "setup Tailwind", "configure shadcn/ui", "add dark mode", "initialize design system", or "setup UI framework" for Next.js projects.
17supabase-prisma-database-management
This skill should be used when managing database schema, migrations, and seed data using Prisma ORM with Supabase PostgreSQL. Apply when setting up Prisma with Supabase, creating migrations, seeding data, configuring shadow database for migration preview, adding schema validation to CI, or managing database changes across environments.
17skill-reviewer-and-enhancer
This skill should be used when reviewing, auditing, or improving existing Claude Code skills to ensure they follow Anthropic best practices, have proper structure, use current domain-specific patterns, and include all necessary resources. It analyzes skill quality, identifies gaps, suggests improvements, and can automatically enhance skills with updated best practices. Trigger terms include review skill, audit skill, improve skill, enhance skill, update skill, check skill quality, skill best practices, fix skill, optimize skill, validate skill structure.
16security-hardening-checklist
This skill should be used when the user requests to audit, check, or improve application security by analyzing security headers, cookie configuration, RLS policies, input sanitization, rate limiting, and other security measures. It generates a comprehensive security audit report with actionable recommendations. Trigger terms include security audit, security check, harden security, security review, vulnerability check, security headers, secure cookies, input validation, rate limiting, security best practices.
14docs-and-changelogs
Generates comprehensive changelogs from Conventional Commits, maintains CHANGELOG.md files, and scaffolds project documentation like PRD.md or ADR.md. This skill should be used when creating changelogs, generating release notes, maintaining version history, documenting architectural decisions, or scaffolding project requirements documentation. Use for changelog generation, release notes, version documentation, ADR, PRD, or technical documentation.
14