@kood/claude-code 0.5.3 → 0.5.5

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.
Files changed (125) hide show
  1. package/dist/index.js +552 -340
  2. package/package.json +1 -1
  3. package/templates/.claude/agents/document-writer.md +73 -306
  4. package/templates/.claude/instructions/agent-patterns/index.md +7 -7
  5. package/templates/.claude/instructions/document-templates/ralph-templates.md +71 -0
  6. package/templates/.claude/instructions/index.md +14 -14
  7. package/templates/.claude/instructions/multi-agent/agent-roster.md +14 -14
  8. package/templates/.claude/instructions/multi-agent/index.md +4 -4
  9. package/templates/.claude/skills/docs-creator/AGENTS.md +54 -176
  10. package/templates/.claude/skills/docs-creator/SKILL.md +98 -464
  11. package/templates/.claude/skills/docs-refactor/AGENTS.md +61 -190
  12. package/templates/.claude/skills/docs-refactor/SKILL.md +67 -443
  13. package/templates/.claude/skills/execute/SKILL.md +540 -13
  14. package/templates/.claude/skills/plan/SKILL.md +84 -18
  15. package/templates/.claude/skills/ralph/SKILL.md +17 -14
  16. package/templates/.claude/skills/refactor/AGENTS.md +269 -0
  17. package/templates/.claude/skills/refactor/SKILL.md +424 -66
  18. package/templates/.claude/skills/stitch-design/README.md +34 -0
  19. package/templates/.claude/skills/stitch-design/SKILL.md +213 -0
  20. package/templates/.claude/skills/stitch-design/examples/DESIGN.md +154 -0
  21. package/templates/.claude/skills/stitch-loop/README.md +54 -0
  22. package/templates/.claude/skills/stitch-loop/SKILL.md +316 -0
  23. package/templates/.claude/skills/stitch-loop/examples/SITE.md +73 -0
  24. package/templates/.claude/skills/stitch-loop/examples/next-prompt.md +25 -0
  25. package/templates/.claude/skills/stitch-loop/resources/baton-schema.md +61 -0
  26. package/templates/.claude/skills/stitch-loop/resources/site-template.md +104 -0
  27. package/templates/.claude/skills/stitch-react/README.md +36 -0
  28. package/templates/.claude/skills/stitch-react/SKILL.md +323 -0
  29. package/templates/.claude/skills/stitch-react/examples/gold-standard-card.tsx +88 -0
  30. package/templates/.claude/skills/stitch-react/package-lock.json +231 -0
  31. package/templates/.claude/skills/stitch-react/package.json +16 -0
  32. package/templates/.claude/skills/stitch-react/resources/architecture-checklist.md +15 -0
  33. package/templates/.claude/skills/stitch-react/resources/component-template.tsx +37 -0
  34. package/templates/.claude/skills/stitch-react/resources/stitch-api-reference.md +14 -0
  35. package/templates/.claude/skills/stitch-react/resources/style-guide.json +24 -0
  36. package/templates/.claude/skills/stitch-react/scripts/fetch-stitch.sh +30 -0
  37. package/templates/.claude/skills/stitch-react/scripts/validate.js +77 -0
  38. package/templates/hono/CLAUDE.md +28 -28
  39. package/templates/hono/docs/architecture.md +24 -24
  40. package/templates/hono/docs/deployment/cloudflare.md +18 -18
  41. package/templates/hono/docs/deployment/docker.md +13 -13
  42. package/templates/hono/docs/deployment/index.md +19 -19
  43. package/templates/hono/docs/deployment/railway.md +32 -32
  44. package/templates/hono/docs/deployment/vercel.md +29 -29
  45. package/templates/hono/docs/guides/conventions.md +57 -57
  46. package/templates/hono/docs/guides/env-setup.md +47 -47
  47. package/templates/hono/docs/guides/getting-started.md +27 -27
  48. package/templates/hono/docs/library/hono/error-handling.md +11 -11
  49. package/templates/hono/docs/library/hono/index.md +4 -4
  50. package/templates/hono/docs/library/hono/middleware.md +18 -18
  51. package/templates/hono/docs/library/hono/rpc.md +7 -7
  52. package/templates/hono/docs/library/hono/validation.md +6 -6
  53. package/templates/hono/docs/library/prisma/cloudflare-d1.md +29 -29
  54. package/templates/hono/docs/library/prisma/config.md +16 -16
  55. package/templates/hono/docs/library/prisma/index.md +32 -32
  56. package/templates/hono/docs/library/t3-env/index.md +22 -22
  57. package/templates/hono/docs/library/zod/index.md +31 -31
  58. package/templates/nextjs/CLAUDE.md +54 -54
  59. package/templates/nextjs/docs/architecture.md +146 -146
  60. package/templates/nextjs/docs/design.md +183 -183
  61. package/templates/nextjs/docs/guides/conventions.md +86 -86
  62. package/templates/nextjs/docs/guides/getting-started.md +28 -28
  63. package/templates/nextjs/docs/guides/routes.md +32 -32
  64. package/templates/nextjs/docs/library/better-auth/index.md +70 -70
  65. package/templates/nextjs/docs/library/nextjs/app-router.md +43 -43
  66. package/templates/nextjs/docs/library/nextjs/caching.md +73 -73
  67. package/templates/nextjs/docs/library/nextjs/index.md +51 -51
  68. package/templates/nextjs/docs/library/nextjs/middleware.md +41 -41
  69. package/templates/nextjs/docs/library/nextjs/route-handlers.md +31 -31
  70. package/templates/nextjs/docs/library/nextjs/server-actions.md +34 -34
  71. package/templates/nextjs/docs/library/prisma/cloudflare-d1.md +20 -20
  72. package/templates/nextjs/docs/library/prisma/config.md +18 -18
  73. package/templates/nextjs/docs/library/prisma/crud.md +17 -17
  74. package/templates/nextjs/docs/library/prisma/index.md +18 -18
  75. package/templates/nextjs/docs/library/prisma/relations.md +16 -16
  76. package/templates/nextjs/docs/library/prisma/schema.md +23 -23
  77. package/templates/nextjs/docs/library/prisma/setup.md +6 -6
  78. package/templates/nextjs/docs/library/prisma/transactions.md +10 -10
  79. package/templates/nextjs/docs/library/tanstack-query/index.md +6 -6
  80. package/templates/nextjs/docs/library/tanstack-query/invalidation.md +20 -20
  81. package/templates/nextjs/docs/library/tanstack-query/optimistic-updates.md +4 -4
  82. package/templates/nextjs/docs/library/tanstack-query/use-mutation.md +15 -15
  83. package/templates/nextjs/docs/library/tanstack-query/use-query.md +22 -22
  84. package/templates/nextjs/docs/library/zod/complex-types.md +11 -11
  85. package/templates/nextjs/docs/library/zod/index.md +8 -8
  86. package/templates/nextjs/docs/library/zod/transforms.md +11 -11
  87. package/templates/nextjs/docs/library/zod/validation.md +9 -9
  88. package/templates/npx/CLAUDE.md +38 -38
  89. package/templates/npx/docs/library/commander/index.md +12 -12
  90. package/templates/npx/docs/library/fs-extra/index.md +9 -9
  91. package/templates/npx/docs/library/prompts/index.md +3 -3
  92. package/templates/npx/docs/references/patterns.md +12 -12
  93. package/templates/tanstack-start/CLAUDE.md +54 -54
  94. package/templates/tanstack-start/docs/architecture.md +128 -128
  95. package/templates/tanstack-start/docs/design.md +169 -169
  96. package/templates/tanstack-start/docs/guides/conventions.md +43 -43
  97. package/templates/tanstack-start/docs/guides/env-setup.md +35 -35
  98. package/templates/tanstack-start/docs/guides/getting-started.md +19 -19
  99. package/templates/tanstack-start/docs/guides/hooks.md +45 -45
  100. package/templates/tanstack-start/docs/guides/routes.md +54 -54
  101. package/templates/tanstack-start/docs/guides/services.md +45 -45
  102. package/templates/tanstack-start/docs/library/prisma/cloudflare-d1.md +19 -19
  103. package/templates/tanstack-start/docs/library/prisma/config.md +16 -16
  104. package/templates/tanstack-start/docs/library/prisma/crud.md +17 -17
  105. package/templates/tanstack-start/docs/library/prisma/relations.md +16 -16
  106. package/templates/tanstack-start/docs/library/prisma/schema.md +23 -23
  107. package/templates/tanstack-start/docs/library/prisma/setup.md +6 -6
  108. package/templates/tanstack-start/docs/library/prisma/transactions.md +10 -10
  109. package/templates/tanstack-start/docs/library/tanstack-query/invalidation.md +19 -19
  110. package/templates/tanstack-start/docs/library/tanstack-query/optimistic-updates.md +4 -4
  111. package/templates/tanstack-start/docs/library/tanstack-query/use-mutation.md +14 -14
  112. package/templates/tanstack-start/docs/library/tanstack-query/use-query.md +21 -21
  113. package/templates/tanstack-start/docs/library/tanstack-router/error-handling.md +9 -9
  114. package/templates/tanstack-start/docs/library/tanstack-router/hooks.md +11 -11
  115. package/templates/tanstack-start/docs/library/tanstack-router/navigation.md +17 -17
  116. package/templates/tanstack-start/docs/library/tanstack-router/route-context.md +5 -5
  117. package/templates/tanstack-start/docs/library/tanstack-router/search-params.md +10 -10
  118. package/templates/tanstack-start/docs/library/tanstack-start/auth-patterns.md +8 -8
  119. package/templates/tanstack-start/docs/library/tanstack-start/middleware.md +9 -9
  120. package/templates/tanstack-start/docs/library/tanstack-start/routing.md +6 -6
  121. package/templates/tanstack-start/docs/library/tanstack-start/server-functions.md +18 -18
  122. package/templates/tanstack-start/docs/library/tanstack-start/setup.md +4 -4
  123. package/templates/tanstack-start/docs/library/zod/complex-types.md +11 -11
  124. package/templates/tanstack-start/docs/library/zod/transforms.md +11 -11
  125. package/templates/tanstack-start/docs/library/zod/validation.md +9 -9
