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.
Files changed (91) hide show
  1. package/dist/cli.cjs +333 -56
  2. package/dist/cli.cjs.map +1 -1
  3. package/dist/cli.js +334 -57
  4. package/dist/cli.js.map +1 -1
  5. package/dist/index.cjs +39 -1
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +9 -1
  8. package/dist/index.d.ts +9 -1
  9. package/dist/index.js +33 -2
  10. package/dist/index.js.map +1 -1
  11. package/package.json +1 -1
  12. package/templates/commands/docs.md +5 -3
  13. package/templates/commands/explain.md +5 -3
  14. package/templates/commands/fix.md +5 -3
  15. package/templates/commands/implement.md +5 -3
  16. package/templates/commands/refactor.md +5 -3
  17. package/templates/commands/review.md +5 -3
  18. package/templates/commands/test.md +5 -3
  19. package/templates/manifest.json +11 -8
  20. package/templates/rules/git.mdc +0 -2
  21. package/templates/rules/toc.mdc +17 -9
  22. package/templates/skills/aesthetic/SKILL.md +121 -0
  23. package/templates/skills/aesthetic/assets/design-guideline-template.md +163 -0
  24. package/templates/skills/aesthetic/assets/design-story-template.md +135 -0
  25. package/templates/skills/aesthetic/references/design-principles.md +62 -0
  26. package/templates/skills/aesthetic/references/design-resources.md +75 -0
  27. package/templates/skills/aesthetic/references/micro-interactions.md +53 -0
  28. package/templates/skills/aesthetic/references/storytelling-design.md +50 -0
  29. package/templates/skills/backend-development/SKILL.mdc +95 -0
  30. package/templates/skills/backend-development/references/backend-api-design.md +495 -0
  31. package/templates/skills/backend-development/references/backend-architecture.md +454 -0
  32. package/templates/skills/backend-development/references/backend-authentication.md +338 -0
  33. package/templates/skills/backend-development/references/backend-code-quality.md +659 -0
  34. package/templates/skills/backend-development/references/backend-debugging.md +904 -0
  35. package/templates/skills/backend-development/references/backend-devops.md +494 -0
  36. package/templates/skills/backend-development/references/backend-mindset.md +387 -0
  37. package/templates/skills/backend-development/references/backend-performance.md +397 -0
  38. package/templates/skills/backend-development/references/backend-security.md +290 -0
  39. package/templates/skills/backend-development/references/backend-technologies.md +256 -0
  40. package/templates/skills/backend-development/references/backend-testing.md +429 -0
  41. package/templates/skills/frontend-design/SKILL.mdc +41 -0
  42. package/templates/skills/frontend-design/references/animejs.md +396 -0
  43. package/templates/skills/frontend-development/SKILL.mdc +399 -0
  44. package/templates/skills/frontend-development/resources/common-patterns.md +331 -0
  45. package/templates/skills/frontend-development/resources/complete-examples.md +872 -0
  46. package/templates/skills/frontend-development/resources/component-patterns.md +502 -0
  47. package/templates/skills/frontend-development/resources/data-fetching.md +767 -0
  48. package/templates/skills/frontend-development/resources/file-organization.md +502 -0
  49. package/templates/skills/frontend-development/resources/loading-and-error-states.md +501 -0
  50. package/templates/skills/frontend-development/resources/performance.md +406 -0
  51. package/templates/skills/frontend-development/resources/routing-guide.md +364 -0
  52. package/templates/skills/frontend-development/resources/styling-guide.md +428 -0
  53. package/templates/skills/frontend-development/resources/typescript-standards.md +418 -0
  54. package/templates/skills/problem-solving/SKILL.mdc +96 -0
  55. package/templates/skills/problem-solving/references/attribution.md +69 -0
  56. package/templates/skills/problem-solving/references/collision-zone-thinking.md +79 -0
  57. package/templates/skills/problem-solving/references/inversion-exercise.md +91 -0
  58. package/templates/skills/problem-solving/references/meta-pattern-recognition.md +87 -0
  59. package/templates/skills/problem-solving/references/scale-game.md +95 -0
  60. package/templates/skills/problem-solving/references/simplification-cascades.md +80 -0
  61. package/templates/skills/problem-solving/references/when-stuck.md +72 -0
  62. package/templates/skills/research/SKILL.mdc +168 -0
  63. package/templates/skills/sequential-thinking/.env.example +8 -0
  64. package/templates/skills/sequential-thinking/README.md +183 -0
  65. package/templates/skills/sequential-thinking/SKILL.mdc +94 -0
  66. package/templates/skills/sequential-thinking/package.json +31 -0
  67. package/templates/skills/sequential-thinking/references/advanced-strategies.md +79 -0
  68. package/templates/skills/sequential-thinking/references/advanced-techniques.md +76 -0
  69. package/templates/skills/sequential-thinking/references/core-patterns.md +95 -0
  70. package/templates/skills/sequential-thinking/references/examples-api.md +88 -0
  71. package/templates/skills/sequential-thinking/references/examples-architecture.md +94 -0
  72. package/templates/skills/sequential-thinking/references/examples-debug.md +90 -0
  73. package/templates/skills/sequential-thinking/scripts/format-thought.js +159 -0
  74. package/templates/skills/sequential-thinking/scripts/process-thought.js +236 -0
  75. package/templates/skills/sequential-thinking/tests/format-thought.test.js +133 -0
  76. package/templates/skills/sequential-thinking/tests/process-thought.test.js +215 -0
  77. package/templates/skills/ui-styling/LICENSE.txt +202 -0
  78. package/templates/skills/ui-styling/SKILL.mdc +321 -0
  79. package/templates/skills/ui-styling/references/canvas-design-system.md +320 -0
  80. package/templates/skills/ui-styling/references/shadcn-accessibility.md +471 -0
  81. package/templates/skills/ui-styling/references/shadcn-components.md +424 -0
  82. package/templates/skills/ui-styling/references/shadcn-theming.md +373 -0
  83. package/templates/skills/ui-styling/references/tailwind-customization.md +483 -0
  84. package/templates/skills/ui-styling/references/tailwind-responsive.md +382 -0
  85. package/templates/skills/ui-styling/references/tailwind-utilities.md +455 -0
  86. package/templates/rules/frontend-design.mdc +0 -48
  87. package/templates/rules/performance.mdc +0 -54
  88. package/templates/rules/react.mdc +0 -58
  89. package/templates/rules/security.mdc +0 -50
  90. package/templates/rules/testing.mdc +0 -54
  91. package/templates/rules/typescript.mdc +0 -36
