Back to Skills

scaffold-nextjs-app

pjt222
Updated 6 days ago
18 views
17
2
17
View on GitHub
Metareactapidesign

About

This skill scaffolds a new Next.js application using the App Router with TypeScript and modern defaults. It sets up the project structure, routing, and initial configuration for a React-based frontend with server-side rendering. Use it to quickly start a new web project, full-stack application with API routes, or a TypeScript web project from scratch.

Quick Install

Claude Code

Recommended
Primary
npx skills add pjt222/agent-almanac -a claude-code
Plugin CommandAlternative
/plugin add https://github.com/pjt222/agent-almanac
Git CloneAlternative
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/scaffold-nextjs-app

Copy and paste this command in Claude Code to install this skill

Documentation

架 Next.js 應

建新 Next.js 應含 App Router、TypeScript、產備默。

  • 始新網應→用
  • 建 React 前含 SSR→用
  • 建全棧應含 API 路→用
  • 自無設 TypeScript 網項→用

  • :應名
  • :包管喜(npm、yarn、pnpm)
  • :含 Tailwind CSS(默:是)
  • :含 ESLint(默:是)
  • :src/ 目(默:是)

一:建項

npx create-next-app@latest my-app \
  --typescript \
  --tailwind \
  --eslint \
  --app \
  --src-dir \
  --import-alias "@/*"

答提或用旗以非互動設諸選。

得:項目建、諸依裝。

敗:查 Node.js 本(node --version ≥ 18.17)。確 npx 可。命掛於提→加 --use-npm(或 --use-pnpm/--use-yarn)跳包管提。

二:驗項結構

my-app/
├── src/
│   ├── app/
│   │   ├── layout.tsx
│   │   ├── page.tsx
│   │   ├── globals.css
│   │   └── favicon.ico
│   └── lib/
├── public/
├── next.config.ts
├── tailwind.config.ts
├── tsconfig.json
├── package.json
└── .eslintrc.json

得:諸目檔皆在。

敗:src/ 缺→--src-dir 旗未傳。重行 create-next-app 含旗,或手移檔入 src/app/

三:配 Next.js

next.config.ts

import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  reactStrictMode: true,

  images: {
    remotePatterns: [
      {
        protocol: "https",
        hostname: "example.com",
      },
    ],
  },
};

export default nextConfig;

得:next.config.ts 存無 TypeScript 誤。

敗:檔用 .js 而非 .ts→重命。確 NextConfig 型自 "next" 入。

四:設目規

建常目:

mkdir -p src/app/api
mkdir -p src/components
mkdir -p src/lib
mkdir -p src/types

得:四目皆建於 src/ 下。

敗:src/ 不存→先建或調徑合項結構(非 src 排用 app/ 於根)。

五:建基排

src/app/layout.tsx

import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";

const inter = Inter({ subsets: ["latin"] });

export const metadata: Metadata = {
  title: "My Application",
  description: "Application description",
};

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body className={inter.className}>{children}</body>
    </html>
  );
}

得:排繪 Inter 字、包諸頁。

敗:字載敗→查網。代 Inter 為系字暫變通。

六:加例 API 路

src/app/api/health/route.ts

import { NextResponse } from "next/server";

export async function GET() {
  return NextResponse.json({ status: "ok", timestamp: new Date().toISOString() });
}

得:檔建於 src/app/api/health/route.ts

敗:確 api/health/ 目存。檔須出名 HTTP 法處(GETPOST 等),非默出。

七:行開發服

cd my-app
npm run dev

得:應行於 http://localhost:3000。

敗:查 Node.js 本(≥ 18.17)。依缺→npm install

  • npm run dev 啟無誤
  • 主頁載於 localhost:3000
  • TypeScript 編成
  • Tailwind CSS 類施
  • API 路應於 /api/health
  • ESLint 行無誤(npm run lint

  • Node.js 本:Next.js 需 ≥ 18.17。node --version
  • 口衝:默口 3000 用→npm run dev -- -p 3001
  • 入別混@/*src/*。勿混 node_modules 入
  • Pages vs App:用 App(src/app/)非 Pages(src/pages/

  • setup-tailwind-typescript
  • deploy-to-vercel
  • configure-git-repository

GitHub Repository

pjt222/agent-almanac
Path: i18n/wenyan-ultra/skills/scaffold-nextjs-app
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

Related Skills

content-collections

Meta

This skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.

View skill

polymarket

Meta

This skill enables developers to build applications with the Polymarket prediction markets platform, including API integration for trading and market data. It also provides real-time data streaming via WebSocket to monitor live trades and market activity. Use it for implementing trading strategies or creating tools that process live market updates.

View skill

creating-opencode-plugins

Meta

This skill helps developers create OpenCode plugins that hook into 25+ event types like commands, files, and LSP operations. It provides the plugin structure, event API specifications, and implementation patterns for JavaScript/TypeScript modules. Use it when you need to intercept, monitor, or extend the OpenCode AI assistant's lifecycle with custom event-driven logic.

View skill

sglang

Meta

SGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.

View skill