@@ -1,6 +1,6 @@
1
1
  # Architecture
2
2
 
3
- > TanStack Start Application Architecture
3
+ > TanStack Start 애플리케이션 아키텍처
4
4
 
5
5
  <instructions>
6
6
  @../guides/conventions.md
@@ -13,14 +13,14 @@
13
13
 
14
14
  <forbidden>
15
15
 
16
- | Category | Forbidden |
17
- |----------|-----------|
18
- | **Routes** | Flat file routes (`routes/users.tsx`) |
19
- | **Route Export** | `export const IndexRoute`, `const Route` (without export) |
20
- | **API** | Creating `/api` routes (use Server Functions) |
21
- | **Layers** | Skipping Service Layer, direct DB access from Routes |
22
- | **Validation** | Manual validation inside handler, scattered auth logic |
23
- | **Barrel Export** | Creating `functions/index.ts` (Tree Shaking fails, server libraries pollute Client bundle) |
16
+ | 분류 | 금지 |
17
+ |------|------|
18
+ | **라우트** | Flat 파일 라우트 (`routes/users.tsx`) |
19
+ | **Route Export** | `export const IndexRoute`, `const Route` (export 안함) |
20
+ | **API** | `/api` 라우터 생성 (Server Functions 사용) |
21
+ | **레이어** | Service Layer 건너뛰기, Routes에서 직접 DB 접근 |
22
+ | **검증** | Handler 내부 수동 검증, 인증 로직 분산 |
23
+ | **Barrel Export** | `functions/index.ts` 생성 (Tree Shaking 실패, 서버 라이브러리 Client 오염) |
24
24
 