@@ -0,0 +1,331 @@
1
+ # Common Patterns
2
+
3
+ Frequently used patterns for forms, authentication, DataGrid, dialogs, and other common UI elements.
4
+
5
+ ---
6
+
7
+ ## Authentication with useAuth
8
+
9
+ ### Getting Current User
10
+
11
+ ```typescript
12
+ import { useAuth } from '@/hooks/useAuth';
13
+
14
+ export const MyComponent: React.FC = () => {
15
+ const { user } = useAuth();
16
+
17
+ // Available properties:
18
+ // - user.id: string
19
+ // - user.email: string
20
+ // - user.username: string
21
+ // - user.roles: string[]
22
+
23
+ return (
24
+ <div>
25
+ <p>Logged in as: {user.email}</p>
26
+ <p>Username: {user.username}</p>
27
+ <p>Roles: {user.roles.join(', ')}</p>
28
+ </div>
29
+ );
30
+ };
31
+ ```
32
+
33
+ **NEVER make direct API calls for auth** - always use `useAuth` hook.
34
+
35
+ ---
36
+
37
+ ## Forms with React Hook Form
38
+
39
+ ### Basic Form
40
+
41
+ ```typescript
42
+ import { useForm } from 'react-hook-form';
43
+ import { zodResolver } from '@hookform/resolvers/zod';
44
+ import { z } from 'zod';
45
+ import { TextField, Button } from '@mui/material';
46
+ import { useMuiSnackbar } from '@/hooks/useMuiSnackbar';
47
+
48
+ // Zod schema for validation
49
+ const formSchema = z.object({
50
+ username: z.string().min(3, 'Username must be at least 3 characters'),
51
+ email: z.string().email('Invalid email address'),
52
+ age: z.number().min(18, 'Must be 18 or older'),
53
+ });
54
+
55
+ type FormData = z.infer<typeof formSchema>;
56
+
57
+ export const MyForm: React.FC = () => {
58
+ const { showSuccess, showError } = useMuiSnackbar();
59
+
60
+ const { register, handleSubmit, formState: { errors } } = useForm<FormData>({
61
+ resolver: zodResolver(formSchema),
62
+ defaultValues: {
63
+ username: '',
64
+ email: '',
65
+ age: 18,
66
+ },
67
+ });
68
+
69
+ const onSubmit = async (data: FormData) => {
70
+ try {
71
+ await api.submitForm(data);
72
+ showSuccess('Form submitted successfully');
73
+ } catch (error) {
74
+ showError('Failed to submit form');
75
+ }
76
+ };
77
+
78
+ return (
79
+ <form onSubmit={handleSubmit(onSubmit)}>
80
+ <TextField
81
+ {...register('username')}
82
+ label='Username'
83
+ error={!!errors.username}
84
+ helperText={errors.username?.message}
85
+ />
86
+
87
+ <TextField
88
+ {...register('email')}
89
+ label='Email'
90
+ error={!!errors.email}
91
+ helperText={errors.email?.message}
92
+ type='email'
93
+ />
94
+
95
+ <TextField
96
+ {...register('age', { valueAsNumber: true })}
97
+ label='Age'
98
+ error={!!errors.age}
99
+ helperText={errors.age?.message}
100
+ type='number'
101
+ />
102
+
103
+ <Button type='submit' variant='contained'>
104
+ Submit
105
+ </Button>
106
+ </form>
107
+ );
108
+ };
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Dialog Component Pattern
114
+
115
+ ### Standard Dialog Structure
116
+
117
+ From BEST_PRACTICES.md - All dialogs should have:
118
+ - Icon in title
119
+ - Close button (X)
120
+ - Action buttons at bottom
121
+
122
+ ```typescript
123
+ import { Dialog, DialogTitle, DialogContent, DialogActions, Button, IconButton } from '@mui/material';
124
+ import { Close, Info } from '@mui/icons-material';
125
+
126
+ interface MyDialogProps {
127
+ open: boolean;
128
+ onClose: () => void;
129
+ onConfirm: () => void;
130
+ }
131
+
132
+ export const MyDialog: React.FC<MyDialogProps> = ({ open, onClose, onConfirm }) => {
133
+ return (
134
+ <Dialog open={open} onClose={onClose} maxWidth='sm' fullWidth>
135
+ <DialogTitle>
136
+ <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
137
+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
138
+ <Info color='primary' />
139
+ Dialog Title
140
+ </Box>
141
+ <IconButton onClick={onClose} size='small'>
142
+ <Close />
143
+ </IconButton>
144
+ </Box>
145
+ </DialogTitle>
146
+
147
+ <DialogContent>
148
+ {/* Content here */}
149
+ </DialogContent>
150
+
151
+ <DialogActions>
152
+ <Button onClick={onClose}>Cancel</Button>
153
+ <Button onClick={onConfirm} variant='contained'>
154
+ Confirm
155
+ </Button>
156
+ </DialogActions>
157
+ </Dialog>
158
+ );
159
+ };
160
+ ```
161
+
162
+ ---
163
+
164
+ ## DataGrid Wrapper Pattern
165
+
166
+ ### Wrapper Component Contract
167
+
168
+ From BEST_PRACTICES.md - DataGrid wrappers should accept:
169
+
170
+ **Required Props:**
171
+ - `rows`: Data array
172
+ - `columns`: Column definitions
173
+ - Loading/error states
174
+
175
+ **Optional Props:**
176
+ - Toolbar components
177
+ - Custom actions
178
+ - Initial state
179
+
180
+ ```typescript
181
+ import { DataGridPro } from '@mui/x-data-grid-pro';
182
+ import type { GridColDef } from '@mui/x-data-grid-pro';
183
+
184
+ interface DataGridWrapperProps {
185
+ rows: any[];
186
+ columns: GridColDef[];
187
+ loading?: boolean;
188
+ toolbar?: React.ReactNode;
189
+ onRowClick?: (row: any) => void;
190
+ }
191
+
192
+ export const DataGridWrapper: React.FC<DataGridWrapperProps> = ({
193
+ rows,
194
+ columns,
195
+ loading = false,
196
+ toolbar,
197
+ onRowClick,
198
+ }) => {
199
+ return (
200
+ <DataGridPro
201
+ rows={rows}
202
+ columns={columns}
203
+ loading={loading}
204
+ slots={{ toolbar: toolbar ? () => toolbar : undefined }}
205
+ onRowClick={(params) => onRowClick?.(params.row)}
206
+ // Standard configuration
207
+ pagination
208
+ pageSizeOptions={[25, 50, 100]}
209
+ initialState={{
210
+ pagination: { paginationModel: { pageSize: 25 } },
211
+ }}
212
+ />
213
+ );
214
+ };
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Mutation Patterns
220
+
221
+ ### Update with Cache Invalidation
222
+
223
+ ```typescript
224
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
225
+ import { useMuiSnackbar } from '@/hooks/useMuiSnackbar';
226
+
227
+ export const useUpdateEntity = () => {
228
+ const queryClient = useQueryClient();
229
+ const { showSuccess, showError } = useMuiSnackbar();
230
+
231
+ return useMutation({
232
+ mutationFn: ({ id, data }: { id: number; data: any }) =>
233
+ api.updateEntity(id, data),
234
+
235
+ onSuccess: (result, variables) => {
236
+ // Invalidate affected queries
237
+ queryClient.invalidateQueries({ queryKey: ['entity', variables.id] });
238
+ queryClient.invalidateQueries({ queryKey: ['entities'] });
239
+
240
+ showSuccess('Entity updated');
241
+ },
242
+
243
+ onError: () => {
244
+ showError('Failed to update entity');
245
+ },
246
+ });
247
+ };
248
+
249
+ // Usage
250
+ const updateEntity = useUpdateEntity();
251
+
252
+ const handleSave = () => {
253
+ updateEntity.mutate({ id: 123, data: { name: 'New Name' } });
254
+ };
255
+ ```
256
+
257
+ ---
258
+
259
+ ## State Management Patterns
260
+
261
+ ### TanStack Query for Server State (PRIMARY)
262
+
263
+ Use TanStack Query for **all server data**:
264
+ - Fetching: useSuspenseQuery
265
+ - Mutations: useMutation
266
+ - Caching: Automatic
267
+ - Synchronization: Built-in
268
+
269
+ ```typescript
270
+ // ✅ CORRECT - TanStack Query for server data
271
+ const { data: users } = useSuspenseQuery({
272
+ queryKey: ['users'],
273
+ queryFn: () => userApi.getUsers(),
274
+ });
275
+ ```
276
+
277
+ ### useState for UI State
278
+
279
+ Use `useState` for **local UI state only**:
280
+ - Form inputs (uncontrolled)
281
+ - Modal open/closed
282
+ - Selected tab
283
+ - Temporary UI flags
284
+
285
+ ```typescript
286
+ // ✅ CORRECT - useState for UI state
287
+ const [modalOpen, setModalOpen] = useState(false);
288
+ const [selectedTab, setSelectedTab] = useState(0);
289
+ ```
290
+
291
+ ### Zustand for Global Client State (Minimal)
292
+
293
+ Use Zustand only for **global client state**:
294
+ - Theme preference
295
+ - Sidebar collapsed state
296
+ - User preferences (not from server)
297
+
298
+ ```typescript
299
+ import { create } from 'zustand';
300
+
301
+ interface AppState {
302
+ sidebarOpen: boolean;
303
+ toggleSidebar: () => void;
304
+ }
305
+
306
+ export const useAppState = create<AppState>((set) => ({
307
+ sidebarOpen: true,
308
+ toggleSidebar: () => set((state) => ({ sidebarOpen: !state.sidebarOpen })),
309
+ }));
310
+ ```
311
+
312
+ **Avoid prop drilling** - use context or Zustand instead.
313
+
314
+ ---
315
+
316
+ ## Summary
317
+
318
+ **Common Patterns:**
319
+ - ✅ useAuth hook for current user (id, email, roles, username)
320
+ - ✅ React Hook Form + Zod for forms
321
+ - ✅ Dialog with icon + close button
322
+ - ✅ DataGrid wrapper contracts
323
+ - ✅ Mutations with cache invalidation
324
+ - ✅ TanStack Query for server state
325
+ - ✅ useState for UI state
326
+ - ✅ Zustand for global client state (minimal)
327
+
328
+ **See Also:**
329
+ - [data-fetching.md](data-fetching.md) - TanStack Query patterns
330
+ - [component-patterns.md](component-patterns.md) - Component structure
331
+ - [loading-and-error-states.md](loading-and-error-states.md) - Error handling