dev-booster 1.1.2 → 1.1.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: react-file-organization
|
|
3
|
-
description: Personal React file organization style for restructuring imports, component sections, and local formatting without changing behavior.
|
|
3
|
+
description: Personal React and Next.js file organization style for restructuring imports, component sections, and local formatting without changing behavior.
|
|
4
4
|
allowed-tools: Read, Write, Edit
|
|
5
5
|
version: 1.0
|
|
6
6
|
priority: OPTIONAL
|
|
@@ -70,11 +70,12 @@ If there is any real risk of behavioral change, stop and explain which part is u
|
|
|
70
70
|
|
|
71
71
|
- If the file does not use `Formik`, skip the `Formik` section entirely.
|
|
72
72
|
- If the file does not use `React.useEffect`, do not invent one.
|
|
73
|
-
- If the file does not use API hooks, skip request grouping.
|
|
74
|
-
- If the file does not use
|
|
75
|
-
- If the file does not use `zustand`, do not create fake hook groupings just to fit the pattern.
|
|
73
|
+
- If the file does not use API hooks or async access logic, skip request grouping.
|
|
74
|
+
- If the file does not use one specific icon library, preserve the current icon approach instead of forcing a replacement.
|
|
75
|
+
- If the file does not use `zustand`, context hooks, or external hooks, do not create fake hook groupings just to fit the pattern.
|
|
76
76
|
- If there are no multiline imports, do not create them artificially.
|
|
77
77
|
- If the file already follows another stable organization style and reorganizing it would create churn without benefit, keep the file mostly as-is.
|
|
78
|
+
- If the file uses `fetch`, route handlers, server actions, service calls, or request helpers instead of hook-based data access, group them under the same "data access / requests" concept without forcing a specific library pattern.
|
|
78
79
|
|
|
79
80
|
---
|
|
80
81
|
|
|
@@ -106,15 +107,18 @@ import React from 'react' // always first
|
|
|
106
107
|
import Input from '@/components/commons/input'
|
|
107
108
|
import CpfMask from '@/masks/cpf.mask'
|
|
108
109
|
import useUserStore from '@/zustand/user.store'
|
|
110
|
+
import getUserLabel from '@/lib/user-label'
|
|
109
111
|
|
|
110
112
|
// mandatory blank line
|
|
111
113
|
|
|
112
114
|
// named imports with {} - smaller → larger by the content inside the braces
|
|
113
115
|
import { api } from '@/trpc/react'
|
|
116
|
+
import { revalidatePath } from 'next/cache'
|
|
114
117
|
import { toast } from 'sonner'
|
|
115
118
|
import { Button } from '@/components/ui/button'
|
|
116
119
|
import { useFormik } from 'formik'
|
|
117
120
|
import { Eye, EyeOff, Plus } from 'lucide-react'
|
|
121
|
+
import { useQuery } from '@tanstack/react-query'
|
|
118
122
|
|
|
119
123
|
// mandatory blank line
|
|
120
124
|
|
|
@@ -144,30 +148,27 @@ import * as Yup from 'yup'
|
|
|
144
148
|
|
|
145
149
|
```typescript
|
|
146
150
|
const Component: React.FC = () => {
|
|
147
|
-
// 1. React
|
|
151
|
+
// 1. React local hooks
|
|
148
152
|
const [showPassword, setShowPassword] = React.useState<boolean>(false)
|
|
149
153
|
const [loading, setLoading] = React.useState(false)
|
|
150
154
|
|
|
151
|
-
// 2.
|
|
155
|
+
// 2. external hooks / store hooks / context hooks
|
|
152
156
|
const { modalState, setModal } = useModalStore()
|
|
153
157
|
const { setLoading } = useLoadingStore()
|
|
154
158
|
const { dbUser } = useUserStore()
|
|
155
159
|
|
|
156
|
-
// 3.
|
|
157
|
-
// GET requests first
|
|
160
|
+
// 3. data hooks / requests / async access layer
|
|
158
161
|
const { data: users } = api.user.getAll.useQuery()
|
|
159
162
|
const { data: positions } = api.position.getAll.useQuery()
|
|
160
|
-
|
|
161
|
-
// mutation requests second
|
|
162
163
|
const { mutateAsync: createUser } = api.user.create.useMutation()
|
|
163
164
|
|
|
164
|
-
// 4.
|
|
165
|
+
// 4. form state
|
|
165
166
|
const formik = useFormik({ ... })
|
|
166
167
|
|
|
167
|
-
// 5. custom functions
|
|
168
|
+
// 5. derived values / custom functions / handlers
|
|
168
169
|
const handleSubmit = React.useMemo(() => { ... }, [])
|
|
169
170
|
|
|
170
|
-
// 6.
|
|
171
|
+
// 6. effects
|
|
171
172
|
React.useEffect(() => { ... }, [])
|
|
172
173
|
|
|
173
174
|
// 7. return
|
|
@@ -179,16 +180,15 @@ const Component: React.FC = () => {
|
|
|
179
180
|
|
|
180
181
|
## 3. Icon Rules
|
|
181
182
|
|
|
182
|
-
- Always use `size={}` instead of sizing only with `className`
|
|
183
183
|
- Never place icons inside buttons for this organization style
|
|
184
|
-
-
|
|
184
|
+
- If the file already uses an icon library consistently, preserve it instead of forcing a replacement
|
|
185
185
|
|
|
186
186
|
```typescript
|
|
187
|
-
//
|
|
188
|
-
<Eye
|
|
187
|
+
// preferred for this style
|
|
188
|
+
<Eye />
|
|
189
189
|
|
|
190
|
-
//
|
|
191
|
-
<button><Eye
|
|
190
|
+
// avoid this pattern in this organization style
|
|
191
|
+
<button><Eye /></button>
|
|
192
192
|
```
|
|
193
193
|
|
|
194
194
|
---
|
|
@@ -199,10 +199,13 @@ const Component: React.FC = () => {
|
|
|
199
199
|
- Always keep spacing between import groups
|
|
200
200
|
- Remove unused imports when clearly safe
|
|
201
201
|
- Remove commented code only when it is clearly dead noise and not useful documentation
|
|
202
|
+
- If section comments are kept after reorganization, rename them to generic and readable labels
|
|
203
|
+
- Prefer labels such as `React Hooks`, `External Hooks`, `Data Access / Requests`, `Form State`, `Custom Functions`, `Effects`
|
|
202
204
|
- Do not change behavior, only organize
|
|
203
205
|
- Follow the order even when some sections do not exist
|
|
204
206
|
- If a section does not exist in the file, skip it naturally
|
|
205
207
|
- If a rule conflicts with file safety, preserve safety first
|
|
208
|
+
- Organize by structural role in the file, not by forcing one exact technology choice
|
|
206
209
|
|
|
207
210
|
---
|
|
208
211
|
|
|
@@ -230,6 +233,43 @@ import { Eye, EyeOff } from 'lucide-react'
|
|
|
230
233
|
|
|
231
234
|
---
|
|
232
235
|
|
|
236
|
+
## Validation After Reorganization
|
|
237
|
+
|
|
238
|
+
After reorganizing the file, run the lightest relevant validation available in the project.
|
|
239
|
+
|
|
240
|
+
Preferred order:
|
|
241
|
+
|
|
242
|
+
1. `typecheck`
|
|
243
|
+
2. `lint`
|
|
244
|
+
3. `check`
|
|
245
|
+
|
|
246
|
+
If these scripts exist in `package.json`, prefer them in that order.
|
|
247
|
+
|
|
248
|
+
Examples:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
npm run typecheck
|
|
252
|
+
npm run lint
|
|
253
|
+
npm run check
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Rules:
|
|
257
|
+
|
|
258
|
+
- choose the most relevant and least destructive validation first
|
|
259
|
+
- do not invent commands that the project does not have
|
|
260
|
+
- if no validation script exists, say that the file was reorganized but no automatic validation was available
|
|
261
|
+
- if validation fails, report the failure clearly instead of pretending the reorganization is complete
|
|
262
|
+
- if validation fails because of the reorganization pass, read the error, fix the issue, and validate again
|
|
263
|
+
- only auto-fix issues that were introduced by the reorganization itself
|
|
264
|
+
- do not expand into unrelated project cleanup just because validation exposed older problems
|
|
265
|
+
- if the remaining failure is pre-existing or not clearly caused by the reorganization, stop and explain it clearly
|
|
266
|
+
|
|
267
|
+
Goal:
|
|
268
|
+
|
|
269
|
+
- confirm that the organization pass did not break imports, types, or basic project rules
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
233
273
|
## Execution Prompt
|
|
234
274
|
|
|
235
275
|
Use this command when applying the skill:
|
|
@@ -52,6 +52,9 @@ After all files have been overwritten, report back to the user with:
|
|
|
52
52
|
- Whether the IDE bridge was already handled by the CLI or whether `AGENTS.md` had to be created as fallback.
|
|
53
53
|
- Any gaps or missing information that could not be auto-detected and may need manual input.
|
|
54
54
|
|
|
55
|
+
The completion report shown in chat must follow the global language configured for the active LLM/environment.
|
|
56
|
+
The generated project artifacts and technical file contents may remain in technical English when appropriate.
|
|
57
|
+
|
|
55
58
|
---
|
|
56
59
|
|
|
57
60
|
> [!NOTE]
|