25
25
  </forbidden>
26
26
 
@@ -28,20 +28,20 @@
28
28
 
29
29
  <required>
30
30
 
31
- | Category | Required |
32
- |----------|----------|
33
- | **Route Structure** | Create folder per page (`routes/users/index.tsx`) |
34
- | **Route Export** | `export const Route = createFileRoute(...)` required |
35
- | **Layer Structure** | Routes → Server Functions → Services → Database |
36
- | **Route Group** | List pages → `(main)/`, create/editoutside |
37
- | **Page Separation** | 100+ lines → `-components`, 200+ lines → `-sections` |
38
- | **beforeLoad** | Auth check, Context passing, redirects |
39
- | **loader** | Data loading (runs in parallel after beforeLoad) |
40
- | **Server Fn** | Use `createServerFn` by default |
41
- | **Validation** | `inputValidator` (POST/PUT/PATCH), Zod schemas |
42
- | **Auth** | `middleware` (authMiddleware) |
43
- | **Error Handling** | `errorComponent` (route), `notFoundComponent` (404) |
44
- | **Type Safety** | TypeScript strict, Prisma types |
31
+ | 분류 | 필수 |
32
+ |------|------|
33
+ | **라우트 구조** | 페이지마다 폴더 생성 (`routes/users/index.tsx`) |
34
+ | **Route Export** | `export const Route = createFileRoute(...)` 필수 |
35
+ | **계층 구조** | Routes → Server Functions → Services → Database |
36
+ | **Route Group** | 목록 → `(main)/`, 생성/편집외부 |
37
+ | **페이지 분리** | 100줄+ → `-components`, 200줄+ → `-sections` |
38
+ | **beforeLoad** | 인증 체크, Context 전달, 리다이렉트 |
39
+ | **loader** | 데이터 로딩 (beforeLoad 완료 병렬 실행) |
40
+ | **Server Fn** | `createServerFn` 기본 사용 |
41
+ | **검증** | `inputValidator` (POST/PUT/PATCH), Zod 스키마 |
42
+ | **인증** | `middleware` (authMiddleware) |
43
+ | **에러 처리** | `errorComponent` (라우트), `notFoundComponent` (404) |
44
+ | **타입 안전** | TypeScript strict, Prisma 타입 |
45
45
 
