cursor-kit-cli 1.2.0-beta → 1.2.0-beta.2
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/cli.cjs +333 -56
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +334 -57
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +39 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +33 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/commands/docs.md +5 -3
- package/templates/commands/explain.md +5 -3
- package/templates/commands/fix.md +5 -3
- package/templates/commands/implement.md +5 -3
- package/templates/commands/refactor.md +5 -3
- package/templates/commands/review.md +5 -3
- package/templates/commands/test.md +5 -3
- package/templates/manifest.json +11 -8
- package/templates/rules/git.mdc +0 -2
- package/templates/rules/toc.mdc +17 -9
- package/templates/skills/aesthetic/SKILL.md +121 -0
- package/templates/skills/aesthetic/assets/design-guideline-template.md +163 -0
- package/templates/skills/aesthetic/assets/design-story-template.md +135 -0
- package/templates/skills/aesthetic/references/design-principles.md +62 -0
- package/templates/skills/aesthetic/references/design-resources.md +75 -0
- package/templates/skills/aesthetic/references/micro-interactions.md +53 -0
- package/templates/skills/aesthetic/references/storytelling-design.md +50 -0
- package/templates/skills/backend-development/SKILL.mdc +95 -0
- package/templates/skills/backend-development/references/backend-api-design.md +495 -0
- package/templates/skills/backend-development/references/backend-architecture.md +454 -0
- package/templates/skills/backend-development/references/backend-authentication.md +338 -0
- package/templates/skills/backend-development/references/backend-code-quality.md +659 -0
- package/templates/skills/backend-development/references/backend-debugging.md +904 -0
- package/templates/skills/backend-development/references/backend-devops.md +494 -0
- package/templates/skills/backend-development/references/backend-mindset.md +387 -0
- package/templates/skills/backend-development/references/backend-performance.md +397 -0
- package/templates/skills/backend-development/references/backend-security.md +290 -0
- package/templates/skills/backend-development/references/backend-technologies.md +256 -0
- package/templates/skills/backend-development/references/backend-testing.md +429 -0
- package/templates/skills/frontend-design/SKILL.mdc +41 -0
- package/templates/skills/frontend-design/references/animejs.md +396 -0
- package/templates/skills/frontend-development/SKILL.mdc +399 -0
- package/templates/skills/frontend-development/resources/common-patterns.md +331 -0
- package/templates/skills/frontend-development/resources/complete-examples.md +872 -0
- package/templates/skills/frontend-development/resources/component-patterns.md +502 -0
- package/templates/skills/frontend-development/resources/data-fetching.md +767 -0
- package/templates/skills/frontend-development/resources/file-organization.md +502 -0
- package/templates/skills/frontend-development/resources/loading-and-error-states.md +501 -0
- package/templates/skills/frontend-development/resources/performance.md +406 -0
- package/templates/skills/frontend-development/resources/routing-guide.md +364 -0
- package/templates/skills/frontend-development/resources/styling-guide.md +428 -0
- package/templates/skills/frontend-development/resources/typescript-standards.md +418 -0
- package/templates/skills/problem-solving/SKILL.mdc +96 -0
- package/templates/skills/problem-solving/references/attribution.md +69 -0
- package/templates/skills/problem-solving/references/collision-zone-thinking.md +79 -0
- package/templates/skills/problem-solving/references/inversion-exercise.md +91 -0
- package/templates/skills/problem-solving/references/meta-pattern-recognition.md +87 -0
- package/templates/skills/problem-solving/references/scale-game.md +95 -0
- package/templates/skills/problem-solving/references/simplification-cascades.md +80 -0
- package/templates/skills/problem-solving/references/when-stuck.md +72 -0
- package/templates/skills/research/SKILL.mdc +168 -0
- package/templates/skills/sequential-thinking/.env.example +8 -0
- package/templates/skills/sequential-thinking/README.md +183 -0
- package/templates/skills/sequential-thinking/SKILL.mdc +94 -0
- package/templates/skills/sequential-thinking/package.json +31 -0
- package/templates/skills/sequential-thinking/references/advanced-strategies.md +79 -0
- package/templates/skills/sequential-thinking/references/advanced-techniques.md +76 -0
- package/templates/skills/sequential-thinking/references/core-patterns.md +95 -0
- package/templates/skills/sequential-thinking/references/examples-api.md +88 -0
- package/templates/skills/sequential-thinking/references/examples-architecture.md +94 -0
- package/templates/skills/sequential-thinking/references/examples-debug.md +90 -0
- package/templates/skills/sequential-thinking/scripts/format-thought.js +159 -0
- package/templates/skills/sequential-thinking/scripts/process-thought.js +236 -0
- package/templates/skills/sequential-thinking/tests/format-thought.test.js +133 -0
- package/templates/skills/sequential-thinking/tests/process-thought.test.js +215 -0
- package/templates/skills/ui-styling/LICENSE.txt +202 -0
- package/templates/skills/ui-styling/SKILL.mdc +321 -0
- package/templates/skills/ui-styling/references/canvas-design-system.md +320 -0
- package/templates/skills/ui-styling/references/shadcn-accessibility.md +471 -0
- package/templates/skills/ui-styling/references/shadcn-components.md +424 -0
- package/templates/skills/ui-styling/references/shadcn-theming.md +373 -0
- package/templates/skills/ui-styling/references/tailwind-customization.md +483 -0
- package/templates/skills/ui-styling/references/tailwind-responsive.md +382 -0
- package/templates/skills/ui-styling/references/tailwind-utilities.md +455 -0
- package/templates/rules/frontend-design.mdc +0 -48
- package/templates/rules/performance.mdc +0 -54
- package/templates/rules/react.mdc +0 -58
- package/templates/rules/security.mdc +0 -50
- package/templates/rules/testing.mdc +0 -54
- package/templates/rules/typescript.mdc +0 -36
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
# Routing Guide
|
|
2
|
+
|
|
3
|
+
TanStack Router implementation with folder-based routing and lazy loading patterns.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## TanStack Router Overview
|
|
8
|
+
|
|
9
|
+
**TanStack Router** with file-based routing:
|
|
10
|
+
- Folder structure defines routes
|
|
11
|
+
- Lazy loading for code splitting
|
|
12
|
+
- Type-safe routing
|
|
13
|
+
- Breadcrumb loaders
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Folder-Based Routing
|
|
18
|
+
|
|
19
|
+
### Directory Structure
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
routes/
|
|
23
|
+
__root.tsx # Root layout
|
|
24
|
+
index.tsx # Home route (/)
|
|
25
|
+
posts/
|
|
26
|
+
index.tsx # /posts
|
|
27
|
+
create/
|
|
28
|
+
index.tsx # /posts/create
|
|
29
|
+
$postId.tsx # /posts/:postId (dynamic)
|
|
30
|
+
comments/
|
|
31
|
+
index.tsx # /comments
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Pattern**:
|
|
35
|
+
- `index.tsx` = Route at that path
|
|
36
|
+
- `$param.tsx` = Dynamic parameter
|
|
37
|
+
- Nested folders = Nested routes
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Basic Route Pattern
|
|
42
|
+
|
|
43
|
+
### Example from posts/index.tsx
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
/**
|
|
47
|
+
* Posts route component
|
|
48
|
+
* Displays the main blog posts list
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
import { createFileRoute } from '@tanstack/react-router';
|
|
52
|
+
import { lazy } from 'react';
|
|
53
|
+
|
|
54
|
+
// Lazy load the page component
|
|
55
|
+
const PostsList = lazy(() =>
|
|
56
|
+
import('@/features/posts/components/PostsList').then(
|
|
57
|
+
(module) => ({ default: module.PostsList }),
|
|
58
|
+
),
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
export const Route = createFileRoute('/posts/')({
|
|
62
|
+
component: PostsPage,
|
|
63
|
+
// Define breadcrumb data
|
|
64
|
+
loader: () => ({
|
|
65
|
+
crumb: 'Posts',
|
|
66
|
+
}),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
function PostsPage() {
|
|
70
|
+
return (
|
|
71
|
+
<PostsList
|
|
72
|
+
title='All Posts'
|
|
73
|
+
showFilters={true}
|
|
74
|
+
/>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default PostsPage;
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Key Points:**
|
|
82
|
+
- Lazy load heavy components
|
|
83
|
+
- `createFileRoute` with route path
|
|
84
|
+
- `loader` for breadcrumb data
|
|
85
|
+
- Page component renders content
|
|
86
|
+
- Export both Route and component
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Lazy Loading Routes
|
|
91
|
+
|
|
92
|
+
### Named Export Pattern
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
import { lazy } from 'react';
|
|
96
|
+
|
|
97
|
+
// For named exports, use .then() to map to default
|
|
98
|
+
const MyPage = lazy(() =>
|
|
99
|
+
import('@/features/my-feature/components/MyPage').then(
|
|
100
|
+
(module) => ({ default: module.MyPage })
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Default Export Pattern
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
import { lazy } from 'react';
|
|
109
|
+
|
|
110
|
+
// For default exports, simpler syntax
|
|
111
|
+
const MyPage = lazy(() => import('@/features/my-feature/components/MyPage'));
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Why Lazy Load Routes?
|
|
115
|
+
|
|
116
|
+
- Code splitting - smaller initial bundle
|
|
117
|
+
- Faster initial page load
|
|
118
|
+
- Load route code only when navigated to
|
|
119
|
+
- Better performance
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## createFileRoute
|
|
124
|
+
|
|
125
|
+
### Basic Configuration
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
export const Route = createFileRoute('/my-route/')({
|
|
129
|
+
component: MyRoutePage,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
function MyRoutePage() {
|
|
133
|
+
return <div>My Route Content</div>;
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### With Breadcrumb Loader
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
export const Route = createFileRoute('/my-route/')({
|
|
141
|
+
component: MyRoutePage,
|
|
142
|
+
loader: () => ({
|
|
143
|
+
crumb: 'My Route Title',
|
|
144
|
+
}),
|
|
145
|
+
});
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Breadcrumb appears in navigation/app bar automatically.
|
|
149
|
+
|
|
150
|
+
### With Data Loader
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
export const Route = createFileRoute('/my-route/')({
|
|
154
|
+
component: MyRoutePage,
|
|
155
|
+
loader: async () => {
|
|
156
|
+
// Can prefetch data here
|
|
157
|
+
const data = await api.getData();
|
|
158
|
+
return { crumb: 'My Route', data };
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### With Search Params
|
|
164
|
+
|
|
165
|
+
```typescript
|
|
166
|
+
export const Route = createFileRoute('/search/')({
|
|
167
|
+
component: SearchPage,
|
|
168
|
+
validateSearch: (search: Record<string, unknown>) => {
|
|
169
|
+
return {
|
|
170
|
+
query: (search.query as string) || '',
|
|
171
|
+
page: Number(search.page) || 1,
|
|
172
|
+
};
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
function SearchPage() {
|
|
177
|
+
const { query, page } = Route.useSearch();
|
|
178
|
+
// Use query and page
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Dynamic Routes
|
|
185
|
+
|
|
186
|
+
### Parameter Routes
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
// routes/users/$userId.tsx
|
|
190
|
+
|
|
191
|
+
export const Route = createFileRoute('/users/$userId')({
|
|
192
|
+
component: UserPage,
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
function UserPage() {
|
|
196
|
+
const { userId } = Route.useParams();
|
|
197
|
+
|
|
198
|
+
return <UserProfile userId={userId} />;
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Multiple Parameters
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
// routes/posts/$postId/comments/$commentId.tsx
|
|
206
|
+
|
|
207
|
+
export const Route = createFileRoute('/posts/$postId/comments/$commentId')({
|
|
208
|
+
component: CommentPage,
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
function CommentPage() {
|
|
212
|
+
const { postId, commentId } = Route.useParams();
|
|
213
|
+
|
|
214
|
+
return <CommentEditor postId={postId} commentId={commentId} />;
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Navigation
|
|
221
|
+
|
|
222
|
+
### Programmatic Navigation
|
|
223
|
+
|
|
224
|
+
```typescript
|
|
225
|
+
import { useNavigate } from '@tanstack/react-router';
|
|
226
|
+
|
|
227
|
+
export const MyComponent: React.FC = () => {
|
|
228
|
+
const navigate = useNavigate();
|
|
229
|
+
|
|
230
|
+
const handleClick = () => {
|
|
231
|
+
navigate({ to: '/posts' });
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
return <Button onClick={handleClick}>View Posts</Button>;
|
|
235
|
+
};
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### With Parameters
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
const handleNavigate = () => {
|
|
242
|
+
navigate({
|
|
243
|
+
to: '/users/$userId',
|
|
244
|
+
params: { userId: '123' },
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### With Search Params
|
|
250
|
+
|
|
251
|
+
```typescript
|
|
252
|
+
const handleSearch = () => {
|
|
253
|
+
navigate({
|
|
254
|
+
to: '/search',
|
|
255
|
+
search: { query: 'test', page: 1 },
|
|
256
|
+
});
|
|
257
|
+
};
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Route Layout Pattern
|
|
263
|
+
|
|
264
|
+
### Root Layout (__root.tsx)
|
|
265
|
+
|
|
266
|
+
```typescript
|
|
267
|
+
import { createRootRoute, Outlet } from '@tanstack/react-router';
|
|
268
|
+
import { Box } from '@mui/material';
|
|
269
|
+
import { CustomAppBar } from '~components/CustomAppBar';
|
|
270
|
+
|
|
271
|
+
export const Route = createRootRoute({
|
|
272
|
+
component: RootLayout,
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
function RootLayout() {
|
|
276
|
+
return (
|
|
277
|
+
<Box>
|
|
278
|
+
<CustomAppBar />
|
|
279
|
+
<Box sx={{ p: 2 }}>
|
|
280
|
+
<Outlet /> {/* Child routes render here */}
|
|
281
|
+
</Box>
|
|
282
|
+
</Box>
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Nested Layouts
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
// routes/dashboard/index.tsx
|
|
291
|
+
export const Route = createFileRoute('/dashboard/')({
|
|
292
|
+
component: DashboardLayout,
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
function DashboardLayout() {
|
|
296
|
+
return (
|
|
297
|
+
<Box>
|
|
298
|
+
<DashboardSidebar />
|
|
299
|
+
<Box sx={{ flex: 1 }}>
|
|
300
|
+
<Outlet /> {/* Nested routes */}
|
|
301
|
+
</Box>
|
|
302
|
+
</Box>
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Complete Route Example
|
|
310
|
+
|
|
311
|
+
```typescript
|
|
312
|
+
/**
|
|
313
|
+
* User profile route
|
|
314
|
+
* Path: /users/:userId
|
|
315
|
+
*/
|
|
316
|
+
|
|
317
|
+
import { createFileRoute } from '@tanstack/react-router';
|
|
318
|
+
import { lazy } from 'react';
|
|
319
|
+
import { SuspenseLoader } from '~components/SuspenseLoader';
|
|
320
|
+
|
|
321
|
+
// Lazy load heavy component
|
|
322
|
+
const UserProfile = lazy(() =>
|
|
323
|
+
import('@/features/users/components/UserProfile').then(
|
|
324
|
+
(module) => ({ default: module.UserProfile })
|
|
325
|
+
)
|
|
326
|
+
);
|
|
327
|
+
|
|
328
|
+
export const Route = createFileRoute('/users/$userId')({
|
|
329
|
+
component: UserPage,
|
|
330
|
+
loader: () => ({
|
|
331
|
+
crumb: 'User Profile',
|
|
332
|
+
}),
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
function UserPage() {
|
|
336
|
+
const { userId } = Route.useParams();
|
|
337
|
+
|
|
338
|
+
return (
|
|
339
|
+
<SuspenseLoader>
|
|
340
|
+
<UserProfile userId={userId} />
|
|
341
|
+
</SuspenseLoader>
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export default UserPage;
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## Summary
|
|
351
|
+
|
|
352
|
+
**Routing Checklist:**
|
|
353
|
+
- ✅ Folder-based: `routes/my-route/index.tsx`
|
|
354
|
+
- ✅ Lazy load components: `React.lazy(() => import())`
|
|
355
|
+
- ✅ Use `createFileRoute` with route path
|
|
356
|
+
- ✅ Add breadcrumb in `loader` function
|
|
357
|
+
- ✅ Wrap in `SuspenseLoader` for loading states
|
|
358
|
+
- ✅ Use `Route.useParams()` for dynamic params
|
|
359
|
+
- ✅ Use `useNavigate()` for programmatic navigation
|
|
360
|
+
|
|
361
|
+
**See Also:**
|
|
362
|
+
- [component-patterns.md](component-patterns.md) - Lazy loading patterns
|
|
363
|
+
- [loading-and-error-states.md](loading-and-error-states.md) - SuspenseLoader usage
|
|
364
|
+
- [complete-examples.md](complete-examples.md) - Full route examples
|