start-vibing 2.0.2 → 2.0.3

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 (35) hide show
  1. package/package.json +1 -1
  2. package/template/.claude/agents/01-orchestration/checkpoint-manager.md +1 -1
  3. package/template/.claude/agents/01-orchestration/context-manager.md +1 -1
  4. package/template/.claude/agents/01-orchestration/error-recovery.md +1 -1
  5. package/template/.claude/agents/01-orchestration/orchestrator.md +1 -1
  6. package/template/.claude/agents/01-orchestration/parallel-coordinator.md +1 -1
  7. package/template/.claude/agents/01-orchestration/task-decomposer.md +1 -1
  8. package/template/.claude/agents/01-orchestration/workflow-router.md +1 -1
  9. package/template/.claude/agents/02-typescript/bun-runtime-expert.md +1 -1
  10. package/template/.claude/agents/02-typescript/esm-resolver.md +1 -1
  11. package/template/.claude/agents/02-typescript/import-alias-enforcer.md +1 -1
  12. package/template/.claude/agents/02-typescript/ts-migration-helper.md +1 -1
  13. package/template/.claude/agents/02-typescript/ts-strict-checker.md +1 -1
  14. package/template/.claude/agents/02-typescript/ts-types-analyzer.md +1 -1
  15. package/template/.claude/agents/02-typescript/type-definition-writer.md +1 -1
  16. package/template/.claude/agents/02-typescript/zod-schema-designer.md +1 -1
  17. package/template/.claude/agents/02-typescript/zod-validator.md +1 -1
  18. package/template/.claude/hooks/SETUP.md +85 -11
  19. package/template/.claude/hooks/run-hook.cmd +46 -0
  20. package/template/.claude/hooks/run-hook.sh +43 -0
  21. package/template/.claude/hooks/run-hook.ts +158 -0
  22. package/template/.claude/hooks/stop-validator.ts +339 -0
  23. package/template/.claude/hooks/user-prompt-submit.ts +298 -0
  24. package/template/.claude/settings.json +4 -3
  25. package/template/.claude/skills/bun-runtime/SKILL.md +430 -0
  26. package/template/.claude/skills/codebase-knowledge/domains/claude-system.md +46 -4
  27. package/template/.claude/skills/mongoose-patterns/SKILL.md +512 -0
  28. package/template/.claude/skills/nextjs-app-router/SKILL.md +337 -0
  29. package/template/.claude/skills/playwright-automation/SKILL.md +438 -0
  30. package/template/.claude/skills/react-patterns/SKILL.md +376 -0
  31. package/template/.claude/skills/shadcn-ui/SKILL.md +520 -0
  32. package/template/.claude/skills/tailwind-patterns/SKILL.md +467 -0
  33. package/template/.claude/skills/trpc-api/SKILL.md +435 -0
  34. package/template/.claude/skills/typescript-strict/SKILL.md +368 -0
  35. package/template/.claude/skills/zod-validation/SKILL.md +405 -0
