@kood/claude-code 0.3.6 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/templates/nextjs/CLAUDE.md +228 -0
- package/templates/nextjs/docs/design.md +558 -0
- package/templates/nextjs/docs/guides/conventions.md +343 -0
- package/templates/nextjs/docs/guides/getting-started.md +367 -0
- package/templates/nextjs/docs/guides/routes.md +342 -0
- package/templates/nextjs/docs/library/better-auth/index.md +541 -0
- package/templates/nextjs/docs/library/nextjs/app-router.md +269 -0
- package/templates/nextjs/docs/library/nextjs/caching.md +351 -0
- package/templates/nextjs/docs/library/nextjs/index.md +291 -0
- package/templates/nextjs/docs/library/nextjs/middleware.md +391 -0
- package/templates/nextjs/docs/library/nextjs/route-handlers.md +382 -0
- package/templates/nextjs/docs/library/nextjs/server-actions.md +366 -0
- package/templates/nextjs/docs/library/prisma/cloudflare-d1.md +76 -0
- package/templates/nextjs/docs/library/prisma/config.md +77 -0
- package/templates/nextjs/docs/library/prisma/crud.md +90 -0
- package/templates/nextjs/docs/library/prisma/index.md +73 -0
- package/templates/nextjs/docs/library/prisma/relations.md +69 -0
- package/templates/nextjs/docs/library/prisma/schema.md +98 -0
- package/templates/nextjs/docs/library/prisma/setup.md +49 -0
- package/templates/nextjs/docs/library/prisma/transactions.md +50 -0
- package/templates/nextjs/docs/library/tanstack-query/index.md +66 -0
- package/templates/nextjs/docs/library/tanstack-query/invalidation.md +54 -0
- package/templates/nextjs/docs/library/tanstack-query/optimistic-updates.md +77 -0
- package/templates/nextjs/docs/library/tanstack-query/use-mutation.md +63 -0
- package/templates/nextjs/docs/library/tanstack-query/use-query.md +70 -0
- package/templates/nextjs/docs/library/zod/complex-types.md +61 -0
- package/templates/nextjs/docs/library/zod/index.md +56 -0
- package/templates/nextjs/docs/library/zod/transforms.md +51 -0
- package/templates/nextjs/docs/library/zod/validation.md +70 -0
- package/templates/tanstack-start/CLAUDE.md +7 -3
- package/templates/tanstack-start/docs/guides/hooks.md +28 -0
- package/templates/tanstack-start/docs/guides/routes.md +29 -10
package/dist/index.js
CHANGED
|
@@ -409,7 +409,7 @@ var init = async (options) => {
|
|
|
409
409
|
|
|
410
410
|
// src/index.ts
|
|
411
411
|
var program = new Command();
|
|
412
|
-
program.name("claude-code").description("Claude Code documentation installer for projects").version("0.3.
|
|
412
|
+
program.name("claude-code").description("Claude Code documentation installer for projects").version("0.3.7");
|
|
413
413
|
program.option(
|
|
414
414
|
"-t, --template <names>",
|
|
415
415
|
"template names (comma-separated: tanstack-start,hono)"
|
package/package.json
CHANGED
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# CLAUDE.md - Next.js
|
|
2
|
+
|
|
3
|
+
> React Full-stack Framework
|
|
4
|
+
|
|
5
|
+
<context>
|
|
6
|
+
|
|
7
|
+
**Purpose:** Next.js App Router 기반 웹 애플리케이션 개발 지침
|
|
8
|
+
|
|
9
|
+
**Scope:** Full-stack React 애플리케이션 구현
|
|
10
|
+
|
|
11
|
+
**Key Features:**
|
|
12
|
+
- App Router (file-based routing)
|
|
13
|
+
- Server Actions (타입 안전 API)
|
|
14
|
+
- Server/Client Components
|
|
15
|
+
- Route Handlers (REST API)
|
|
16
|
+
- Middleware
|
|
17
|
+
- Built-in Optimization (이미지, 폰트, 스크립트)
|
|
18
|
+
- Deployment (Vercel, Docker, Node.js)
|
|
19
|
+
|
|
20
|
+
</context>
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
<instructions>
|
|
25
|
+
@../../commands/git.md
|
|
26
|
+
@docs/library/nextjs/index.md
|
|
27
|
+
@docs/library/tanstack-query/index.md
|
|
28
|
+
@docs/library/prisma/index.md
|
|
29
|
+
@docs/library/next-auth/index.md
|
|
30
|
+
@docs/library/zod/index.md
|
|
31
|
+
@docs/design.md
|
|
32
|
+
</instructions>
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
<forbidden>
|
|
37
|
+
|
|
38
|
+
| 분류 | 금지 행동 |
|
|
39
|
+
|------|----------|
|
|
40
|
+
| **Git 커밋** | AI 표시 (`Generated with Claude Code`, `🤖`, `Co-Authored-By:`), 여러 줄 메시지, 이모지 |
|
|
41
|
+
| **Prisma** | `db push/migrate/generate` 자동 실행, `schema.prisma` 무단 수정 |
|
|
42
|
+
| **Server Actions** | 클라이언트 컴포넌트에서 직접 정의, try-catch 없이 사용, Zod 검증 누락 (POST/PUT/PATCH) |
|
|
43
|
+
| **Route Handlers** | `/app/api/` 외부에 생성, Server Actions로 대체 가능한 경우 생성 |
|
|
44
|
+
| **클라이언트** | Server Action 직접 호출 (TanStack Query 사용), `"use client"` 누락 |
|
|
45
|
+
| **코드 검색** | Bash의 grep/rg/find 명령어 (ast-grep 또는 전용 도구 사용) |
|
|
46
|
+
|
|
47
|
+
</forbidden>
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
<required>
|
|
52
|
+
|
|
53
|
+
| 작업 | 필수 행동 |
|
|
54
|
+
|------|----------|
|
|
55
|
+
| **작업 시작 전** | 관련 docs 읽기 (UI → design, API → nextjs, DB → prisma, 인증 → next-auth) |
|
|
56
|
+
| **코드 검색** | ast-grep 사용 (함수/컴포넌트/패턴 검색) |
|
|
57
|
+
| **복잡한 작업** | Sequential Thinking MCP (5+ 단계 작업) |
|
|
58
|
+
| **대규모 수정** | gemini-review (3+ 파일 변경, 아키텍처 결정) |
|
|
59
|
+
| **Server Actions** | `"use server"` 선언, Zod 검증 (POST/PUT/PATCH), try-catch + revalidatePath/redirect |
|
|
60
|
+
| **클라이언트 API** | TanStack Query (`useQuery`/`useMutation`)로 Server Action 호출 |
|
|
61
|
+
| **Custom Hook 순서** | State → Global Hooks (useParams, useRouter, useSearchParams) → React Query → Handlers → Memo → Effect |
|
|
62
|
+
| **코드 작성** | UTF-8 인코딩, 코드 묶음별 한글 주석, const 함수 선언 |
|
|
63
|
+
| **Prisma** | Multi-File 구조 (`prisma/schema/`), 모든 요소 한글 주석 필수 |
|
|
64
|
+
|
|
65
|
+
</required>
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
<tech_stack>
|
|
70
|
+
|
|
71
|
+
| 기술 | 버전 | 주의 |
|
|
72
|
+
|------|------|------|
|
|
73
|
+
| Next.js | **15.x** | App Router 전용 |
|
|
74
|
+
| React | **19.x** | Server Components |
|
|
75
|
+
| TypeScript | 5.x | strict |
|
|
76
|
+
| Tailwind CSS | 4.x | @theme |
|
|
77
|
+
| Prisma | **7.x** | `prisma-client`, output 필수 |
|
|
78
|
+
| Zod | **4.x** | `z.email()`, `z.url()` |
|
|
79
|
+
| NextAuth.js | **5.x** (Auth.js) | App Router 지원 |
|
|
80
|
+
| TanStack Query | 5.x | - |
|
|
81
|
+
|
|
82
|
+
</tech_stack>
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
<structure>
|
|
87
|
+
```
|
|
88
|
+
src/
|
|
89
|
+
├── app/
|
|
90
|
+
│ ├── layout.tsx # Root layout (required)
|
|
91
|
+
│ ├── page.tsx # Home page
|
|
92
|
+
│ ├── [slug]/
|
|
93
|
+
│ │ ├── page.tsx # Dynamic route
|
|
94
|
+
│ │ └── -components/ # 페이지 전용 Client Components
|
|
95
|
+
│ ├── api/
|
|
96
|
+
│ │ └── [endpoint]/
|
|
97
|
+
│ │ └── route.ts # Route Handler (REST API)
|
|
98
|
+
│ └── _components/ # 공통 Client Components
|
|
99
|
+
├── actions/ # Server Actions (공통)
|
|
100
|
+
├── components/ui/ # UI 컴포넌트 (Server Components)
|
|
101
|
+
├── middleware.ts # Middleware
|
|
102
|
+
├── database/prisma.ts
|
|
103
|
+
└── lib/
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**필수 규칙:**
|
|
107
|
+
- 페이지당 `-components/` 폴더 권장 (페이지 전용 Client Components)
|
|
108
|
+
- Server Components가 기본 → `"use client"` 명시 필요 시만 사용
|
|
109
|
+
- Server Actions는 `actions/` 폴더 또는 파일 상단 (`"use server"`)
|
|
110
|
+
- Route Handlers는 `/app/api/` 경로에만 생성
|
|
111
|
+
</structure>
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
<conventions>
|
|
116
|
+
|
|
117
|
+
파일명: kebab-case, Routes: `page.tsx`, `layout.tsx`, `[slug]/page.tsx`
|
|
118
|
+
TypeScript: const 선언, 명시적 return type, interface(객체)/type(유니온), any→unknown
|
|
119
|
+
Import 순서: 외부 → @/ → 상대경로 → type
|
|
120
|
+
|
|
121
|
+
Prisma Multi-File:
|
|
122
|
+
```
|
|
123
|
+
prisma/schema/
|
|
124
|
+
├── +base.prisma # datasource, generator
|
|
125
|
+
├── +enum.prisma # enum
|
|
126
|
+
└── [model].prisma # 모델별 (한글 주석!)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
</conventions>
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
<quick_patterns>
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
// Server Action (파일 상단)
|
|
137
|
+
"use server"
|
|
138
|
+
|
|
139
|
+
export async function createPost(formData: FormData) {
|
|
140
|
+
const parsed = createPostSchema.parse({
|
|
141
|
+
title: formData.get("title"),
|
|
142
|
+
content: formData.get("content"),
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
const post = await prisma.post.create({ data: parsed })
|
|
146
|
+
revalidatePath("/posts")
|
|
147
|
+
return post
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Server Action (인증)
|
|
151
|
+
"use server"
|
|
152
|
+
|
|
153
|
+
import { auth } from "@/lib/auth"
|
|
154
|
+
|
|
155
|
+
export async function deletePost(id: string) {
|
|
156
|
+
const session = await auth()
|
|
157
|
+
if (!session?.user) throw new Error("Unauthorized")
|
|
158
|
+
|
|
159
|
+
await prisma.post.delete({ where: { id } })
|
|
160
|
+
revalidatePath("/posts")
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Route Handler (GET)
|
|
164
|
+
export async function GET(request: Request) {
|
|
165
|
+
const { searchParams } = new URL(request.url)
|
|
166
|
+
const id = searchParams.get("id")
|
|
167
|
+
|
|
168
|
+
const posts = await prisma.post.findMany({ where: { id } })
|
|
169
|
+
return Response.json(posts)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Client Component with TanStack Query
|
|
173
|
+
"use client"
|
|
174
|
+
|
|
175
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query"
|
|
176
|
+
import { createPost } from "@/actions/posts"
|
|
177
|
+
|
|
178
|
+
export function CreatePostForm() {
|
|
179
|
+
const queryClient = useQueryClient()
|
|
180
|
+
|
|
181
|
+
const mutation = useMutation({
|
|
182
|
+
mutationFn: createPost,
|
|
183
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: ["posts"] }),
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
return <form action={mutation.mutate}>...</form>
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Zod v4
|
|
190
|
+
const schema = z.object({
|
|
191
|
+
email: z.email(),
|
|
192
|
+
name: z.string().min(1).trim(),
|
|
193
|
+
website: z.url().optional(),
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
// Page with Server Component
|
|
197
|
+
export default async function PostsPage() {
|
|
198
|
+
const posts = await prisma.post.findMany()
|
|
199
|
+
return <PostsList posts={posts} />
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
</quick_patterns>
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
<ui_ux>
|
|
208
|
+
|
|
209
|
+
| 원칙 | 값 |
|
|
210
|
+
|------|------|
|
|
211
|
+
| 색상 | 60-30-10 (배경-보조-강조) |
|
|
212
|
+
| 간격 | 8px 그리드 |
|
|
213
|
+
| 접근성 | WCAG AA (대비 4.5:1+) |
|
|
214
|
+
| 폰트 | 2-3개 |
|
|
215
|
+
| Safe Area | tailwindcss-safe-area |
|
|
216
|
+
|
|
217
|
+
</ui_ux>
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
<docs_structure>
|
|
222
|
+
```
|
|
223
|
+
docs/
|
|
224
|
+
├── guides/ # 시작하기, 규칙, 패턴
|
|
225
|
+
├── library/ # nextjs, prisma, next-auth, tanstack-query, zod
|
|
226
|
+
└── design.md # UI/UX 가이드
|
|
227
|
+
```
|
|
228
|
+
</docs_structure>
|