dev-booster 1.1.1 → 1.1.3

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": "dev-booster",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Reusable AI development kit with manual boosters, governance, and project bootstrap",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -0,0 +1,291 @@
1
+ ---
2
+ name: react-file-organization
3
+ description: Personal React and Next.js file organization style for restructuring imports, component sections, and local formatting without changing behavior.
4
+ allowed-tools: Read, Write, Edit
5
+ version: 1.0
6
+ priority: OPTIONAL
7
+ ---
8
+
9
+ # React File Organization
10
+
11
+ > **Optional personal skill** - Use this when the goal is to reorganize a React file according to a strict structural preference, without changing behavior.
12
+
13
+ ---
14
+
15
+ ## Goal
16
+
17
+ Organize a React file following the rules below.
18
+
19
+ **Do not change functionality.**
20
+ Only reorganize structure, imports, and presentation where the rules explicitly allow it.
21
+
22
+ This skill is intentionally opinionated and personal.
23
+ It is meant to make the file "feel right" for this specific organization style, not to enforce a universal best practice.
24
+
25
+ ---
26
+
27
+ ## Activation Behavior
28
+
29
+ If the user invokes this skill by name without clearly providing the target file:
30
+
31
+ - do not start reorganizing anything yet
32
+ - do not guess the file automatically
33
+ - confirm that the skill is ready
34
+ - ask which React file should be organized
35
+
36
+ Use a short response such as:
37
+
38
+ ```md
39
+ Skill `react-file-organization` loaded.
40
+
41
+ I can reorganize a React file using this personal structure style without changing behavior.
42
+
43
+ Which file should I organize?
44
+ ```
45
+
46
+ Only proceed after the user provides the target file or a clear file reference.
47
+
48
+ ---
49
+
50
+ ## Safe Operating Mode
51
+
52
+ Apply this skill only when all of the following are true:
53
+
54
+ - the target is clearly a React file (`.tsx`, `.jsx`, or a React component file)
55
+ - the file can be reorganized without changing runtime behavior
56
+ - hooks, requests, and local declarations are already at top level of the component body
57
+ - the requested change is organizational, not functional
58
+
59
+ If the file does **not** fit this structure:
60
+ - do **not** force the full pattern
61
+ - do **not** invent missing sections
62
+ - do **not** convert APIs or libraries
63
+ - do **not** move code in a way that changes execution order or semantics
64
+
65
+ If there is any real risk of behavioral change, stop and explain which part is unsafe to reorder.
66
+
67
+ ---
68
+
69
+ ## Applicability Rules
70
+
71
+ - If the file does not use `Formik`, skip the `Formik` section entirely.
72
+ - If the file does not use `React.useEffect`, do not invent one.
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
+ - If there are no multiline imports, do not create them artificially.
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.
79
+
80
+ ---
81
+
82
+ ## Hard Safety Stops
83
+
84
+ Do **not** use this skill to:
85
+
86
+ - rewrite business logic
87
+ - rename functions, variables, or props unless strictly required for organization and clearly safe
88
+ - convert component style (`function` ↔ `const`)
89
+ - change hook dependencies
90
+ - move hooks across conditional logic
91
+ - move declarations in ways that can affect hoisting, closures, or side effects
92
+ - remove comments that carry important business or implementation context
93
+ - delete code unless it is clearly unused import noise or dead commented-out code with no project value
94
+
95
+ When in doubt, prefer partial organization over risky cleanup.
96
+
97
+ ---
98
+
99
+ ## 1. Import Structure
100
+
101
+ ```typescript
102
+ import React from 'react' // always first
103
+
104
+ // mandatory blank line
105
+
106
+ // default imports (without {}) - smaller → larger by the imported identifier
107
+ import Input from '@/components/commons/input'
108
+ import CpfMask from '@/masks/cpf.mask'
109
+ import useUserStore from '@/zustand/user.store'
110
+ import getUserLabel from '@/lib/user-label'
111
+
112
+ // mandatory blank line
113
+
114
+ // named imports with {} - smaller → larger by the content inside the braces
115
+ import { api } from '@/trpc/react'
116
+ import { revalidatePath } from 'next/cache'
117
+ import { toast } from 'sonner'
118
+ import { Button } from '@/components/ui/button'
119
+ import { useFormik } from 'formik'
120
+ import { Eye, EyeOff, Plus } from 'lucide-react'
121
+ import { useQuery } from '@tanstack/react-query'
122
+
123
+ // mandatory blank line
124
+
125
+ // multiline imports - each block separated by a blank line
126
+ import {
127
+ Select,
128
+ SelectContent,
129
+ SelectItem,
130
+ } from '@/components/ui/select'
131
+
132
+ // mandatory blank line
133
+
134
+ import {
135
+ Dialog,
136
+ DialogContent,
137
+ } from '@/components/ui/dialog'
138
+
139
+ // mandatory blank line
140
+
141
+ // imports with * or type - always last
142
+ import * as Yup from 'yup'
143
+ ```
144
+
145
+ ---
146
+
147
+ ## 2. Internal Component Structure
148
+
149
+ ```typescript
150
+ const Component: React.FC = () => {
151
+ // 1. React local hooks
152
+ const [showPassword, setShowPassword] = React.useState<boolean>(false)
153
+ const [loading, setLoading] = React.useState(false)
154
+
155
+ // 2. external hooks / store hooks / context hooks
156
+ const { modalState, setModal } = useModalStore()
157
+ const { setLoading } = useLoadingStore()
158
+ const { dbUser } = useUserStore()
159
+
160
+ // 3. data hooks / requests / async access layer
161
+ const { data: users } = api.user.getAll.useQuery()
162
+ const { data: positions } = api.position.getAll.useQuery()
163
+ const { mutateAsync: createUser } = api.user.create.useMutation()
164
+
165
+ // 4. form state
166
+ const formik = useFormik({ ... })
167
+
168
+ // 5. derived values / custom functions / handlers
169
+ const handleSubmit = React.useMemo(() => { ... }, [])
170
+
171
+ // 6. effects
172
+ React.useEffect(() => { ... }, [])
173
+
174
+ // 7. return
175
+ return (...)
176
+ }
177
+ ```
178
+
179
+ ---
180
+
181
+ ## 3. Icon Rules
182
+
183
+ - Never place icons inside buttons for this organization style
184
+ - If the file already uses an icon library consistently, preserve it instead of forcing a replacement
185
+
186
+ ```typescript
187
+ // preferred for this style
188
+ <Eye />
189
+
190
+ // avoid this pattern in this organization style
191
+ <button><Eye /></button>
192
+ ```
193
+
194
+ ---
195
+
196
+ ## 4. General Rules
197
+
198
+ - Always respond in Portuguese
199
+ - Always keep spacing between import groups
200
+ - Remove unused imports when clearly safe
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`
204
+ - Do not change behavior, only organize
205
+ - Follow the order even when some sections do not exist
206
+ - If a section does not exist in the file, skip it naturally
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
209
+
210
+ ---
211
+
212
+ ## 5. Sorting Criteria
213
+
214
+ ### Default Imports
215
+
216
+ Count the imported identifier before `from`:
217
+
218
+ ```typescript
219
+ import Input from '@/components/commons/input'
220
+ import useModalStore from '@/zustand/modal.store'
221
+ import useLoadingStore from '@/zustand/loading.store'
222
+ ```
223
+
224
+ ### Named Imports
225
+
226
+ Count the content inside `{}`:
227
+
228
+ ```typescript
229
+ import { api } from '@/trpc/react'
230
+ import { Button } from '@/components/ui/button'
231
+ import { Eye, EyeOff } from 'lucide-react'
232
+ ```
233
+
234
+ ---
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
+
273
+ ## Execution Prompt
274
+
275
+ Use this command when applying the skill:
276
+
277
+ **"Organize this React file following exactly all rules from the prompt above. Do not change behavior, only reorganize."**
278
+
279
+ If needed, you may also use this safer variant:
280
+
281
+ **"Organize this React file using the react-file-organization skill. Apply the style only where it is safe, skip missing sections naturally, and do not change behavior."**
282
+
283
+ ---
284
+
285
+ ## Notes
286
+
287
+ - This skill is intentionally opinionated.
288
+ - It is not a global Dev Booster rule.
289
+ - It should not be auto-loaded by any booster.
290
+ - Use it only when this exact organization style is desired.
291
+ - Prefer making the user happy over forcing mechanical symmetry.