46
46
  </required>
47
47
 
@@ -64,7 +64,7 @@
64
64
  │ TanStack Start Server │
65
65
  │ ┌────────────────────────────────────────────────────────────┐ │
66
66
  │ │ Server Functions │ │
67
- │ │ routes/-functions/ → Page-specific | functions/ → Global │ │
67
+ │ │ routes/-functions/ → 페이지 전용 | functions/ → 글로벌 │ │
68
68
  │ └────────────────────────────┬───────────────────────────────┘ │
69
69
  │ ┌────────────────────────────▼───────────────────────────────┐ │
70
70
  │ │ Services Layer │ │
@@ -86,32 +86,32 @@
86
86
 
87
87
  <route_export_rule>
88
88
 
89
- ## Route Export Rules
89
+ ## Route Export 규칙
90
90
 
91
- > ⚠️ **`export const Route` Required**
91
+ > ⚠️ **`export const Route` 필수**
92
92
  >
93
- > TanStack Router requires all route files to export **exactly the name `Route`**.
93
+ > TanStack Router 모든 라우트 파일에서 **정확히 `Route`라는 이름**으로 내보내야 합니다.
94
94
  >
95
- > The `tsr generate` and `tsr watch` commands automatically generate and update routes.
95
+ > `tsr generate` `tsr watch` 명령어가 자동으로 경로를 생성하고 업데이트합니다.
96
96
 
97
- | ❌ Forbidden | ✅ Required |
98
- |--------------|-------------|
97
+ | ❌ 금지 | ✅ 필수 |
98
+ |--------|--------|
99
99
  | `const Route = createFileRoute(...)` | `export const Route = createFileRoute(...)` |
100
100
  | `export const IndexRoute = ...` | `export const Route = ...` |
101
101
  | `export default createFileRoute(...)` | `export const Route = createFileRoute(...)` |
102
102
 
103
103
  ```typescript
104
- // ❌ Forbidden: No export
104
+ // ❌ 금지: export 없음
105
105
  const Route = createFileRoute('/users')({
106
106
  component: UsersPage,
107
107
  })
108
108
 
109
- // ❌ Forbidden: Different name
109
+ // ❌ 금지: 다른 이름
110
110
  export const UsersRoute = createFileRoute('/users')({
111
111
  component: UsersPage,
112
112
  })
113
113
 
114
- // ✅ Required: Export with exactly 'Route' name
114
+ // ✅ 필수: 정확히 'Route' 이름으로 export
115
115
  export const Route = createFileRoute('/users')({
116
116
  component: UsersPage,
117
117
  })
@@ -127,59 +127,59 @@ export const Route = createFileRoute('/users')({
127
127
 
128
128
  ### 1. Routes Layer
129
129
 
130
- > ⚠️ **Create Folder Per Page (Required)**
130
+ > ⚠️ **페이지마다 폴더 생성 필수**
131
131
  >
132
- > All pages **must use folder structure**. Flat file approach (`routes/users.tsx`) is forbidden.
132
+ > 모든 페이지는 **반드시 폴더 구조**로 만들어야 합니다. Flat 파일 방식(`routes/users.tsx`) 금지됩니다.
133
133
  >
134
- > **Reason:** To systematically manage page-specific resources like -components/, -functions/, -hooks/.
134
+ > **이유:** -components/, -functions/, -hooks/ 등 페이지 전용 리소스를 체계적으로 관리하기 위함입니다.
135
135
  >
136
- > | ❌ Forbidden | ✅ Required |
137
- > |--------------|-------------|
136
+ > | ❌ 금지 | ✅ 필수 |
137
+ > |--------|--------|
138
138
  > | `routes/users.tsx` | `routes/users/index.tsx` |
139
139
  > | `routes/posts.tsx` | `routes/posts/(main)/index.tsx` |
140
140
 
141
141
  ```