@@ -0,0 +1,337 @@
1
+ ---
2
+ name: nextjs-app-router
3
+ description: Next.js 15 App Router patterns. Server/Client components, Server Actions, data fetching, caching, layouts, routing. Use when implementing Next.js features.
4
+ allowed-tools: Read, Write, Edit, Grep, Glob
5
+ ---
6
+
7
+ # Next.js App Router - Modern Patterns
8
+
9
+ ## Purpose
10
+
11
+ Expert guidance for Next.js 15 App Router:
12
+
13
+ - **Server Components** - Default rendering strategy
14
+ - **Client Components** - Interactive UI patterns
15
+ - **Server Actions** - Form mutations & data updates
16
+ - **Data Fetching** - Caching & revalidation strategies
17
+ - **Routing** - Layouts, loading, error boundaries
18
+
19
+ ---
20
+
21
+ ## Critical Rules
22
+
23
+ ### 1. Server Components (Default)
24
+
25
+ > Components are Server Components by default. Only add `'use client'` when needed.
26
+
27
+ ```tsx
28
+ // Server Component (default) - can access DB directly
29
+ async function UserProfile({ userId }: { userId: string }) {
30
+ const user = await db.user.findUnique({ where: { id: userId } });
31
+ return <div>{user.name}</div>;
32
+ }
33
+ ```
34
+
35
+ ### 2. Client Components (Interactive Only)
36
+
37
+ > Only use `'use client'` for interactivity (hooks, events, browser APIs).
38
+
39
+ ```tsx
40
+ 'use client';
41
+
42
+ import { useState } from 'react';
43
+
44
+ export function Counter() {
45
+ const [count, setCount] = useState(0);
46
+ return <button onClick={() => setCount(count + 1)}>{count}</button>;
47
+ }
48
+ ```
49
+
50
+ ### 3. Server Actions (Mutations)
51
+
52
+ > Use Server Actions for form submissions and data mutations.
53
+
54
+ ```tsx
55
+ // app/actions.ts
56
+ 'use server';
57
+
58
+ import { z } from 'zod';
59
+ import { revalidatePath } from 'next/cache';
60
+
61
+ const createUserSchema = z.object({
62
+ name: z.string().min(2),
63
+ email: z.string().email(),
64
+ });
65
+
66
+ export async function createUser(formData: FormData) {
67
+ const data = createUserSchema.parse({
68
+ name: formData.get('name'),
69
+ email: formData.get('email'),
70
+ });
71
+
72
+ await db.user.create({ data });
73
+ revalidatePath('/users');
74
+ }
75
+ ```
76
+
77
+ ---
78
+
79
+ ## File Structure
80
+
81
+ ```
82
+ app/
83
+ ├── layout.tsx # Root layout (required)
84
+ ├── page.tsx # Home page
85
+ ├── loading.tsx # Loading UI
86
+ ├── error.tsx # Error boundary
87
+ ├── not-found.tsx # 404 page
88
+ ├── (auth)/ # Route group (no URL segment)
89
+ │ ├── login/page.tsx
90
+ │ └── register/page.tsx
91
+ ├── dashboard/
92
+ │ ├── layout.tsx # Nested layout
93
+ │ ├── page.tsx
94
+ │ └── [id]/ # Dynamic route
95
+ │ └── page.tsx
96
+ └── api/
97
+ └── trpc/[trpc]/route.ts
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Data Fetching Patterns
103
+
104
+ ### Static Data (Default)
105
+
106
+ ```tsx
107
+ // Cached at build time
108
+ async function getProducts() {
109
+ const res = await fetch('https://api.example.com/products');
110
+ return res.json();
111
+ }
112
+ ```
113
+
114
+ ### Dynamic Data
115
+
116
+ ```tsx
117
+ // Always fresh
118
+ async function getUser(id: string) {
119
+ const res = await fetch(`https://api.example.com/users/${id}`, {
120
+ cache: 'no-store',
121
+ });
122
+ return res.json();
123
+ }
124
+ ```
125
+
126
+ ### Revalidate on Interval
127
+
128
+ ```tsx
129
+ // Revalidate every 60 seconds
130
+ async function getPosts() {
131
+ const res = await fetch('https://api.example.com/posts', {
132
+ next: { revalidate: 60 },
133
+ });
134
+ return res.json();
135
+ }
136
+ ```
137
+
138
+ ### On-Demand Revalidation
139
+
140
+ ```tsx
141
+ 'use server';
142
+
143
+ import { revalidatePath, revalidateTag } from 'next/cache';
144
+
145
+ export async function updatePost(id: string) {
146
+ await db.post.update({ where: { id }, data: { ... } });
147
+
148
+ revalidatePath('/posts'); // Revalidate path
149
+ revalidateTag('posts'); // Revalidate tag
150
+ }
151
+ ```
152
+
153
+ ---
154
+
155
+ ## Loading & Error States
156
+
157
+ ### Loading UI
158
+
159
+ ```tsx
160
+ // app/dashboard/loading.tsx
161
+ export default function Loading() {
162
+ return <DashboardSkeleton />;
163
+ }
164
+ ```
165
+
166
+ ### Error Boundary
167
+
168
+ ```tsx
169
+ // app/dashboard/error.tsx
170
+ 'use client';
171
+
172
+ export default function Error({
173
+ error,
174
+ reset,
175
+ }: {
176
+ error: Error;
177
+ reset: () => void;
178
+ }) {
179
+ return (
180
+ <div>
181
+ <h2>Something went wrong!</h2>
182
+ <button onClick={() => reset()}>Try again</button>
183
+ </div>
184
+ );
185
+ }
186
+ ```
187
+
188
+ ---
189
+
190
+ ## Metadata & SEO
191
+
192
+ ### Static Metadata
193
+
194
+ ```tsx
195
+ // app/page.tsx
196
+ import type { Metadata } from 'next';
197
+
198
+ export const metadata: Metadata = {
199
+ title: 'Home | MyApp',
200
+ description: 'Welcome to MyApp',
201
+ };
202
+ ```
203
+
204
+ ### Dynamic Metadata
205
+
206
+ ```tsx
207
+ // app/products/[id]/page.tsx
208
+ import type { Metadata } from 'next';
209
+
210
+ export async function generateMetadata({
211
+ params,
212
+ }: {
213
+ params: { id: string };
214
+ }): Promise<Metadata> {
215
+ const product = await getProduct(params.id);
216
+ return {
217
+ title: product.name,
218
+ description: product.description,
219
+ };
220
+ }
221
+ ```
222
+
223
+ ---
224
+
225
+ ## Route Handlers (API)
226
+
227
+ ```tsx
228
+ // app/api/users/route.ts
229
+ import { NextResponse } from 'next/server';
230
+
231
+ export async function GET() {
232
+ const users = await db.user.findMany();
233
+ return NextResponse.json(users);
234
+ }
235
+
236
+ export async function POST(request: Request) {
237
+ const body = await request.json();
238
+ const user = await db.user.create({ data: body });
239
+ return NextResponse.json(user, { status: 201 });
240
+ }
241
+ ```
242
+
243
+ ---
244
+
245
+ ## Middleware
246
+
247
+ ```tsx
248
+ // middleware.ts (root)
249
+ import { NextResponse } from 'next/server';
250
+ import type { NextRequest } from 'next/server';
251
+
252
+ export function middleware(request: NextRequest) {
253
+ // Check auth
254
+ const token = request.cookies.get('token');
255
+
256
+ if (!token && request.nextUrl.pathname.startsWith('/dashboard')) {
257
+ return NextResponse.redirect(new URL('/login', request.url));
258
+ }
259
+
260
+ return NextResponse.next();
261
+ }
262
+
263
+ export const config = {
264
+ matcher: ['/dashboard/:path*'],
265
+ };
266
+ ```
267
+
268
+ ---
269
+
270
+ ## Common Patterns
271
+
272
+ ### Parallel Data Fetching
273
+
274
+ ```tsx
275
+ async function Dashboard() {
276
+ // Fetch in parallel
277
+ const [user, posts, notifications] = await Promise.all([
278
+ getUser(),
279
+ getPosts(),
280
+ getNotifications(),
281
+ ]);
282
+
283
+ return (
284
+ <div>
285
+ <UserCard user={user} />
286
+ <PostList posts={posts} />
287
+ <NotificationBell count={notifications.length} />
288
+ </div>
289
+ );
290
+ }
291
+ ```
292
+
293
+ ### Streaming with Suspense
294
+
295
+ ```tsx
296
+ import { Suspense } from 'react';
297
+
298
+ export default function Page() {
299
+ return (
300
+ <div>
301
+ <h1>Dashboard</h1>
302
+ <Suspense fallback={<UserSkeleton />}>
303
+ <UserProfile />
304
+ </Suspense>
305
+ <Suspense fallback={<PostsSkeleton />}>
306
+ <RecentPosts />
307
+ </Suspense>
308
+ </div>
309
+ );
310
+ }
311
+ ```
312
+
313
+ ---
314
+
315
+ ## Agent Integration
316
+
317
+ This skill is used by:
318
+
319
+ - **nextjs-expert** subagent
320
+ - **orchestrator** for routing Next.js tasks
321
+ - **ui-mobile/tablet/desktop** for platform-specific pages
322
+
323
+ ---
324
+
325
+ ## FORBIDDEN
326
+
327
+ 1. **'use client' without reason** - Default is server
328
+ 2. **useEffect for data fetching** - Use async components
329
+ 3. **getServerSideProps/getStaticProps** - App Router uses async components
330
+ 4. **API routes for internal data** - Use Server Components directly
331
+ 5. **Client-side auth checks only** - Use middleware
332
+
333
+ ---
334
+
335
+ ## Version
336
+
337
+ - **v1.0.0** - Initial implementation based on Next.js 15 patterns