Loading...
Loading...
Use when initializing a new Next.js (SSR) project or when an existing Next.js project needs missing configuration (ESLint, Prettier, TanStack Query, Tailwind CSS, VSCode, Cursor, Antigravity settings, path aliases).
npx skill4agent add parkyoungwoong/skills react-next-scaffold| 확인 대상 | 감지 방법 |
|---|---|
| 빈 디렉토리 여부 | 현재 디렉토리에 파일이 없거나 |
| Next.js 프로젝트 | |
| TypeScript | |
| TanStack Query | |
| Tailwind CSS | |
| ESLint 구성 | |
| Prettier 구성 | |
| VSCode 설정 | |
| 패키지 매니저 | |
은 패키지 매니저 감지 규칙에 따라 결정된 패키지 매니저로 대체한다. (npm, pnpm, yarn, bun){pm}는 해당 패키지 매니저의 실행 명령어로 대체한다. (npx, pnpm dlx, yarn dlx, bunx){pmx}
참고:로 스킬을 설치하면npx skills add,.agents/등의 파일이 이미 존재할 수 있다.skills-lock.json은 디렉토리에 파일이 있으면 충돌로 판단하고 종료되므로, 스캐폴딩 모드에서는 다음 절차를 따른다:create-next-app
- 현재 디렉토리의 기존 파일/폴더 목록을 기억해 둔다
- 기존 파일/폴더를 모두 삭제한다
명령으로 프로젝트를 생성한다{pmx} create-next-app@latest .- 기억해 둔 파일/폴더 중 프로젝트 생성으로 만들어지지 않은 것들(
,.agents/등)을 다시 생성한다skills-lock.json
{pmx} create-next-app@latest .src/@/*@/*create-next-app{pm} install -D prettier eslint-config-prettier eslint-plugin-prettier prettier-plugin-tailwindcsseslint.config.jseslint.config.mjsimport prettierRecommended from 'eslint-config-prettier'
const eslintConfig = defineConfig([
{
extends: [prettierRecommended]
}
])
export default eslintConfigextendsimport prettierRecommended from 'eslint-config-prettier'
import tanstackQuery from '@tanstack/eslint-plugin-query'
const eslintConfig = defineConfig([
{
extends: [
prettierRecommended,
tanstackQuery.configs.recommended
]
}
])
export default eslintConfig| 패키지 | 설명 |
|---|---|
| Prettier 코어 패키지 |
| ESLint와 Prettier의 충돌 방지 |
| Prettier 규칙을 ESLint 규칙으로 통합 |
| Tailwind CSS 클래스 자동 정렬 |
| TanStack Query 규칙 (TanStack Query 사용 시) |
.prettierrc{
"semi": false,
"singleQuote": true,
"singleAttributePerLine": true,
"bracketSameLine": true,
"endOfLine": "auto",
"trailingComma": "none",
"arrowParens": "avoid",
"plugins": ["prettier-plugin-tailwindcss"]
}.vscode/settings.json{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}@tanstack/react-querypackage.json@tanstack/react-query-next-experimental{pm} install @tanstack/react-query @tanstack/react-query-next-experimental
{pm} install -D @tanstack/eslint-plugin-queryeslint.config.jssrc/providers/query.tsx'use client'
import {
QueryClient,
QueryClientProvider,
isServer,
} from '@tanstack/react-query'
import { ReactQueryStreamedHydration } from '@tanstack/react-query-next-experimental'
function makeQueryClient() {
return new QueryClient({
defaultOptions: {
queries: {
// 클라이언트의 즉시 다시 요청에 대응하도록, 기본 캐싱 시간(min)을 지정
staleTime: 60 * 1000
}
}
})
}
let browserQueryClient: QueryClient | undefined = undefined
function getQueryClient() {
if (isServer) {
return makeQueryClient()
} else {
if (!browserQueryClient) browserQueryClient = makeQueryClient()
return browserQueryClient
}
}
export function QueryProvider({ children }: { children: React.ReactNode }) {
const queryClient = getQueryClient()
return (
<QueryClientProvider client={queryClient}>
<ReactQueryStreamedHydration>
{children}
</ReactQueryStreamedHydration>
</QueryClientProvider>
)
}src/app/layout.tsxQueryProviderchildrenimport { QueryProvider } from '@/providers/query'
export default function RootLayout({
children
}: Readonly<{
children: React.ReactNode
}>) {
return (
<html lang="ko">
<body>
<QueryProvider>{children}</QueryProvider>
</body>
</html>
)
}pnpm-lock.yamlpnpmyarn.lockyarnbun.lockbbun.lockbunpackage-lock.jsonnpmnpm