142
142
  routes/<route-name>/
143
- ├── (main)/ # Route group (list page)
144
- │ ├── index.tsx # Page component
145
- │ ├── -components/ # Page-specific components
146
- │ ├── -sections/ # UI section separation (200+ lines)
147
- │ ├── -tabs/ # Tab content separation
148
- │ ├── -hooks/ # Page-specific hooks
149
- │ └── -utils/ # Constants, helpers
150
- ├── new/ # Create page (outside route group)
143
+ ├── (main)/ # route group (목록 페이지)
144
+ │ ├── index.tsx # 페이지 컴포넌트
145
+ │ ├── -components/ # 페이지 전용 컴포넌트
146
+ │ ├── -sections/ # UI 섹션 분리 (200줄+ 페이지)
147
+ │ ├── -tabs/ # 콘텐츠 분리
148
+ │ ├── -hooks/ # 페이지 전용 훅
149
+ │ └── -utils/ # 상수, 헬퍼
150
+ ├── new/ # 생성 페이지 (route group 외부)
151
151
  │ └── index.tsx
152
- ├── route.tsx # Route config (loader, beforeLoad)
153
- └── -functions/ # Page-specific server functions
152
+ ├── route.tsx # route 설정 (loader, beforeLoad)
153
+ └── -functions/ # 페이지 전용 서버 함수
154
154
  ```
155
155
 
156
- | Pattern | Location | Purpose |
157
- |---------|----------|---------|
158
- | **Route Group** | `(main)/` | List pages, excluded from URL |
159
- | **-components/** | 100-200 lines | Separate page-specific components |
160
- | **-sections/** | 200+ lines | Logical section separation |
161
- | **-tabs/** | Tab UI | Tab content separation |
162
- | **route.tsx** | Layout | Shared layout for child routes |
156
+ | 패턴 | 위치 | 용도 |
157
+ |------|------|------|
158
+ | **Route Group** | `(main)/` | 목록 페이지, URL에 미포함 |
159
+ | **-components/** | 100-200 | 페이지 전용 컴포넌트 분리 |
160
+ | **-sections/** | 200줄+ | 논리적 섹션 분리 |
161
+ | **-tabs/** | UI | 콘텐츠 분리 |
162
+ | **route.tsx** | 레이아웃 | 하위 경로 공통 레이아웃 |
163
163
 
164
- #### Layout Routes Pattern
164
+ #### Layout Routes 패턴
165
165
 
166
- > ⚠️ **Use route.tsx for Layouts**
166
+ > ⚠️ **route.tsx 레이아웃 구성**
167
167
  >
168
- > `route.tsx` serves as a shared layout for child routes.
169
- > `index.tsx` must be wrapped with Route Group `()`.
168
+ > `route.tsx`는 하위 경로의 공통 레이아웃 역할을 합니다.
169
+ > `index.tsx`는 Route Group `()`으로 묶어야 합니다.
170
170
  >
171
- > **Required:** `route.tsx` must export a `component`.
171
+ > **필수:** `route.tsx`는 반드시 `component`를 export해야 합니다.
172
172
  >
173
- > | ❌ Forbidden | ✅ Required |
174
- > |--------------|-------------|
173
+ > | ❌ 금지 | ✅ 필수 |
174
+ > |--------|--------|
175
175
  > | `export const Route = createFileRoute(...)({})` | `export const Route = createFileRoute(...)({ component: ... })` |
176
176
 
177
177
  ```
178
178
  routes/
179
179
  ├── (auth)/
180
- │ ├── route.tsx # Layout (<Outlet />)
180
+ │ ├── route.tsx # 레이아웃 (<Outlet />)
181
181
  │ ├── (main)/
182
- │ │ └── index.tsx # /auth (list/main)
182
+ │ │ └── index.tsx # /auth (목록/메인)
183
183
  │ ├── login/
