@jarrodmedrano/claude-skills 1.0.13 → 1.0.15
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/.claude/commands/new-backend.md +135 -1
- package/.claude/commands/new-fullstack.md +301 -7
- package/.claude/commands/new-website.md +178 -3
- package/.claude/skills/solito/SKILL.md +604 -0
- package/.claude/skills/solito/references/common-pitfalls.md +659 -0
- package/.claude/skills/solito/references/monorepo-setup.md +619 -0
- package/.claude/skills/solito/references/navigation-patterns.md +606 -0
- package/.claude/skills/solito/references/platform-specific.md +651 -0
- package/README.md +1 -0
- package/package.json +1 -1
|
@@ -69,7 +69,141 @@ When this skill is invoked:
|
|
|
69
69
|
- Database: PostgreSQL (pg), MongoDB (mongoose), Prisma ORM
|
|
70
70
|
- Authentication: JWT setup, Passport.js
|
|
71
71
|
- Validation: Zod, Joi
|
|
72
|
-
|
|
72
|
+
|
|
73
|
+
11. **Set up Vitest for testing** (MANDATORY):
|
|
74
|
+
- Install Vitest and testing libraries:
|
|
75
|
+
```bash
|
|
76
|
+
npm install -D vitest @vitest/ui @vitest/coverage-v8 supertest @types/supertest
|
|
77
|
+
```
|
|
78
|
+
- Create `vitest.config.ts`:
|
|
79
|
+
```typescript
|
|
80
|
+
import { defineConfig } from 'vitest/config'
|
|
81
|
+
|
|
82
|
+
export default defineConfig({
|
|
83
|
+
test: {
|
|
84
|
+
globals: true,
|
|
85
|
+
environment: 'node',
|
|
86
|
+
setupFiles: ['./src/test/setup.ts'],
|
|
87
|
+
coverage: {
|
|
88
|
+
provider: 'v8',
|
|
89
|
+
reporter: ['text', 'json', 'html'],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
})
|
|
93
|
+
```
|
|
94
|
+
- Create `src/test/setup.ts` for global test setup
|
|
95
|
+
- Add scripts to `package.json`:
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"scripts": {
|
|
99
|
+
"test": "vitest",
|
|
100
|
+
"test:ui": "vitest --ui",
|
|
101
|
+
"test:coverage": "vitest run --coverage"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
- **Monorepo note**: If backend is in a monorepo, use workspace filter:
|
|
106
|
+
```bash
|
|
107
|
+
npm run test --workspace=apps/api
|
|
108
|
+
# or with pnpm
|
|
109
|
+
pnpm --filter @project/api test
|
|
110
|
+
```
|
|
111
|
+
- Create test structure:
|
|
112
|
+
```
|
|
113
|
+
src/
|
|
114
|
+
routes/
|
|
115
|
+
users.ts
|
|
116
|
+
users.test.ts # Route tests
|
|
117
|
+
services/
|
|
118
|
+
userService.ts
|
|
119
|
+
userService.test.ts # Unit tests
|
|
120
|
+
test/
|
|
121
|
+
setup.ts # Global setup
|
|
122
|
+
fixtures/ # Test data
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
12. **Separate layers in backend architecture** (MANDATORY):
|
|
126
|
+
- Create clean architecture structure:
|
|
127
|
+
```
|
|
128
|
+
src/
|
|
129
|
+
controllers/ # HTTP request handlers (thin, delegate to services)
|
|
130
|
+
services/ # Business logic (testable, no HTTP dependencies)
|
|
131
|
+
repositories/ # Data access layer (database queries)
|
|
132
|
+
middleware/ # Express/Fastify middleware
|
|
133
|
+
routes/ # Route definitions
|
|
134
|
+
types/ # TypeScript types and interfaces
|
|
135
|
+
utils/ # Shared utilities
|
|
136
|
+
test/ # Test setup and fixtures
|
|
137
|
+
```
|
|
138
|
+
- Layer rules:
|
|
139
|
+
* Controllers: Handle HTTP, validate input, call services
|
|
140
|
+
* Services: Pure business logic, no HTTP or DB dependencies
|
|
141
|
+
* Repositories: Database operations only
|
|
142
|
+
- Each service should have corresponding test file
|
|
143
|
+
|
|
144
|
+
13. **Set up ESLint with Airbnb style guide** (MANDATORY):
|
|
145
|
+
- Install ESLint and Airbnb config:
|
|
146
|
+
```bash
|
|
147
|
+
npm install -D eslint eslint-config-airbnb-base eslint-config-airbnb-typescript \
|
|
148
|
+
@typescript-eslint/eslint-plugin @typescript-eslint/parser \
|
|
149
|
+
eslint-plugin-import
|
|
150
|
+
```
|
|
151
|
+
- Create `.eslintrc.cjs` (CommonJS for ESLint config only):
|
|
152
|
+
```javascript
|
|
153
|
+
module.exports = {
|
|
154
|
+
root: true,
|
|
155
|
+
env: { es2022: true, node: true },
|
|
156
|
+
extends: [
|
|
157
|
+
'airbnb-base',
|
|
158
|
+
'airbnb-typescript/base',
|
|
159
|
+
'plugin:@typescript-eslint/recommended',
|
|
160
|
+
],
|
|
161
|
+
parser: '@typescript-eslint/parser',
|
|
162
|
+
parserOptions: {
|
|
163
|
+
ecmaVersion: 'latest',
|
|
164
|
+
sourceType: 'module',
|
|
165
|
+
project: './tsconfig.json',
|
|
166
|
+
},
|
|
167
|
+
plugins: ['@typescript-eslint'],
|
|
168
|
+
rules: {
|
|
169
|
+
'import/prefer-default-export': 'off',
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
14. **Set up Husky with pre-commit hook** (MANDATORY):
|
|
175
|
+
- Install Husky and lint-staged:
|
|
176
|
+
```bash
|
|
177
|
+
npm install -D husky lint-staged
|
|
178
|
+
npx husky init
|
|
179
|
+
```
|
|
180
|
+
- Create `.husky/pre-commit`:
|
|
181
|
+
```bash
|
|
182
|
+
npx lint-staged
|
|
183
|
+
```
|
|
184
|
+
- Add to `package.json`:
|
|
185
|
+
```json
|
|
186
|
+
{
|
|
187
|
+
"lint-staged": {
|
|
188
|
+
"*.{js,ts}": ["eslint --fix", "git add"]
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
15. **Ensure TypeScript uses ES modules** (MANDATORY):
|
|
194
|
+
- Set `"type": "module"` in `package.json`
|
|
195
|
+
- Configure `tsconfig.json`:
|
|
196
|
+
```json
|
|
197
|
+
{
|
|
198
|
+
"compilerOptions": {
|
|
199
|
+
"module": "ESNext",
|
|
200
|
+
"moduleResolution": "bundler",
|
|
201
|
+
"target": "ES2022",
|
|
202
|
+
"esModuleInterop": true,
|
|
203
|
+
"allowSyntheticDefaultImports": true
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
```
|
|
73
207
|
|
|
74
208
|
**Example usage**:
|
|
75
209
|
- `/new-backend my-api`
|
|
@@ -13,6 +13,7 @@ When this skill is invoked:
|
|
|
13
13
|
- T3 Stack (Next.js + tRPC + Prisma + Tailwind)
|
|
14
14
|
- MERN (MongoDB + Express + React + Node)
|
|
15
15
|
- Monorepo (React frontend + Express backend + shared types)
|
|
16
|
+
- Solito (Expo + Next.js + shared navigation - Universal app for web + mobile)
|
|
16
17
|
|
|
17
18
|
2. Extract the project name from args, or ask if not provided
|
|
18
19
|
|
|
@@ -34,18 +35,106 @@ When this skill is invoked:
|
|
|
34
35
|
- Set up proxy configuration
|
|
35
36
|
|
|
36
37
|
**Monorepo**:
|
|
37
|
-
- Create monorepo structure:
|
|
38
|
+
- Create monorepo structure (separate apps from component libraries):
|
|
38
39
|
```
|
|
39
40
|
{project-name}/
|
|
40
41
|
apps/
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
web/ # Application code (React + Vite)
|
|
43
|
+
api/ # Backend application (Express)
|
|
43
44
|
packages/
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
ui/ # Shared component library with Storybook
|
|
46
|
+
src/
|
|
47
|
+
components/
|
|
48
|
+
index.ts
|
|
49
|
+
.storybook/
|
|
50
|
+
package.json
|
|
51
|
+
shared/ # Shared TypeScript types and utilities
|
|
52
|
+
src/
|
|
53
|
+
package.json
|
|
54
|
+
package.json # Workspace config
|
|
46
55
|
```
|
|
47
56
|
- Set up npm workspaces or pnpm workspace
|
|
48
57
|
|
|
58
|
+
**Solito (Universal App)**:
|
|
59
|
+
- Ask follow-up questions:
|
|
60
|
+
* Package manager? (pnpm recommended, yarn, npm)
|
|
61
|
+
* Include NativeWind? (Tailwind for React Native)
|
|
62
|
+
* Include authentication? (Clerk, Supabase, custom, skip)
|
|
63
|
+
* Include API layer? (tRPC, REST, skip)
|
|
64
|
+
* Include UI library? (Tamagui, React Native Paper, custom, skip)
|
|
65
|
+
|
|
66
|
+
- Use Solito starter template:
|
|
67
|
+
```bash
|
|
68
|
+
npx create-solito-app@latest {project-name}
|
|
69
|
+
```
|
|
70
|
+
Or create manually if custom setup needed
|
|
71
|
+
|
|
72
|
+
- Create monorepo structure:
|
|
73
|
+
```
|
|
74
|
+
{project-name}/
|
|
75
|
+
apps/
|
|
76
|
+
expo/ # React Native mobile app
|
|
77
|
+
app/ # Expo Router file-system routes
|
|
78
|
+
package.json
|
|
79
|
+
app.json
|
|
80
|
+
next/ # Next.js web app
|
|
81
|
+
app/ # Next.js App Router
|
|
82
|
+
public/
|
|
83
|
+
package.json
|
|
84
|
+
next.config.js
|
|
85
|
+
packages/
|
|
86
|
+
app/ # Shared UI and navigation
|
|
87
|
+
features/ # Feature screens
|
|
88
|
+
components/ # Reusable components
|
|
89
|
+
lib/ # Utilities
|
|
90
|
+
provider/ # Navigation provider
|
|
91
|
+
package.json
|
|
92
|
+
api/ # Shared API client (if selected)
|
|
93
|
+
package.json
|
|
94
|
+
package.json # Root workspace config
|
|
95
|
+
pnpm-workspace.yaml # or yarn/npm workspace
|
|
96
|
+
turbo.json # Turborepo config
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
- Configure based on selections:
|
|
100
|
+
* **NativeWind**: Set up Tailwind config, Metro config, Babel plugin
|
|
101
|
+
* **Clerk**: Install @clerk/clerk-expo and @clerk/nextjs, configure providers
|
|
102
|
+
* **Supabase**: Install @supabase/supabase-js, set up client
|
|
103
|
+
* **tRPC**: Configure tRPC client, create example router
|
|
104
|
+
* **Tamagui**: Install and configure Tamagui for universal styling
|
|
105
|
+
|
|
106
|
+
- Add example screens:
|
|
107
|
+
* Home screen (apps/expo/app/index.tsx and apps/next/app/page.tsx)
|
|
108
|
+
* Profile screen with navigation
|
|
109
|
+
* Demonstrate shared navigation with solito/link
|
|
110
|
+
|
|
111
|
+
- Configure Metro bundler to watch monorepo
|
|
112
|
+
- Set up TypeScript path aliases
|
|
113
|
+
- Create .env.example for both platforms (NEXT_PUBLIC_ and EXPO_PUBLIC_)
|
|
114
|
+
|
|
115
|
+
- Add development scripts to root package.json:
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"scripts": {
|
|
119
|
+
"dev": "turbo run dev",
|
|
120
|
+
"dev:next": "pnpm --filter next-app dev",
|
|
121
|
+
"dev:expo": "pnpm --filter expo-app start",
|
|
122
|
+
"build": "turbo run build",
|
|
123
|
+
"lint": "turbo run lint",
|
|
124
|
+
"typecheck": "turbo run typecheck"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
- Create README with:
|
|
130
|
+
* Project structure explanation
|
|
131
|
+
* Setup instructions (pnpm install)
|
|
132
|
+
* How to run web app (cd apps/next && pnpm dev)
|
|
133
|
+
* How to run mobile app (cd apps/expo && pnpm start)
|
|
134
|
+
* Shared code location (packages/app)
|
|
135
|
+
* Platform-specific code guidelines
|
|
136
|
+
* Deployment instructions (Vercel for web, EAS for mobile)
|
|
137
|
+
|
|
49
138
|
4. Set up database and ORM:
|
|
50
139
|
- Create database schema/models
|
|
51
140
|
- Set up migration scripts
|
|
@@ -62,9 +151,212 @@ When this skill is invoked:
|
|
|
62
151
|
- Error handling
|
|
63
152
|
- Logging setup
|
|
64
153
|
|
|
65
|
-
7.
|
|
154
|
+
7. **Set up ESLint with Airbnb style guide** (MANDATORY):
|
|
155
|
+
- Install ESLint and Airbnb config:
|
|
156
|
+
```bash
|
|
157
|
+
npm install -D eslint eslint-config-airbnb eslint-config-airbnb-typescript \
|
|
158
|
+
@typescript-eslint/eslint-plugin @typescript-eslint/parser \
|
|
159
|
+
eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react \
|
|
160
|
+
eslint-plugin-react-hooks
|
|
161
|
+
```
|
|
162
|
+
- Create `.eslintrc.cjs` (CommonJS for ESLint config only):
|
|
163
|
+
```javascript
|
|
164
|
+
module.exports = {
|
|
165
|
+
root: true,
|
|
166
|
+
env: { browser: true, es2022: true, node: true },
|
|
167
|
+
extends: [
|
|
168
|
+
'airbnb',
|
|
169
|
+
'airbnb-typescript',
|
|
170
|
+
'airbnb/hooks',
|
|
171
|
+
'plugin:@typescript-eslint/recommended',
|
|
172
|
+
],
|
|
173
|
+
parser: '@typescript-eslint/parser',
|
|
174
|
+
parserOptions: {
|
|
175
|
+
ecmaVersion: 'latest',
|
|
176
|
+
sourceType: 'module',
|
|
177
|
+
project: './tsconfig.json',
|
|
178
|
+
},
|
|
179
|
+
plugins: ['@typescript-eslint', 'react', 'react-hooks'],
|
|
180
|
+
rules: {
|
|
181
|
+
'react/react-in-jsx-scope': 'off',
|
|
182
|
+
'react/function-component-definition': ['error', {
|
|
183
|
+
namedComponents: 'function-declaration',
|
|
184
|
+
unnamedComponents: 'arrow-function',
|
|
185
|
+
}],
|
|
186
|
+
'import/prefer-default-export': 'off',
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
8. **Set up Husky with pre-commit hook** (MANDATORY):
|
|
192
|
+
- Install Husky and lint-staged:
|
|
193
|
+
```bash
|
|
194
|
+
npm install -D husky lint-staged
|
|
195
|
+
npx husky init
|
|
196
|
+
```
|
|
197
|
+
- Create `.husky/pre-commit`:
|
|
198
|
+
```bash
|
|
199
|
+
npx lint-staged
|
|
200
|
+
```
|
|
201
|
+
- Add to `package.json`:
|
|
202
|
+
```json
|
|
203
|
+
{
|
|
204
|
+
"lint-staged": {
|
|
205
|
+
"*.{js,jsx,ts,tsx}": ["eslint --fix", "git add"]
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
9. **Ensure TypeScript uses ES modules** (MANDATORY):
|
|
211
|
+
- Set `"type": "module"` in `package.json`
|
|
212
|
+
- Configure `tsconfig.json`:
|
|
213
|
+
```json
|
|
214
|
+
{
|
|
215
|
+
"compilerOptions": {
|
|
216
|
+
"module": "ESNext",
|
|
217
|
+
"moduleResolution": "bundler",
|
|
218
|
+
"target": "ES2022",
|
|
219
|
+
"esModuleInterop": true,
|
|
220
|
+
"allowSyntheticDefaultImports": true
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
- Use `.js` extensions in imports for Node.js code, or configure bundler appropriately
|
|
225
|
+
|
|
226
|
+
10. **Set up Vitest for testing** (MANDATORY):
|
|
227
|
+
- Install Vitest and testing libraries:
|
|
228
|
+
```bash
|
|
229
|
+
# For monorepos, install at root or in each package
|
|
230
|
+
npm install -D vitest @vitest/ui @vitest/coverage-v8 \
|
|
231
|
+
@testing-library/react @testing-library/jest-dom jsdom
|
|
232
|
+
```
|
|
233
|
+
- Create `vitest.config.ts`:
|
|
234
|
+
```typescript
|
|
235
|
+
import { defineConfig } from 'vitest/config'
|
|
236
|
+
import react from '@vitejs/plugin-react'
|
|
237
|
+
|
|
238
|
+
export default defineConfig({
|
|
239
|
+
plugins: [react()],
|
|
240
|
+
test: {
|
|
241
|
+
environment: 'jsdom',
|
|
242
|
+
globals: true,
|
|
243
|
+
setupFiles: ['./src/test/setup.ts'],
|
|
244
|
+
coverage: {
|
|
245
|
+
provider: 'v8',
|
|
246
|
+
reporter: ['text', 'json', 'html'],
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
})
|
|
250
|
+
```
|
|
251
|
+
- Create `src/test/setup.ts`:
|
|
252
|
+
```typescript
|
|
253
|
+
import '@testing-library/jest-dom'
|
|
254
|
+
```
|
|
255
|
+
- Add scripts to `package.json`:
|
|
256
|
+
```json
|
|
257
|
+
{
|
|
258
|
+
"scripts": {
|
|
259
|
+
"test": "vitest",
|
|
260
|
+
"test:ui": "vitest --ui",
|
|
261
|
+
"test:coverage": "vitest run --coverage"
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
- **Monorepo note**: Use `--filter` flag to run tests in specific packages:
|
|
266
|
+
```bash
|
|
267
|
+
npm run test --workspace=packages/ui
|
|
268
|
+
# or with pnpm
|
|
269
|
+
pnpm --filter @project/ui test
|
|
270
|
+
```
|
|
66
271
|
|
|
67
|
-
|
|
272
|
+
11. **Set up Storybook for component library** (MANDATORY):
|
|
273
|
+
- Install Storybook in the component library package (e.g., `packages/ui`):
|
|
274
|
+
```bash
|
|
275
|
+
# Navigate to component library first
|
|
276
|
+
cd packages/ui
|
|
277
|
+
npx storybook@latest init --type react
|
|
278
|
+
```
|
|
279
|
+
- Configure `.storybook/main.ts`:
|
|
280
|
+
```typescript
|
|
281
|
+
import type { StorybookConfig } from '@storybook/react-vite'
|
|
282
|
+
|
|
283
|
+
const config: StorybookConfig = {
|
|
284
|
+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
|
|
285
|
+
addons: [
|
|
286
|
+
'@storybook/addon-onboarding',
|
|
287
|
+
'@storybook/addon-essentials',
|
|
288
|
+
'@storybook/addon-interactions',
|
|
289
|
+
'@storybook/addon-a11y',
|
|
290
|
+
],
|
|
291
|
+
framework: {
|
|
292
|
+
name: '@storybook/react-vite',
|
|
293
|
+
options: {},
|
|
294
|
+
},
|
|
295
|
+
}
|
|
296
|
+
export default config
|
|
297
|
+
```
|
|
298
|
+
- Create story alongside each component:
|
|
299
|
+
```
|
|
300
|
+
packages/ui/src/components/
|
|
301
|
+
Button/
|
|
302
|
+
Button.tsx
|
|
303
|
+
Button.styles.ts
|
|
304
|
+
Button.stories.tsx
|
|
305
|
+
Button.test.tsx
|
|
306
|
+
index.ts
|
|
307
|
+
```
|
|
308
|
+
- Example story template (`Button.stories.tsx`):
|
|
309
|
+
```typescript
|
|
310
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
311
|
+
import { Button } from './Button'
|
|
312
|
+
|
|
313
|
+
const meta: Meta<typeof Button> = {
|
|
314
|
+
title: 'Components/Button',
|
|
315
|
+
component: Button,
|
|
316
|
+
tags: ['autodocs'],
|
|
317
|
+
}
|
|
318
|
+
export default meta
|
|
319
|
+
|
|
320
|
+
type Story = StoryObj<typeof Button>
|
|
321
|
+
|
|
322
|
+
export const Primary: Story = {
|
|
323
|
+
args: { variant: 'primary', children: 'Click me' },
|
|
324
|
+
}
|
|
325
|
+
```
|
|
326
|
+
- Add scripts to component library `package.json`:
|
|
327
|
+
```json
|
|
328
|
+
{
|
|
329
|
+
"scripts": {
|
|
330
|
+
"storybook": "storybook dev -p 6006",
|
|
331
|
+
"build-storybook": "storybook build"
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
12. **Separate application from component library** (MANDATORY):
|
|
337
|
+
- Component library (`packages/ui`):
|
|
338
|
+
* Contains only reusable, presentational components
|
|
339
|
+
* No business logic or API calls
|
|
340
|
+
* Each component has: `.tsx`, `.styles.ts`, `.stories.tsx`, `.test.tsx`
|
|
341
|
+
* Exports components via barrel file (`index.ts`)
|
|
342
|
+
- Application (`apps/web` or `apps/api`):
|
|
343
|
+
* Contains business logic, routing, API integration
|
|
344
|
+
* Imports components from `@project/ui`
|
|
345
|
+
* Feature-based organization for app-specific code
|
|
346
|
+
- Configure workspace dependencies:
|
|
347
|
+
```json
|
|
348
|
+
// apps/web/package.json
|
|
349
|
+
{
|
|
350
|
+
"dependencies": {
|
|
351
|
+
"@project/ui": "workspace:*",
|
|
352
|
+
"@project/shared": "workspace:*"
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
13. Initialize git repository with appropriate .gitignore
|
|
358
|
+
|
|
359
|
+
14. Create README with:
|
|
68
360
|
- Project structure
|
|
69
361
|
- Setup instructions
|
|
70
362
|
- Development commands
|
|
@@ -73,3 +365,5 @@ When this skill is invoked:
|
|
|
73
365
|
**Example usage**:
|
|
74
366
|
- `/new-fullstack my-saas-app`
|
|
75
367
|
- `/new-fullstack` (will prompt for name)
|
|
368
|
+
|
|
369
|
+
**Note**: For Solito projects, automatically invoke the `solito` skill after project creation to provide specialized guidance for cross-platform development, navigation patterns, and best practices.
|
|
@@ -31,11 +31,186 @@ When this skill is invoked:
|
|
|
31
31
|
- State Management: Zustand, Redux Toolkit, TanStack Query
|
|
32
32
|
- Utilities: axios, date-fns, zod, react-hook-form
|
|
33
33
|
|
|
34
|
-
7.
|
|
34
|
+
7. **Set up ESLint with Airbnb style guide** (MANDATORY):
|
|
35
|
+
- Install ESLint and Airbnb config:
|
|
36
|
+
```bash
|
|
37
|
+
npm install -D eslint eslint-config-airbnb eslint-config-airbnb-typescript \
|
|
38
|
+
@typescript-eslint/eslint-plugin @typescript-eslint/parser \
|
|
39
|
+
eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-react \
|
|
40
|
+
eslint-plugin-react-hooks
|
|
41
|
+
```
|
|
42
|
+
- Create `.eslintrc.cjs` (CommonJS for ESLint config only):
|
|
43
|
+
```javascript
|
|
44
|
+
module.exports = {
|
|
45
|
+
root: true,
|
|
46
|
+
env: { browser: true, es2022: true, node: true },
|
|
47
|
+
extends: [
|
|
48
|
+
'airbnb',
|
|
49
|
+
'airbnb-typescript',
|
|
50
|
+
'airbnb/hooks',
|
|
51
|
+
'plugin:@typescript-eslint/recommended',
|
|
52
|
+
],
|
|
53
|
+
parser: '@typescript-eslint/parser',
|
|
54
|
+
parserOptions: {
|
|
55
|
+
ecmaVersion: 'latest',
|
|
56
|
+
sourceType: 'module',
|
|
57
|
+
project: './tsconfig.json',
|
|
58
|
+
},
|
|
59
|
+
plugins: ['@typescript-eslint', 'react', 'react-hooks'],
|
|
60
|
+
rules: {
|
|
61
|
+
'react/react-in-jsx-scope': 'off',
|
|
62
|
+
'react/function-component-definition': ['error', {
|
|
63
|
+
namedComponents: 'function-declaration',
|
|
64
|
+
unnamedComponents: 'arrow-function',
|
|
65
|
+
}],
|
|
66
|
+
'import/prefer-default-export': 'off',
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
```
|
|
70
|
+
- For Vue projects, use `eslint-config-airbnb-base` instead and add `eslint-plugin-vue`
|
|
35
71
|
|
|
36
|
-
8.
|
|
72
|
+
8. **Set up Husky with pre-commit hook** (MANDATORY):
|
|
73
|
+
- Install Husky and lint-staged:
|
|
74
|
+
```bash
|
|
75
|
+
npm install -D husky lint-staged
|
|
76
|
+
npx husky init
|
|
77
|
+
```
|
|
78
|
+
- Create `.husky/pre-commit`:
|
|
79
|
+
```bash
|
|
80
|
+
npx lint-staged
|
|
81
|
+
```
|
|
82
|
+
- Add to `package.json`:
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"lint-staged": {
|
|
86
|
+
"*.{js,jsx,ts,tsx,vue}": ["eslint --fix", "git add"]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
37
90
|
|
|
38
|
-
9.
|
|
91
|
+
9. **Ensure TypeScript uses ES modules** (MANDATORY):
|
|
92
|
+
- Set `"type": "module"` in `package.json`
|
|
93
|
+
- Configure `tsconfig.json`:
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"compilerOptions": {
|
|
97
|
+
"module": "ESNext",
|
|
98
|
+
"moduleResolution": "bundler",
|
|
99
|
+
"target": "ES2022",
|
|
100
|
+
"esModuleInterop": true,
|
|
101
|
+
"allowSyntheticDefaultImports": true
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
- Use `.js` extensions in imports for Node.js code, or configure bundler appropriately
|
|
106
|
+
|
|
107
|
+
10. **Set up Vitest for testing** (MANDATORY):
|
|
108
|
+
- Install Vitest and testing libraries:
|
|
109
|
+
```bash
|
|
110
|
+
npm install -D vitest @vitest/ui @vitest/coverage-v8 \
|
|
111
|
+
@testing-library/react @testing-library/jest-dom jsdom
|
|
112
|
+
```
|
|
113
|
+
- Create `vitest.config.ts`:
|
|
114
|
+
```typescript
|
|
115
|
+
import { defineConfig } from 'vitest/config'
|
|
116
|
+
import react from '@vitejs/plugin-react'
|
|
117
|
+
|
|
118
|
+
export default defineConfig({
|
|
119
|
+
plugins: [react()],
|
|
120
|
+
test: {
|
|
121
|
+
environment: 'jsdom',
|
|
122
|
+
globals: true,
|
|
123
|
+
setupFiles: ['./src/test/setup.ts'],
|
|
124
|
+
coverage: {
|
|
125
|
+
provider: 'v8',
|
|
126
|
+
reporter: ['text', 'json', 'html'],
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
})
|
|
130
|
+
```
|
|
131
|
+
- Create `src/test/setup.ts`:
|
|
132
|
+
```typescript
|
|
133
|
+
import '@testing-library/jest-dom'
|
|
134
|
+
```
|
|
135
|
+
- Add scripts to `package.json`:
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"scripts": {
|
|
139
|
+
"test": "vitest",
|
|
140
|
+
"test:ui": "vitest --ui",
|
|
141
|
+
"test:coverage": "vitest run --coverage"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
- For Vue projects, use `@testing-library/vue` instead of `@testing-library/react`
|
|
146
|
+
|
|
147
|
+
11. **Set up Storybook for components** (MANDATORY):
|
|
148
|
+
- Install Storybook:
|
|
149
|
+
```bash
|
|
150
|
+
npx storybook@latest init --type react
|
|
151
|
+
# For Vue: npx storybook@latest init --type vue3
|
|
152
|
+
```
|
|
153
|
+
- Configure `.storybook/main.ts`:
|
|
154
|
+
```typescript
|
|
155
|
+
import type { StorybookConfig } from '@storybook/react-vite'
|
|
156
|
+
|
|
157
|
+
const config: StorybookConfig = {
|
|
158
|
+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
|
|
159
|
+
addons: [
|
|
160
|
+
'@storybook/addon-onboarding',
|
|
161
|
+
'@storybook/addon-essentials',
|
|
162
|
+
'@storybook/addon-interactions',
|
|
163
|
+
'@storybook/addon-a11y',
|
|
164
|
+
],
|
|
165
|
+
framework: {
|
|
166
|
+
name: '@storybook/react-vite',
|
|
167
|
+
options: {},
|
|
168
|
+
},
|
|
169
|
+
}
|
|
170
|
+
export default config
|
|
171
|
+
```
|
|
172
|
+
- Add scripts to `package.json`:
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"scripts": {
|
|
176
|
+
"storybook": "storybook dev -p 6006",
|
|
177
|
+
"build-storybook": "storybook build"
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
12. **Separate components from application code** (MANDATORY):
|
|
183
|
+
- Create project structure:
|
|
184
|
+
```
|
|
185
|
+
src/
|
|
186
|
+
components/ # Reusable UI components (with stories)
|
|
187
|
+
Button/
|
|
188
|
+
Button.tsx
|
|
189
|
+
Button.styles.ts
|
|
190
|
+
Button.stories.tsx
|
|
191
|
+
Button.test.tsx
|
|
192
|
+
index.ts
|
|
193
|
+
features/ # Feature-specific code (business logic)
|
|
194
|
+
auth/
|
|
195
|
+
dashboard/
|
|
196
|
+
lib/ # Utilities and helpers
|
|
197
|
+
hooks/ # Custom hooks
|
|
198
|
+
app/ # Next.js App Router pages (or pages/ for Vite)
|
|
199
|
+
```
|
|
200
|
+
- Components folder rules:
|
|
201
|
+
* Only presentational components
|
|
202
|
+
* No business logic or API calls
|
|
203
|
+
* Each component has story and test files
|
|
204
|
+
- Features folder rules:
|
|
205
|
+
* Contains business logic and API integration
|
|
206
|
+
* Can import from components/
|
|
207
|
+
* Feature-specific components live here (not reusable)
|
|
208
|
+
|
|
209
|
+
13. Initialize git repository if not already initialized
|
|
210
|
+
|
|
211
|
+
14. Create a basic README with project info and getting started instructions
|
|
212
|
+
|
|
213
|
+
15. Show the user how to start the dev server
|
|
39
214
|
|
|
40
215
|
**Example usage**:
|
|
41
216
|
- `/new-website my-portfolio`
|