@smicolon/ai-kit 0.3.2 → 0.4.0
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/README.md +73 -40
- package/dist/index.js +260 -126
- package/package.json +5 -5
- package/.claude-plugin/marketplace.json +0 -369
- package/packs/architect/CHANGELOG.md +0 -17
- package/packs/architect/README.md +0 -58
- package/packs/architect/agents/system-architect.md +0 -768
- package/packs/architect/commands/diagram-create.md +0 -300
- package/packs/better-auth/.mcp.json +0 -14
- package/packs/better-auth/CHANGELOG.md +0 -26
- package/packs/better-auth/README.md +0 -125
- package/packs/better-auth/agents/auth-architect.md +0 -278
- package/packs/better-auth/commands/auth-provider-add.md +0 -265
- package/packs/better-auth/commands/auth-setup.md +0 -298
- package/packs/better-auth/skills/auth-security/SKILL.md +0 -425
- package/packs/better-auth/skills/better-auth-patterns/SKILL.md +0 -455
- package/packs/dev-loop/CHANGELOG.md +0 -69
- package/packs/dev-loop/README.md +0 -155
- package/packs/dev-loop/commands/cancel-dev.md +0 -21
- package/packs/dev-loop/commands/dev-loop.md +0 -72
- package/packs/dev-loop/commands/dev-plan.md +0 -351
- package/packs/dev-loop/hooks/hooks.json +0 -15
- package/packs/dev-loop/hooks/stop-hook.sh +0 -178
- package/packs/dev-loop/scripts/setup-dev-loop.sh +0 -194
- package/packs/dev-loop/skills/tdd-planner/SKILL.md +0 -249
- package/packs/dev-loop/skills/tdd-planner/references/framework-patterns.md +0 -874
- package/packs/dev-loop/skills/tdd-planner/references/good-example.md +0 -260
- package/packs/dev-loop/skills/tdd-planner/references/plan-template.md +0 -275
- package/packs/django/CHANGELOG.md +0 -39
- package/packs/django/README.md +0 -92
- package/packs/django/agents/django-architect.md +0 -182
- package/packs/django/agents/django-builder.md +0 -250
- package/packs/django/agents/django-feature-based.md +0 -420
- package/packs/django/agents/django-reviewer.md +0 -253
- package/packs/django/agents/django-tester.md +0 -230
- package/packs/django/commands/api-endpoint.md +0 -285
- package/packs/django/commands/model-create.md +0 -178
- package/packs/django/commands/test-generate.md +0 -325
- package/packs/django/rules/migrations.md +0 -138
- package/packs/django/rules/models.md +0 -167
- package/packs/django/rules/serializers.md +0 -126
- package/packs/django/rules/services.md +0 -131
- package/packs/django/rules/tests.md +0 -140
- package/packs/django/rules/views.md +0 -102
- package/packs/django/skills/import-convention-enforcer/SKILL.md +0 -226
- package/packs/django/skills/import-convention-enforcer/patterns/django-imports.md +0 -343
- package/packs/django/skills/migration-safety-checker/SKILL.md +0 -375
- package/packs/django/skills/model-entity-validator/SKILL.md +0 -298
- package/packs/django/skills/performance-optimizer/SKILL.md +0 -447
- package/packs/django/skills/red-phase-verifier/SKILL.md +0 -180
- package/packs/django/skills/security-first-validator/SKILL.md +0 -435
- package/packs/django/skills/test-coverage-advisor/SKILL.md +0 -394
- package/packs/django/skills/test-validity-checker/SKILL.md +0 -194
- package/packs/failure-log/CHANGELOG.md +0 -20
- package/packs/failure-log/README.md +0 -168
- package/packs/failure-log/commands/failure-add.md +0 -106
- package/packs/failure-log/commands/failure-list.md +0 -89
- package/packs/failure-log/hooks/hooks.json +0 -16
- package/packs/failure-log/hooks/scripts/inject-failures.sh +0 -64
- package/packs/failure-log/skills/failure-log-manager/SKILL.md +0 -164
- package/packs/flutter/CHANGELOG.md +0 -19
- package/packs/flutter/README.md +0 -170
- package/packs/flutter/agents/flutter-architect.md +0 -166
- package/packs/flutter/agents/flutter-builder.md +0 -303
- package/packs/flutter/agents/release-manager.md +0 -355
- package/packs/flutter/commands/fastlane-setup.md +0 -188
- package/packs/flutter/commands/flutter-build.md +0 -90
- package/packs/flutter/commands/flutter-deploy.md +0 -133
- package/packs/flutter/commands/flutter-test.md +0 -117
- package/packs/flutter/commands/signing-setup.md +0 -209
- package/packs/flutter/hooks/hooks.json +0 -17
- package/packs/flutter/skills/fastlane-knowledge/SKILL.md +0 -193
- package/packs/flutter/skills/flutter-architecture/SKILL.md +0 -127
- package/packs/flutter/skills/store-publishing/SKILL.md +0 -163
- package/packs/hono/CHANGELOG.md +0 -19
- package/packs/hono/README.md +0 -143
- package/packs/hono/agents/hono-architect.md +0 -240
- package/packs/hono/agents/hono-builder.md +0 -285
- package/packs/hono/agents/hono-reviewer.md +0 -279
- package/packs/hono/agents/hono-tester.md +0 -346
- package/packs/hono/commands/middleware-create.md +0 -223
- package/packs/hono/commands/project-init.md +0 -306
- package/packs/hono/commands/route-create.md +0 -153
- package/packs/hono/commands/rpc-client.md +0 -263
- package/packs/hono/skills/cloudflare-bindings/SKILL.md +0 -408
- package/packs/hono/skills/hono-patterns/SKILL.md +0 -309
- package/packs/hono/skills/rpc-typesafe/SKILL.md +0 -388
- package/packs/hono/skills/zod-validation/SKILL.md +0 -332
- package/packs/nestjs/CHANGELOG.md +0 -29
- package/packs/nestjs/README.md +0 -75
- package/packs/nestjs/agents/nestjs-architect.md +0 -402
- package/packs/nestjs/agents/nestjs-builder.md +0 -301
- package/packs/nestjs/agents/nestjs-tester.md +0 -437
- package/packs/nestjs/commands/module-create.md +0 -369
- package/packs/nestjs/rules/controllers.md +0 -92
- package/packs/nestjs/rules/dto.md +0 -124
- package/packs/nestjs/rules/entities.md +0 -102
- package/packs/nestjs/rules/services.md +0 -106
- package/packs/nestjs/skills/barrel-export-manager/SKILL.md +0 -389
- package/packs/nestjs/skills/import-convention-enforcer/SKILL.md +0 -365
- package/packs/nextjs/CHANGELOG.md +0 -36
- package/packs/nextjs/README.md +0 -76
- package/packs/nextjs/agents/frontend-tester.md +0 -680
- package/packs/nextjs/agents/frontend-visual.md +0 -820
- package/packs/nextjs/agents/nextjs-architect.md +0 -331
- package/packs/nextjs/agents/nextjs-modular.md +0 -433
- package/packs/nextjs/commands/component-create.md +0 -398
- package/packs/nextjs/rules/api-routes.md +0 -129
- package/packs/nextjs/rules/components.md +0 -106
- package/packs/nextjs/rules/hooks.md +0 -132
- package/packs/nextjs/skills/accessibility-validator/SKILL.md +0 -445
- package/packs/nextjs/skills/import-convention-enforcer/SKILL.md +0 -399
- package/packs/nextjs/skills/react-form-validator/SKILL.md +0 -569
- package/packs/nuxtjs/CHANGELOG.md +0 -30
- package/packs/nuxtjs/README.md +0 -56
- package/packs/nuxtjs/agents/frontend-tester.md +0 -680
- package/packs/nuxtjs/agents/frontend-visual.md +0 -820
- package/packs/nuxtjs/agents/nuxtjs-architect.md +0 -537
- package/packs/nuxtjs/commands/component-create.md +0 -223
- package/packs/nuxtjs/rules/components.md +0 -101
- package/packs/nuxtjs/rules/composables.md +0 -118
- package/packs/nuxtjs/rules/server-routes.md +0 -127
- package/packs/nuxtjs/skills/accessibility-validator/SKILL.md +0 -183
- package/packs/nuxtjs/skills/import-convention-enforcer/SKILL.md +0 -196
- package/packs/nuxtjs/skills/veevalidate-form-validator/SKILL.md +0 -190
- package/packs/onboard/CHANGELOG.md +0 -22
- package/packs/onboard/README.md +0 -103
- package/packs/onboard/agents/onboard-guide.md +0 -118
- package/packs/onboard/commands/onboard.md +0 -313
- package/packs/onboard/skills/onboard-context-provider/SKILL.md +0 -98
- package/packs/tanstack-router/CHANGELOG.md +0 -30
- package/packs/tanstack-router/README.md +0 -113
- package/packs/tanstack-router/agents/tanstack-architect.md +0 -173
- package/packs/tanstack-router/agents/tanstack-builder.md +0 -360
- package/packs/tanstack-router/agents/tanstack-tester.md +0 -454
- package/packs/tanstack-router/commands/form-create.md +0 -313
- package/packs/tanstack-router/commands/query-create.md +0 -263
- package/packs/tanstack-router/commands/route-create.md +0 -190
- package/packs/tanstack-router/commands/table-create.md +0 -413
- package/packs/tanstack-router/skills/ai-patterns/SKILL.md +0 -370
- package/packs/tanstack-router/skills/db-patterns/SKILL.md +0 -346
- package/packs/tanstack-router/skills/devtools-patterns/SKILL.md +0 -415
- package/packs/tanstack-router/skills/form-patterns/SKILL.md +0 -425
- package/packs/tanstack-router/skills/pacer-patterns/SKILL.md +0 -341
- package/packs/tanstack-router/skills/query-patterns/SKILL.md +0 -359
- package/packs/tanstack-router/skills/router-patterns/SKILL.md +0 -285
- package/packs/tanstack-router/skills/store-patterns/SKILL.md +0 -351
- package/packs/tanstack-router/skills/table-patterns/SKILL.md +0 -531
- package/packs/tanstack-router/skills/tanstack-conventions/SKILL.md +0 -428
- package/packs/tanstack-router/skills/virtual-patterns/SKILL.md +0 -490
- package/packs/worktree/CHANGELOG.md +0 -45
- package/packs/worktree/README.md +0 -219
- package/packs/worktree/commands/wt.md +0 -93
- package/packs/worktree/scripts/wt.sh +0 -957
- package/packs/worktree/skills/worktree-manager/SKILL.md +0 -113
|
@@ -1,399 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: nextjs-import-enforcer
|
|
3
|
-
description: Automatically enforce consistent import patterns using Next.js path aliases and proper organization. Use when writing imports, creating new files, or organizing code structure.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Import Convention Enforcer (Next.js/React)
|
|
7
|
-
|
|
8
|
-
Auto-enforces consistent import patterns using Next.js path aliases for clean, maintainable code.
|
|
9
|
-
|
|
10
|
-
## Activation Triggers
|
|
11
|
-
|
|
12
|
-
This skill activates when:
|
|
13
|
-
- Writing or modifying TypeScript/JavaScript files
|
|
14
|
-
- Creating new components, hooks, utilities
|
|
15
|
-
- Importing from other files
|
|
16
|
-
- Organizing project structure
|
|
17
|
-
- Mentioning "import", "add", "create"
|
|
18
|
-
|
|
19
|
-
## Required Import Pattern (MANDATORY)
|
|
20
|
-
|
|
21
|
-
Use path aliases for internal imports:
|
|
22
|
-
|
|
23
|
-
```tsx
|
|
24
|
-
// ✅ CORRECT - Path aliases
|
|
25
|
-
import { Button } from '@/components/ui'
|
|
26
|
-
import { useAuth } from '@/hooks'
|
|
27
|
-
import { formatDate } from '@/lib/utils'
|
|
28
|
-
import { User } from '@/types'
|
|
29
|
-
|
|
30
|
-
// ❌ WRONG - Relative paths
|
|
31
|
-
import { Button } from '../../components/ui/Button'
|
|
32
|
-
import { useAuth } from '../../../hooks/useAuth'
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Path Alias Configuration
|
|
36
|
-
|
|
37
|
-
**tsconfig.json:**
|
|
38
|
-
```json
|
|
39
|
-
{
|
|
40
|
-
"compilerOptions": {
|
|
41
|
-
"baseUrl": ".",
|
|
42
|
-
"paths": {
|
|
43
|
-
"@/*": ["./src/*"],
|
|
44
|
-
"@/components/*": ["./src/components/*"],
|
|
45
|
-
"@/lib/*": ["./src/lib/*"],
|
|
46
|
-
"@/hooks/*": ["./src/hooks/*"],
|
|
47
|
-
"@/types/*": ["./src/types/*"],
|
|
48
|
-
"@/app/*": ["./src/app/*"]
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Auto-Fix Process
|
|
55
|
-
|
|
56
|
-
### Step 1: Detect Relative Imports
|
|
57
|
-
|
|
58
|
-
```tsx
|
|
59
|
-
// ❌ User writes
|
|
60
|
-
import { Button } from '../../../components/ui/Button'
|
|
61
|
-
import { Card } from '../../components/ui/Card'
|
|
62
|
-
import { useUser } from '../hooks/useUser'
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Step 2: Convert to Path Aliases
|
|
66
|
-
|
|
67
|
-
```tsx
|
|
68
|
-
// ✅ Auto-fixed to
|
|
69
|
-
import { Button } from '@/components/ui'
|
|
70
|
-
import { Card } from '@/components/ui'
|
|
71
|
-
import { useUser } from '@/hooks'
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Step 3: Organize Imports
|
|
75
|
-
|
|
76
|
-
```tsx
|
|
77
|
-
// ✅ Final organized imports
|
|
78
|
-
// 1. React/Next.js
|
|
79
|
-
import { useState } from 'react'
|
|
80
|
-
import Link from 'next/link'
|
|
81
|
-
|
|
82
|
-
// 2. Third-party libraries
|
|
83
|
-
import { z } from 'zod'
|
|
84
|
-
import { useForm } from 'react-hook-form'
|
|
85
|
-
|
|
86
|
-
// 3. Internal - path aliases
|
|
87
|
-
import { Button, Card } from '@/components/ui'
|
|
88
|
-
import { useUser } from '@/hooks'
|
|
89
|
-
import { formatDate } from '@/lib/utils'
|
|
90
|
-
import type { User } from '@/types'
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## Import Organization Rules
|
|
94
|
-
|
|
95
|
-
### 1. Import Order (Top to Bottom)
|
|
96
|
-
|
|
97
|
-
```tsx
|
|
98
|
-
// 1. React/Next.js core
|
|
99
|
-
import { useState, useEffect } from 'react'
|
|
100
|
-
import Image from 'next/image'
|
|
101
|
-
import Link from 'next/link'
|
|
102
|
-
|
|
103
|
-
// 2. Third-party libraries
|
|
104
|
-
import { z } from 'zod'
|
|
105
|
-
import clsx from 'clsx'
|
|
106
|
-
|
|
107
|
-
// 3. Internal modules (using @/ aliases)
|
|
108
|
-
import { Button } from '@/components/ui'
|
|
109
|
-
import { useAuth } from '@/hooks'
|
|
110
|
-
import { api } from '@/lib/api'
|
|
111
|
-
|
|
112
|
-
// 4. Types (separate or with type keyword)
|
|
113
|
-
import type { User, Post } from '@/types'
|
|
114
|
-
|
|
115
|
-
// 5. Styles (if needed)
|
|
116
|
-
import styles from './Component.module.css'
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
### 2. Named Imports (Alphabetical)
|
|
120
|
-
|
|
121
|
-
```tsx
|
|
122
|
-
// ✅ CORRECT - Alphabetical
|
|
123
|
-
import { Button, Card, Dialog, Input } from '@/components/ui'
|
|
124
|
-
|
|
125
|
-
// ❌ WRONG - Random order
|
|
126
|
-
import { Dialog, Input, Button, Card } from '@/components/ui'
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### 3. Type-Only Imports
|
|
130
|
-
|
|
131
|
-
```tsx
|
|
132
|
-
// ✅ CORRECT - Explicit type imports
|
|
133
|
-
import type { User } from '@/types'
|
|
134
|
-
import type { ButtonProps } from '@/components/ui'
|
|
135
|
-
|
|
136
|
-
// ✅ CORRECT - Inline type keyword
|
|
137
|
-
import { type User, type Post } from '@/types'
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
## Path Alias Patterns by Directory
|
|
141
|
-
|
|
142
|
-
### Components
|
|
143
|
-
|
|
144
|
-
```tsx
|
|
145
|
-
// UI components
|
|
146
|
-
import { Button, Card, Input } from '@/components/ui'
|
|
147
|
-
|
|
148
|
-
// Feature components
|
|
149
|
-
import { UserProfile } from '@/components/features'
|
|
150
|
-
|
|
151
|
-
// Layout components
|
|
152
|
-
import { Header, Footer } from '@/components/layout'
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### Hooks
|
|
156
|
-
|
|
157
|
-
```tsx
|
|
158
|
-
// Custom hooks
|
|
159
|
-
import { useAuth, useUser, useLocalStorage } from '@/hooks'
|
|
160
|
-
|
|
161
|
-
// Or specific hook files
|
|
162
|
-
import { useAuth } from '@/hooks/useAuth'
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### Utilities/Lib
|
|
166
|
-
|
|
167
|
-
```tsx
|
|
168
|
-
// Utilities
|
|
169
|
-
import { cn, formatDate, truncate } from '@/lib/utils'
|
|
170
|
-
|
|
171
|
-
// API client
|
|
172
|
-
import { api } from '@/lib/api'
|
|
173
|
-
|
|
174
|
-
// Constants
|
|
175
|
-
import { ROUTES, API_URL } from '@/lib/constants'
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
### Types
|
|
179
|
-
|
|
180
|
-
```tsx
|
|
181
|
-
// All types from types directory
|
|
182
|
-
import type { User, Post, Comment } from '@/types'
|
|
183
|
-
|
|
184
|
-
// Or specific type files
|
|
185
|
-
import type { ApiResponse } from '@/types/api'
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
### App Router (Next.js 13+)
|
|
189
|
-
|
|
190
|
-
```tsx
|
|
191
|
-
// Route components/utilities
|
|
192
|
-
import { generateMetadata } from '@/app/utils'
|
|
193
|
-
import { PageProps } from '@/app/types'
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
## Barrel Exports (index.ts)
|
|
197
|
-
|
|
198
|
-
Encourage barrel exports for cleaner imports:
|
|
199
|
-
|
|
200
|
-
```tsx
|
|
201
|
-
// components/ui/index.ts
|
|
202
|
-
export { Button } from './Button'
|
|
203
|
-
export { Card } from './Card'
|
|
204
|
-
export { Input } from './Input'
|
|
205
|
-
export { Dialog } from './Dialog'
|
|
206
|
-
|
|
207
|
-
// Usage - clean!
|
|
208
|
-
import { Button, Card, Input } from '@/components/ui'
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
## Dynamic Imports
|
|
212
|
-
|
|
213
|
-
```tsx
|
|
214
|
-
// ✅ CORRECT - Dynamic import with path alias
|
|
215
|
-
const Chart = dynamic(() => import('@/components/Chart'), {
|
|
216
|
-
loading: () => <Skeleton />,
|
|
217
|
-
ssr: false,
|
|
218
|
-
})
|
|
219
|
-
|
|
220
|
-
// ❌ WRONG - Relative path
|
|
221
|
-
const Chart = dynamic(() => import('../../components/Chart'))
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
## Server/Client Component Imports
|
|
225
|
-
|
|
226
|
-
```tsx
|
|
227
|
-
// Server Component
|
|
228
|
-
import { db } from '@/lib/database' // Server-only
|
|
229
|
-
import { ServerComponent } from '@/components/server'
|
|
230
|
-
|
|
231
|
-
// Client Component
|
|
232
|
-
'use client'
|
|
233
|
-
import { useState } from 'react'
|
|
234
|
-
import { Button } from '@/components/ui' // Client component
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
## CSS/Style Imports
|
|
238
|
-
|
|
239
|
-
```tsx
|
|
240
|
-
// ✅ CORRECT - At the end
|
|
241
|
-
import { Button } from '@/components/ui'
|
|
242
|
-
import styles from './Component.module.css'
|
|
243
|
-
|
|
244
|
-
// ✅ CORRECT - Global styles in _app or layout
|
|
245
|
-
import '@/styles/globals.css'
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
## Image Imports
|
|
249
|
-
|
|
250
|
-
```tsx
|
|
251
|
-
// ✅ CORRECT - Next.js Image with path alias
|
|
252
|
-
import Image from 'next/image'
|
|
253
|
-
import logo from '@/public/logo.png'
|
|
254
|
-
|
|
255
|
-
// ✅ CORRECT - Public path
|
|
256
|
-
<Image src="/logo.png" alt="Logo" width={200} height={50} />
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
## Common Violations
|
|
260
|
-
|
|
261
|
-
### Violation 1: Deep Relative Paths
|
|
262
|
-
|
|
263
|
-
```tsx
|
|
264
|
-
// ❌ WRONG
|
|
265
|
-
import { Button } from '../../../components/ui/Button'
|
|
266
|
-
|
|
267
|
-
// ✅ CORRECT
|
|
268
|
-
import { Button } from '@/components/ui'
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
### Violation 2: Missing Barrel Export
|
|
272
|
-
|
|
273
|
-
```tsx
|
|
274
|
-
// ❌ WRONG - Importing from specific files
|
|
275
|
-
import { Button } from '@/components/ui/Button'
|
|
276
|
-
import { Card } from '@/components/ui/Card'
|
|
277
|
-
|
|
278
|
-
// ✅ CORRECT - Import from barrel
|
|
279
|
-
import { Button, Card } from '@/components/ui'
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
### Violation 3: Mixing Import Styles
|
|
283
|
-
|
|
284
|
-
```tsx
|
|
285
|
-
// ❌ WRONG - Inconsistent
|
|
286
|
-
import { Button } from '@/components/ui'
|
|
287
|
-
import { useAuth } from '../../hooks/useAuth' // Relative!
|
|
288
|
-
|
|
289
|
-
// ✅ CORRECT - All use aliases
|
|
290
|
-
import { Button } from '@/components/ui'
|
|
291
|
-
import { useAuth } from '@/hooks'
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
### Violation 4: Type Import Without Keyword
|
|
295
|
-
|
|
296
|
-
```tsx
|
|
297
|
-
// ❌ WRONG - Importing type as value
|
|
298
|
-
import { User } from '@/types' // Adds to bundle
|
|
299
|
-
|
|
300
|
-
// ✅ CORRECT - Explicit type import
|
|
301
|
-
import type { User } from '@/types' // No runtime cost
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
## Project Structure Best Practices
|
|
305
|
-
|
|
306
|
-
```
|
|
307
|
-
src/
|
|
308
|
-
├── app/ # Next.js App Router
|
|
309
|
-
│ ├── (auth)/
|
|
310
|
-
│ ├── (dashboard)/
|
|
311
|
-
│ └── api/
|
|
312
|
-
├── components/
|
|
313
|
-
│ ├── ui/ # Shadcn components
|
|
314
|
-
│ │ ├── button.tsx
|
|
315
|
-
│ │ ├── card.tsx
|
|
316
|
-
│ │ └── index.ts # Barrel export
|
|
317
|
-
│ ├── features/ # Feature components
|
|
318
|
-
│ └── layout/ # Layout components
|
|
319
|
-
├── hooks/
|
|
320
|
-
│ ├── useAuth.ts
|
|
321
|
-
│ ├── useUser.ts
|
|
322
|
-
│ └── index.ts # Barrel export
|
|
323
|
-
├── lib/
|
|
324
|
-
│ ├── api.ts
|
|
325
|
-
│ ├── utils.ts
|
|
326
|
-
│ └── constants.ts
|
|
327
|
-
├── types/
|
|
328
|
-
│ ├── api.ts
|
|
329
|
-
│ ├── models.ts
|
|
330
|
-
│ └── index.ts # Barrel export
|
|
331
|
-
└── styles/
|
|
332
|
-
└── globals.css
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
## ESLint Integration
|
|
336
|
-
|
|
337
|
-
Suggest ESLint rules:
|
|
338
|
-
|
|
339
|
-
```json
|
|
340
|
-
{
|
|
341
|
-
"rules": {
|
|
342
|
-
"import/order": [
|
|
343
|
-
"error",
|
|
344
|
-
{
|
|
345
|
-
"groups": [
|
|
346
|
-
"builtin",
|
|
347
|
-
"external",
|
|
348
|
-
"internal",
|
|
349
|
-
"parent",
|
|
350
|
-
"sibling",
|
|
351
|
-
"index"
|
|
352
|
-
],
|
|
353
|
-
"pathGroups": [
|
|
354
|
-
{
|
|
355
|
-
"pattern": "@/**",
|
|
356
|
-
"group": "internal",
|
|
357
|
-
"position": "after"
|
|
358
|
-
}
|
|
359
|
-
],
|
|
360
|
-
"alphabetize": {
|
|
361
|
-
"order": "asc"
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
],
|
|
365
|
-
"import/no-relative-packages": "error"
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
## Success Criteria
|
|
371
|
-
|
|
372
|
-
✅ ALL internal imports use path aliases
|
|
373
|
-
✅ NO deep relative paths (../..)
|
|
374
|
-
✅ Barrel exports for component directories
|
|
375
|
-
✅ Imports organized by category
|
|
376
|
-
✅ Type imports use `type` keyword
|
|
377
|
-
✅ Consistent import style across project
|
|
378
|
-
|
|
379
|
-
## Behavior
|
|
380
|
-
|
|
381
|
-
**Proactive enforcement:**
|
|
382
|
-
- Detect relative imports automatically
|
|
383
|
-
- Convert to path aliases immediately
|
|
384
|
-
- Organize import order
|
|
385
|
-
- Suggest barrel exports
|
|
386
|
-
- Explain import patterns
|
|
387
|
-
|
|
388
|
-
**Never:**
|
|
389
|
-
- Require explicit "fix imports" request
|
|
390
|
-
- Allow deep relative paths
|
|
391
|
-
- Wait for linter errors
|
|
392
|
-
|
|
393
|
-
**Always:**
|
|
394
|
-
- Use `@/` path aliases
|
|
395
|
-
- Organize imports by category
|
|
396
|
-
- Add barrel exports where beneficial
|
|
397
|
-
- Add type keyword for type imports
|
|
398
|
-
|
|
399
|
-
This ensures clean, maintainable import structure from day one.
|