184
184
  │ │ └── index.tsx # /auth/login
185
185
  │ └── register/
@@ -187,13 +187,13 @@ routes/
187
187
  ```
188
188
 
189
189
  ```typescript
190
- // ❌ Forbidden: No component
190
+ // ❌ 금지: component 없음
191
191
  export const Route = createFileRoute('/(auth)')({
192
192
  beforeLoad: async () => ({ user: await getUser() }),
193
193
  })
194
194
 
195
- // ✅ Required: Component must be included
196
- // routes/(auth)/route.tsx - Layout
195
+ // ✅ 필수: component 반드시 포함
196
+ // routes/(auth)/route.tsx - 레이아웃
197
197
  export const Route = createFileRoute('/(auth)')({
198
198
  component: () => (
199
199
  <div className="auth-container">
@@ -202,7 +202,7 @@ export const Route = createFileRoute('/(auth)')({
202
202
  ),
203
203
  })
204
204
 
205
- // routes/(auth)/(main)/index.tsx - Main page
205
+ // routes/(auth)/(main)/index.tsx - 메인 페이지
206
206
  export const Route = createFileRoute('/(auth)/')({
207
207
  component: AuthMainPage,
208
208
  })
@@ -217,38 +217,38 @@ export const Route = createFileRoute('/(auth)/login')({
217
217
 
218
218
  ```
219
219
  services/<domain>/
220
- ├── index.ts # Entry point (re-export)
221
- ├── schemas.ts # Zod schemas
222
- ├── queries.ts # GET requests
220
+ ├── index.ts # 진입점 (re-export)
221
+ ├── schemas.ts # Zod 스키마
222
+ ├── queries.ts # GET 요청
223
223
  └── mutations.ts # POST/PUT/PATCH
224
224
  ```
225
225
 
226
226
  ### 3. Server Functions Layer
227
227
 
228
228
  ```
229
- functions/ # Global (reusable)
230
- ├── <function-name>.ts # One per file
229
+ functions/ # 글로벌 (재사용)
230
+ ├── <function-name>.ts # 파일당 하나
231
231
  └── middlewares/
232
232
  └── <middleware-name>.ts
233
233
 
234
- routes/<route>/-functions/ # Page-specific
234
+ routes/<route>/-functions/ # 페이지 전용
235
235
  └── <function-name>.ts
236
236
  ```
237
237
 
238
- > ⚠️ **Do Not Create `functions/index.ts`**
238
+ > ⚠️ **`functions/index.ts` 생성 금지**
239
239
  >
240
- > Do not create `index.ts` (barrel export) file in `functions/` folder.
240
+ > `functions/` 폴더에 `index.ts` (barrel export) 파일을 만들지 마세요.
241
241
  >
242
- > **Issues:**
243
- > 1. **Tree Shaking Fails** - Bundler includes unused functions
244
- > 2. **Client Bundle Pollution** - Server-only libraries like `pg`, `prisma` get imported to client, causing build errors
242
+ > **문제점:**
243
+ > 1. **Tree Shaking 실패** - 번들러가 사용하지 않는 함수도 포함
244
+ > 2. **Client 번들 오염** - `pg`, `prisma` 서버 전용 라이브러리가 클라이언트에 import되어 빌드 에러 발생
245
245
  >
246
246
  > ```typescript
247
- > // ❌ Do not create functions/index.ts
247
+ > // ❌ functions/index.ts 만들지 말 것
248
248
  > export * from './get-users'
249
- > export * from './create-post' // pg import → client build fails
249
+ > export * from './create-post' // pg import → 클라이언트 빌드 실패
250
250
  >
251
- > // ✅ Import directly from individual files
251
+ > // ✅ 개별 파일에서 직접 import
252
252
  > import { getUsers } from '@/functions/get-users'
253
253
  > import { createPost } from '@/functions/create-post'
254
254
  > ```
@@ -278,30 +278,30 @@ if (process.env.NODE_ENV !== 'production') {
278
278
 
279
279
  ### beforeLoad vs loader
280
280
 
281
- | Item | beforeLoad | loader |
281
+ | 항목 | beforeLoad | loader |
282
282
  |------|-----------|--------|
283
- | **Execution Order** | Sequential (outermost → innermost) | Parallel (after beforeLoad completes) |
284
- | **Purpose** | Auth, Context passing, redirects | Data loading |
285
- | **Blocking** | Blocks all loaders | Runs in parallel with other loaders |
286
- | **Performance Impact** | ⚠️ High | ✅ Low |
283
+ | **실행 순서** | 순차 (outermost → innermost) | 병렬 (beforeLoad 완료 후) |
284
+ | **용도** | 인증, Context 전달, 리다이렉트 | 데이터 로딩 |
285
+ | **블로킹** | 모든 loader 차단 | 다른 loader와 병렬 |
286
+ | **성능 영향** | ⚠️ 높음 | ✅ 낮음 |
287
287
 
288
288
  ```
289
- 1. Parent beforeLoad (sequential) ──┐
290
- 2. Child beforeLoad (sequential) ──┼→ After completion
291
- 3. All loaders (parallel) ───────────┘
289
+ 1. Parent beforeLoad (순차) ──┐
290
+ 2. Child beforeLoad (순차) ──┼→ 완료
291
+ 3. All loaders (병렬) ────────┘
292
292
  ```
293
293
 
294
- ### Code Patterns
294
+ ### 코드 패턴
295
295
 
296
296
  ```typescript
297
- // ✅ beforeLoad: Auth & Context
297
+ // ✅ beforeLoad: 인증 & Context
298
298
  beforeLoad: async () => {
299
299
  const user = await getUser()
300
300
  if (!user) throw redirect({ to: '/login' })
301
301
  return { user }
302
302
  }
303
303
 
304
- // ✅ loader: Data Loading
304
+ // ✅ loader: 데이터 로딩
305
305
  loader: async () => {
306
306
  const [users, roles] = await Promise.all([
307
307
  getUsers(),
@@ -311,10 +311,10 @@ loader: async () => {
311
311
  }
312
312
  ```
313
313
 
314
- | ❌ Avoid | ✅ Recommended |
315
- |----------|----------------|
316
- | Data loading in beforeLoad | Data loading in loader |
317
- | Blocking loaders | Parallel execution |
314
+ | ❌ 금지 | ✅ 권장 |
315
+ |--------|--------|
316
+ | beforeLoad에서 데이터 로딩 | loader에서 데이터 로딩 |
317
+ | loader 차단 | 병렬 실행 |
318
318
 
319
319
  </route_lifecycle>
320
320
 
@@ -324,14 +324,14 @@ loader: async () => {
324
324
 
325
325
  ## Context Management
326
326
 
327
- | Step | File | Action |
328
- |------|------|--------|
329
- | **Create** | `__root.tsx` | `createRootRouteWithContext` |
330
- | **Extend** | `route.tsx` | Extend Context in `beforeLoad` |
331
- | **Use** | `component` | `useRouteContext()` |
327
+ | 단계 | 파일 | 작업 |
328
+ |------|------|------|
329
+ | **생성** | `__root.tsx` | `createRootRouteWithContext` |
330
+ | **확장** | `route.tsx` | `beforeLoad` Context 확장 |
331
+ | **사용** | `component` | `useRouteContext()` |
332
332
 
333
333
  ```typescript
334
- // 1. Root: Define Context
334
+ // 1. Root: Context 정의
335
335
  interface RouterContext {
336
336
  user: User | null
337
337
  }
@@ -340,16 +340,16 @@ export const Route = createRootRouteWithContext<RouterContext>()({
340
340
  beforeLoad: async () => ({ user: await getUser() }),
341
341
  })
342
342
 
343
- // 2. Extend: Extend Context
343
+ // 2. 확장: Context 확장
344
344
  beforeLoad: async ({ context }) => ({
345
345
  ...context,
346
346
  permissions: await getPermissions(context.user.id),
347
347
  })
348
348
 
349
- // 3. Use: Component
349
+ // 3. 사용: Component
350
350
  const { user, permissions } = useRouteContext({ from: '/dashboard' })
351
351
 
352
- // 4. Use: Loader
352
+ // 4. 사용: Loader
353
353
  loader: async ({ context }) => {
354
354
  if (!context.permissions.includes('users:read')) {
355
355
  throw new Error('Unauthorized')
@@ -366,7 +366,7 @@ loader: async ({ context }) => {
366
366
 
367
367
  ## Data Flow
368
368
 
369
- ### Query Flow (Read)
369
+ ### Query Flow (읽기)
370
370
 
371
371
  ```
372
372
  Page → useQuery → Server Function → Prisma → Database
@@ -387,7 +387,7 @@ export const getUsers = createServerFn()
387
387
  .handler(async () => prisma.user.findMany())
388
388
  ```
389
389
 
390
- ### Mutation Flow (Write)
390
+ ### Mutation Flow (쓰기)
391
391
 
392
392
  ```
393
393
  Form → useMutation → Server Function
@@ -423,17 +423,17 @@ export const createUser = createServerFn({ method: 'POST' })
423
423
 
424
424
  ## Server Functions (Advanced)
425
425
 
426
- ### Server Functions Types
426
+ ### Server Functions 타입
427
427
 
428
- | Type | Execution | Use Cases |
429
- |------|-----------|-----------|
430
- | **createServerFn** | Server | DB access, secrets, server logic (default) |
431
- | createClientOnlyFn | Client | localStorage, window |
432
- | createIsomorphicFn | Both | Environment-specific implementations |
428
+ | 타입 | 실행 위치 | 사용 시나리오 |
429
+ |------|----------|-------------|
430
+ | **createServerFn** | 서버 | DB 접근, 비밀키, 서버 로직 (기본) |
431
+ | createClientOnlyFn | 클라이언트 | localStorage, window |
432
+ | createIsomorphicFn | 양쪽 | 환경별 구현 |
433
433
 
434
- **Default Rule**: Use `createServerFn` unless specified otherwise
434
+ **기본 규칙**: 별도 요청 없으면 `createServerFn` 사용
435
435
 
436
- ### Middleware Pattern
436
+ ### Middleware 패턴
437
437
 
438
438
  ```typescript
439
439
  // 1. authMiddleware
@@ -444,7 +444,7 @@ export const authMiddleware = createMiddleware()
444
444
  return next({ context: { ...context, user: session.user } })
445
445
  })
446
446
 
447
- // 2. Usage
447
+ // 2. 사용
448
448
  export const createPost = createServerFn({ method: 'POST' })
449
449
  .middleware([authMiddleware])
450
450
  .inputValidator(createPostSchema)
@@ -455,7 +455,7 @@ export const createPost = createServerFn({ method: 'POST' })
455
455
  })
456
456
  ```
457
457
 
458
- **Execution Order**: Middleware → inputValidator → handler
458
+ **실행 순서**: Middleware → inputValidator → handler
459
459
 
460
460
  </server_functions_advanced>
461
461
 
@@ -465,11 +465,11 @@ export const createPost = createServerFn({ method: 'POST' })
465
465
 
466
466
  ## Error Handling
467
467
 
468
- | Component | Scope | Location | Required |
469
- |-----------|-------|----------|----------|
470
- | **errorComponent** | Route errors | Each route | ✅ |
468
+ | 컴포넌트 | 처리 범위 | 위치 | 필수 |
469
+ |---------|----------|------|-----|
470
+ | **errorComponent** | 라우트 에러 | route | ✅ |
471
471
  | **notFoundComponent** | 404 | __root.tsx | ✅ |
472
- | **pendingComponent** | Loading | Each route | Optional |
472
+ | **pendingComponent** | 로딩 | route | 선택 |
473
473
 
474
474
  ```typescript
475
475
  // __root.tsx
@@ -478,29 +478,29 @@ export const Route = createRootRoute({
478
478
  notFoundComponent: () => <div>404 Not Found</div>,
479
479
  })
480
480
 
481
- // Route level
481
+ // Route 레벨
482
482
  export const Route = createFileRoute('/dashboard')({
483
483
  errorComponent: ({ error }) => <div>{error.message}</div>,
484
484
  })
485
485
 
486
- // Loader errors
486
+ // Loader 에러
487
487
  loader: async () => {
488
488
  try {
489
489
  return { users: await getUsers() }
490
490
  } catch (error) {
491
- throw new Error('Failed to load data')
491
+ throw new Error('데이터 로딩 실패')
492
492
  }
493
493
  }
494
494
 
495
- // Server Function errors
495
+ // Server Function 에러
496
496
  .handler(async ({ data }) => {
497
497
  try {
498
498
  return await prisma.user.create({ data })
499
499
  } catch (error) {
500
500
  if (error.code === 'P2002') {
501
- throw new Error('Email already exists')
501
+ throw new Error('이미 존재하는 이메일')
502
502
  }
503
- throw new Error('Failed to create user')
503
+ throw new Error('사용자 생성 실패')
504
504
  }
505
505
  })
506
506
  ```