@dedesfr/prompter 0.7.7 → 0.7.9

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 (53) hide show
  1. package/.claude/settings.local.json +7 -0
  2. package/CHANGELOG.md +19 -0
  3. package/dist/cli/index.js +1 -1
  4. package/dist/commands/init.d.ts +1 -0
  5. package/dist/commands/init.d.ts.map +1 -1
  6. package/dist/commands/init.js +65 -1
  7. package/dist/commands/init.js.map +1 -1
  8. package/dist/core/config.d.ts.map +1 -1
  9. package/dist/core/config.js +3 -1
  10. package/dist/core/config.js.map +1 -1
  11. package/dist/core/configurators/slash/droid.d.ts +9 -0
  12. package/dist/core/configurators/slash/droid.d.ts.map +1 -0
  13. package/dist/core/configurators/slash/droid.js +36 -0
  14. package/dist/core/configurators/slash/droid.js.map +1 -0
  15. package/dist/core/configurators/slash/forge.d.ts +9 -0
  16. package/dist/core/configurators/slash/forge.d.ts.map +1 -0
  17. package/dist/core/configurators/slash/forge.js +36 -0
  18. package/dist/core/configurators/slash/forge.js.map +1 -0
  19. package/dist/core/configurators/slash/index.d.ts +2 -0
  20. package/dist/core/configurators/slash/index.d.ts.map +1 -1
  21. package/dist/core/configurators/slash/index.js +2 -0
  22. package/dist/core/configurators/slash/index.js.map +1 -1
  23. package/dist/core/configurators/slash/registry.d.ts.map +1 -1
  24. package/dist/core/configurators/slash/registry.js +6 -0
  25. package/dist/core/configurators/slash/registry.js.map +1 -1
  26. package/dist/core/templates/claude-template.d.ts +2 -0
  27. package/dist/core/templates/claude-template.d.ts.map +1 -0
  28. package/dist/core/templates/claude-template.js +3 -0
  29. package/dist/core/templates/claude-template.js.map +1 -0
  30. package/dist/core/templates/index.d.ts +1 -0
  31. package/dist/core/templates/index.d.ts.map +1 -1
  32. package/dist/core/templates/index.js +1 -0
  33. package/dist/core/templates/index.js.map +1 -1
  34. package/package.json +1 -1
  35. package/skills/design-system-generator/SKILL.md +324 -0
  36. package/skills/design-system-generator/assets/design-system-template.md +348 -0
  37. package/skills/design-system-generator/references/extraction-patterns.md +321 -0
  38. package/skills/laravel-code-review/SKILL.md +383 -0
  39. package/skills/laravel-code-review/assets/report-template-agent.md +195 -0
  40. package/skills/laravel-code-review/assets/report-template-compact.md +79 -0
  41. package/skills/laravel-code-review/assets/report-template-full.md +253 -0
  42. package/skills/laravel-code-review/assets/report-template-human.md +159 -0
  43. package/skills/laravel-code-review/references/laravel-patterns.md +571 -0
  44. package/skills/laravel-code-review/references/php84-features.md +442 -0
  45. package/src/cli/index.ts +1 -1
  46. package/src/commands/init.ts +67 -1
  47. package/src/core/config.ts +3 -1
  48. package/src/core/configurators/slash/droid.ts +40 -0
  49. package/src/core/configurators/slash/forge.ts +40 -0
  50. package/src/core/configurators/slash/index.ts +2 -0
  51. package/src/core/configurators/slash/registry.ts +6 -0
  52. package/src/core/templates/claude-template.ts +2 -0
  53. package/src/core/templates/index.ts +1 -0
@@ -0,0 +1,321 @@
1
+ # Extraction Patterns Reference
2
+
3
+ Mapping rules and regex patterns for extracting design tokens from CSS, HTML, React, and Tailwind sources.
4
+
5
+ ---
6
+
7
+ ## CSS Custom Properties
8
+
9
+ Extract all `--` prefixed declarations from `:root`, `html`, `body`, or theme selectors.
10
+
11
+ ```regex
12
+ --[\w-]+\s*:\s*[^;]+
13
+ ```
14
+
15
+ Group by prefix conventions:
16
+ - `--color-*`, `--c-*` → Colors
17
+ - `--font-*`, `--text-*`, `--fs-*` → Typography
18
+ - `--space-*`, `--spacing-*`, `--gap-*` → Spacing
19
+ - `--radius-*`, `--rounded-*`, `--br-*` → Border Radii
20
+ - `--shadow-*`, `--elevation-*` → Shadows
21
+ - `--z-*`, `--zindex-*` → Z-Index
22
+ - `--duration-*`, `--transition-*`, `--ease-*` → Transitions
23
+
24
+ ---
25
+
26
+ ## Color Extraction
27
+
28
+ ### From CSS declarations
29
+
30
+ Target properties:
31
+ ```
32
+ color, background-color, background, border-color, outline-color,
33
+ fill, stroke, text-decoration-color, accent-color, caret-color,
34
+ box-shadow (color component), --*-color
35
+ ```
36
+
37
+ ### Color format normalization
38
+
39
+ Convert all formats to hex with HSL annotation:
40
+ - `#RGB` → expand to `#RRGGBB`
41
+ - `rgb(R, G, B)` → convert to hex
42
+ - `rgba(R, G, B, A)` → note alpha separately
43
+ - `hsl(H, S%, L%)` → convert to hex, keep HSL as annotation
44
+ - `oklch(L C H)` → convert to hex equivalent
45
+ - Named colors (`red`, `blue`) → convert to hex
46
+
47
+ ### Semantic color grouping heuristics
48
+
49
+ | CSS Pattern | Likely Category |
50
+ |-------------|----------------|
51
+ | `--primary*`, `--brand*`, `--accent*` | Primary/Accent |
52
+ | `--secondary*` | Secondary |
53
+ | `--gray*`, `--grey*`, `--neutral*`, `--slate*` | Neutral |
54
+ | `--success*`, `--green*`, `--positive*` | Success |
55
+ | `--warning*`, `--yellow*`, `--amber*`, `--caution*` | Warning |
56
+ | `--error*`, `--red*`, `--danger*`, `--destructive*` | Error |
57
+ | `--info*`, `--blue*` | Info |
58
+ | `--bg*`, `--background*`, `--surface*` | Surface |
59
+ | `--text*`, `--fg*`, `--foreground*` | Text |
60
+
61
+ ### Color scale detection
62
+
63
+ If multiple shades of the same hue exist, sort by lightness and assign scale numbers:
64
+ - Lightest → 50
65
+ - Darkest → 950
66
+ - Map intermediate values to nearest: 100, 200, 300, 400, 500, 600, 700, 800, 900
67
+
68
+ ---
69
+
70
+ ## Typography Extraction
71
+
72
+ ### Font family detection
73
+
74
+ Target properties: `font-family`, `--font-*`
75
+
76
+ Classify by usage:
77
+ - Serif/Sans-serif → heading or body
78
+ - Monospace → code/mono
79
+ - If only one family found → assign to both heading + body
80
+
81
+ ### Font size scale building
82
+
83
+ Target properties: `font-size`, `--text-*`, `--fs-*`
84
+
85
+ 1. Collect all unique `font-size` values
86
+ 2. Sort ascending
87
+ 3. Map to scale:
88
+
89
+ | Range (px) | Token |
90
+ |-----------|-------|
91
+ | 10–11 | `xs` |
92
+ | 12–13 | `sm` |
93
+ | 14–16 | `base` |
94
+ | 17–19 | `lg` |
95
+ | 20–23 | `xl` |
96
+ | 24–29 | `2xl` |
97
+ | 30–35 | `3xl` |
98
+ | 36+ | `4xl` |
99
+
100
+ ### Font weight mapping
101
+
102
+ Collect all `font-weight` values. Map to named tokens:
103
+ - `100` → thin, `200` → extralight, `300` → light
104
+ - `400` → normal, `500` → medium, `600` → semibold
105
+ - `700` → bold, `800` → extrabold, `900` → black
106
+
107
+ ---
108
+
109
+ ## Spacing Extraction
110
+
111
+ ### Collecting spacing values
112
+
113
+ Target properties:
114
+ ```
115
+ margin, margin-top/right/bottom/left,
116
+ padding, padding-top/right/bottom/left,
117
+ gap, row-gap, column-gap, grid-gap,
118
+ top, right, bottom, left (when used for spacing)
119
+ ```
120
+
121
+ ### Base unit detection
122
+
123
+ 1. Collect all spacing values
124
+ 2. Find GCD (Greatest Common Divisor) of the most common values
125
+ 3. Typical base units: `4px`, `8px`
126
+ 4. If values follow `4, 8, 12, 16, 20, 24, 32` → base = 4px
127
+ 5. If values follow `8, 16, 24, 32, 40, 48, 64` → base = 8px
128
+
129
+ ### Scale normalization
130
+
131
+ Sort unique values and assign multipliers relative to base:
132
+ ```
133
+ 0px → space-0 (0×)
134
+ 4px → space-1 (1×)
135
+ 8px → space-2 (2×)
136
+ 12px → space-3 (3×)
137
+ 16px → space-4 (4×)
138
+ ...
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Border & Radius Extraction
144
+
145
+ ### Border radius values
146
+
147
+ Target: `border-radius`, `border-*-radius`, `--radius-*`
148
+
149
+ Map to scale:
150
+ | Range (px) | Token |
151
+ |-----------|-------|
152
+ | 0 | `none` |
153
+ | 1–3 | `sm` |
154
+ | 4–7 | `md` |
155
+ | 8–11 | `lg` |
156
+ | 12–15 | `xl` |
157
+ | 16+ | `2xl` |
158
+ | 9999px, 50% | `full` |
159
+
160
+ ---
161
+
162
+ ## Shadow Extraction
163
+
164
+ Target: `box-shadow`, `text-shadow`, `--shadow-*`
165
+
166
+ Parse shadow values into components:
167
+ ```
168
+ box-shadow: <offset-x> <offset-y> <blur> <spread> <color>
169
+ ```
170
+
171
+ Map to elevation scale by blur radius:
172
+ | Blur (px) | Token |
173
+ |----------|-------|
174
+ | 1–4 | `sm` |
175
+ | 5–10 | `md` |
176
+ | 11–20 | `lg` |
177
+ | 21+ | `xl` |
178
+ | `inset` keyword | `inner` |
179
+
180
+ ---
181
+
182
+ ## Breakpoint Extraction
183
+
184
+ Target: `@media` queries with `min-width` or `max-width`
185
+
186
+ ```regex
187
+ @media\s*\([^)]*(?:min|max)-width\s*:\s*([\d.]+(?:px|em|rem))[^)]*\)
188
+ ```
189
+
190
+ Common breakpoint conventions:
191
+ | Value | Token |
192
+ |-------|-------|
193
+ | 640px / 40em | `sm` |
194
+ | 768px / 48em | `md` |
195
+ | 1024px / 64em | `lg` |
196
+ | 1280px / 80em | `xl` |
197
+ | 1536px / 96em | `2xl` |
198
+
199
+ ---
200
+
201
+ ## Transition Extraction
202
+
203
+ Target: `transition`, `transition-duration`, `transition-timing-function`, `animation-duration`
204
+
205
+ ### Duration bucketing
206
+
207
+ | Range (ms) | Token |
208
+ |-----------|-------|
209
+ | 50–100 | `fast` |
210
+ | 150–300 | `normal` |
211
+ | 300–500 | `slow` |
212
+
213
+ ### Easing classification
214
+
215
+ | Value | Token |
216
+ |-------|-------|
217
+ | `ease` | `default` |
218
+ | `ease-in`, `cubic-bezier(0.4, 0, 1, 1)` | `in` |
219
+ | `ease-out`, `cubic-bezier(0, 0, 0.2, 1)` | `out` |
220
+ | `ease-in-out`, `cubic-bezier(0.4, 0, 0.2, 1)` | `in-out` |
221
+
222
+ ---
223
+
224
+ ## Z-Index Extraction
225
+
226
+ Target: `z-index`, `--z-*`
227
+
228
+ ### Semantic assignment heuristics
229
+
230
+ Assign names based on context (selector or class name):
231
+ | Selector Pattern | Token |
232
+ |-----------------|-------|
233
+ | `.dropdown*`, `.menu*`, `.select*` | `dropdown` |
234
+ | `.sticky*`, `.fixed-header*` | `sticky` |
235
+ | `.overlay*`, `.backdrop*` | `overlay` |
236
+ | `.modal*`, `.dialog*` | `modal` |
237
+ | `.popover*`, `.tooltip*` | `popover` |
238
+ | `.toast*`, `.notification*`, `.snackbar*` | `toast` |
239
+
240
+ ---
241
+
242
+ ## Tailwind Class Extraction
243
+
244
+ When input uses Tailwind utility classes, map classes to tokens:
245
+
246
+ ### Color classes
247
+ ```regex
248
+ (?:bg|text|border|ring|fill|stroke)-(?:[\w]+-)?(?:\d{2,3}|black|white)
249
+ ```
250
+ Map to theme colors via `tailwind.config.js` or default palette.
251
+
252
+ ### Spacing classes
253
+ ```regex
254
+ (?:m|p|gap|space-[xy])-(?:\d+(?:\.\d+)?|px|auto)
255
+ ```
256
+ Convert Tailwind spacing units: multiply by 4px (default).
257
+
258
+ ### Typography classes
259
+ ```regex
260
+ (?:text|font|leading|tracking)-(?:xs|sm|base|lg|xl|[\d]xl|thin|light|normal|medium|semibold|bold|extrabold|black|tight|snug|normal|relaxed|loose|tighter|wider)
261
+ ```
262
+
263
+ ### Border/Radius classes
264
+ ```regex
265
+ rounded(?:-(?:sm|md|lg|xl|2xl|3xl|full|none))?
266
+ border(?:-(?:\d+))?
267
+ ```
268
+
269
+ ---
270
+
271
+ ## React/JSX Pattern Extraction
272
+
273
+ ### Styled-components / Emotion
274
+
275
+ Extract template literals from `styled.*` or `css` tagged templates:
276
+ ```regex
277
+ styled\.(\w+)`([^`]*)`
278
+ css`([^`]*)`
279
+ ```
280
+
281
+ ### Style objects
282
+
283
+ Extract from `style={{ }}` JSX attributes:
284
+ ```regex
285
+ style=\{\{([^}]*)\}\}
286
+ ```
287
+
288
+ Convert camelCase properties to kebab-case for token extraction.
289
+
290
+ ### Theme objects
291
+
292
+ Look for theme/token files:
293
+ - `theme.ts`, `theme.js`, `tokens.ts`, `tokens.js`
294
+ - `ThemeProvider` usage pointing to theme config
295
+ - `createTheme()`, `extendTheme()` calls
296
+
297
+ Extract nested token objects and flatten to design tokens.
298
+
299
+ ---
300
+
301
+ ## Dark Mode Detection
302
+
303
+ ### CSS strategies
304
+ - `@media (prefers-color-scheme: dark)` blocks
305
+ - `.dark` class selector overrides
306
+ - `[data-theme="dark"]` attribute selectors
307
+
308
+ ### Tailwind dark mode
309
+ - `dark:` prefix classes
310
+ - Check `darkMode` config in `tailwind.config.js`
311
+
312
+ When dark mode is detected, create a parallel token set documenting both light and dark values.
313
+
314
+ ---
315
+
316
+ ## Deduplication Rules
317
+
318
+ 1. **Near-identical colors**: Merge colors within ΔE < 3 (perceptual difference). Keep the more frequently used value.
319
+ 2. **Similar spacing**: If two values differ by ≤1px, keep the one that fits the base unit grid.
320
+ 3. **Duplicate fonts**: Same family with different quoting → keep one.
321
+ 4. **Shadow variants**: If two shadows only differ by color, document as one shadow with color token reference.
@@ -0,0 +1,383 @@
1
+ ---
2
+ name: laravel-code-review
3
+ description: Perform static code review on git staged files for Laravel 12 + PHP 8.4 projects. Identifies Laravel-specific issues like N+1 queries, missing validation, security vulnerabilities, Eloquent anti-patterns, and PHP 8.4 best practices. Outputs structured Markdown report to test-hunter/ folder. Use when reviewing Laravel code before commit, or with /laravel-code-review command.
4
+ ---
5
+
6
+ # Laravel 12 + PHP 8.4 Code Review
7
+
8
+ Perform specialized static analysis on staged git files for Laravel 12 projects running PHP 8.4.
9
+
10
+ ## Quick Start
11
+
12
+ 1. **ASK USER** which review style to use (Strict/Balanced/Lenient) - Balanced is default
13
+ 2. **ASK USER** which report format to use (Full/Human/Compact/Agent)
14
+ 3. Get staged files: `git diff --cached --name-only`
15
+ 4. Analyze each file based on selected review style and focus areas
16
+ 5. Generate report using selected format to `test-hunter/laravel-issues-<timestamp>.md`
17
+
18
+ ---
19
+
20
+ ## Step 0a: Ask User for Review Style (REQUIRED)
21
+
22
+ **IMPORTANT:** Before proceeding with any analysis, you MUST ask the user which review style they prefer.
23
+
24
+ Present the following options to the user:
25
+
26
+ ```
27
+ Which review style would you like? (Default: Balanced)
28
+
29
+ 1. **Strict** 🔒
30
+ Flag all potential issues, prioritize quality and security
31
+
32
+ Focus Areas:
33
+ ✅ Security vulnerabilities (SQL injection, XSS, mass assignment, etc.)
34
+ ✅ Performance issues (N+1 queries, missing indexes, inefficient loops)
35
+ ✅ Bug detection (Logic errors, edge cases, runtime errors)
36
+ ✅ Code style (PSR-12, naming conventions, Laravel conventions)
37
+ ✅ Test coverage (Missing or inadequate tests)
38
+ ✅ Documentation (Missing PHPDoc, unclear APIs)
39
+
40
+ 2. **Balanced** ⚖️ (Default)
41
+ Focus on high-confidence issues, balance thoroughness with practicality
42
+
43
+ Focus Areas:
44
+ ✅ Security vulnerabilities (SQL injection, XSS, mass assignment, etc.)
45
+ ✅ Performance issues (N+1 queries, missing indexes, inefficient loops)
46
+ ✅ Bug detection (Logic errors, edge cases, runtime errors)
47
+ ⚪ Code style (Only major violations)
48
+ ⚪ Test coverage (Critical paths only)
49
+ ❌ Documentation
50
+
51
+ 3. **Lenient** 💚
52
+ Only critical bugs and security issues, be encouraging
53
+
54
+ Focus Areas:
55
+ ✅ Security vulnerabilities (Critical only)
56
+ ⚪ Performance issues (Severe bottlenecks only)
57
+ ✅ Bug detection (Critical bugs only)
58
+ ❌ Code style
59
+ ❌ Test coverage
60
+ ❌ Documentation
61
+
62
+ Please select (1-3) or type the style name, or press Enter for Balanced:
63
+ ```
64
+
65
+ **Wait for user response before continuing. If no response or Enter, use Balanced.**
66
+
67
+ ### Review Style to Focus Areas Mapping
68
+
69
+ | Focus Area | Strict | Balanced | Lenient |
70
+ | ---------------------------- | ---------- | ---------------- | ------------------ |
71
+ | **Security vulnerabilities** | All issues | All issues | Critical only |
72
+ | **Performance issues** | All issues | All issues | Severe bottlenecks |
73
+ | **Bug detection** | All issues | High confidence | Critical only |
74
+ | **Code style** | All issues | Major violations | ❌ Skip |
75
+ | **Test coverage** | All issues | Critical paths | ❌ Skip |
76
+ | **Documentation** | All issues | ❌ Skip | ❌ Skip |
77
+
78
+ ### Severity Threshold by Style
79
+
80
+ | Style | Report Threshold | Tone |
81
+ | -------- | --------------------- | ----------------------- |
82
+ | Strict | All severities (🔴🟠🟡🔵) | Direct, thorough |
83
+ | Balanced | Warning+ (🔴🟠🟡) | Constructive, practical |
84
+ | Lenient | Critical only (🔴) | Encouraging, supportive |
85
+
86
+ ---
87
+
88
+ ## Step 0b: Ask User for Report Format (REQUIRED)
89
+
90
+ Present the following options to the user:
91
+
92
+ ```
93
+ Which report format would you like for the code review?
94
+
95
+ 1. **Full** - Complete detailed analysis (~200-300 lines per file)
96
+ - All issue details with code snippets
97
+ - Suggested fixes with full code examples
98
+ - Machine-readable JSON blocks
99
+ - Component-based organization
100
+
101
+ 2. **Human** - Optimized for readability (~50-80 lines per file)
102
+ - Clean, scannable format
103
+ - Grouped by severity with clear headers
104
+ - Brief descriptions with line references
105
+ - Quick action items
106
+
107
+ 3. **Compact** - Condensed summary (~15-25 lines per file)
108
+ - One-line per issue format
109
+ - Essential info only: file, line, severity, issue
110
+ - Summary statistics
111
+ - Ideal for quick reviews
112
+
113
+ 4. **Agent** - Machine-readable for AI tools (~30-50 lines per file)
114
+ - Task-based checklist format
115
+ - Structured for automated processing
116
+ - Executable tasks with status tracking
117
+ - Ideal for CI/CD integration
118
+
119
+ Please select (1-4) or type the format name:
120
+ ```
121
+
122
+ **Wait for user response before continuing.**
123
+
124
+ ---
125
+
126
+ ## Workflow
127
+
128
+ ### Step 1: Retrieve Staged Files
129
+
130
+ ```bash
131
+ git diff --cached --name-only
132
+ ```
133
+
134
+ Filter for relevant file types:
135
+ - `*.php` - PHP source files
136
+ - `*.blade.php` - Blade templates
137
+ - `routes/*.php` - Route definitions
138
+ - `config/*.php` - Configuration files
139
+ - `database/migrations/*.php` - Migrations
140
+ - `database/factories/*.php` - Factories
141
+ - `database/seeders/*.php` - Seeders
142
+
143
+ ### Step 2: Categorize Files
144
+
145
+ Group files by Laravel component:
146
+ - **Controllers** - `app/Http/Controllers/`
147
+ - **Models** - `app/Models/`
148
+ - **Services** - `app/Services/`
149
+ - **Repositories** - `app/Repositories/`
150
+ - **Requests** - `app/Http/Requests/`
151
+ - **Resources** - `app/Http/Resources/`
152
+ - **Middleware** - `app/Http/Middleware/`
153
+ - **Commands** - `app/Console/Commands/`
154
+ - **Jobs** - `app/Jobs/`
155
+ - **Events/Listeners** - `app/Events/`, `app/Listeners/`
156
+ - **Policies** - `app/Policies/`
157
+ - **Rules** - `app/Rules/`
158
+ - **Views** - `resources/views/`
159
+ - **Routes** - `routes/`
160
+ - **Migrations** - `database/migrations/`
161
+ - **Config** - `config/`
162
+ - **Tests** - `tests/` (review only, no execution)
163
+
164
+ ### Step 3: Analyze Each File
165
+
166
+ **Apply Review Style Filter:** Based on the user's selected review style, filter issues according to the mapping table in Step 0a.
167
+
168
+ | Review Style | Include These Severities | Focus On |
169
+ | ------------ | ------------------------ | --------------------------------------------- |
170
+ | **Strict** | 🔴🟠🟡🔵 All | All focus areas, flag everything |
171
+ | **Balanced** | 🔴🟠🟡 Warning+ | Security, Performance, Bugs, Major code style |
172
+ | **Lenient** | 🔴 Critical only | Security vulnerabilities, Critical bugs |
173
+
174
+ Review for these Laravel/PHP 8.4 specific issues (filtered by review style):
175
+
176
+ #### 🔴 Critical Issues
177
+
178
+ **Security Vulnerabilities:**
179
+ - Mass assignment without `$fillable` or `$guarded`
180
+ - Raw SQL queries without parameter binding
181
+ - Missing CSRF protection
182
+ - Unvalidated user input
183
+ - Exposed sensitive data in responses
184
+ - Hardcoded credentials/secrets
185
+ - Missing authorization checks
186
+ - XSS in Blade (unescaped `{!! !!}` with user data)
187
+
188
+ **Runtime Errors:**
189
+ - Missing model relationships
190
+ - Undefined route names
191
+ - Missing middleware
192
+ - Invalid dependency injection
193
+ - Missing return types (PHP 8.4 strict)
194
+
195
+ #### 🟠 Warning Issues
196
+
197
+ **Eloquent Anti-patterns:**
198
+ - N+1 query problems (missing `with()`, `load()`)
199
+ - Using `get()` when `first()` or `find()` is appropriate
200
+ - Missing `select()` for large queries
201
+ - Chunking not used for large datasets
202
+ - Missing indexes on frequently queried columns
203
+
204
+ **Laravel Convention Violations:**
205
+ - Fat controllers (logic should be in services)
206
+ - Missing Form Request validation
207
+ - Direct `$request->all()` usage
208
+ - Missing API Resources for responses
209
+ - Improper exception handling
210
+
211
+ **PHP 8.4 Deprecations:**
212
+ - Implicit nullable parameters
213
+ - Dynamic properties on classes
214
+ - `${var}` string interpolation (use `{$var}`)
215
+
216
+ #### 🟡 Optimization Issues
217
+
218
+ **Performance:**
219
+ - Eager loading missing
220
+ - Caching not utilized
221
+ - Queue not used for heavy operations
222
+ - Missing database indexes
223
+ - Inefficient collection operations
224
+
225
+ **Query Optimization:**
226
+ - `whereIn()` with large arrays
227
+ - Missing `limit()` on queries
228
+ - `pluck()` after `get()` (use direct `pluck()`)
229
+ - `count()` after `get()` (use `count()` query)
230
+
231
+ #### 🔵 Code Quality Issues
232
+
233
+ **PHP 8.4 Best Practices:**
234
+ - Missing constructor property promotion
235
+ - Not using named arguments where beneficial
236
+ - Missing `readonly` properties
237
+ - Not using `match` expression
238
+ - Missing union/intersection types
239
+ - Not using `#[Override]` attribute
240
+
241
+ **Laravel 12 Standards:**
242
+ - Missing method return types
243
+ - Incorrect PHPDoc annotations
244
+ - Not using Invokable controllers for single-action
245
+ - Missing enum for status constants
246
+ - Not using Laravel Pint formatting
247
+
248
+ ### Step 4: Generate Report
249
+
250
+ ```bash
251
+ mkdir -p test-hunter
252
+ ```
253
+
254
+ Filename: `laravel-issues-YYYY-MM-DD-HHMMSS.md`
255
+
256
+ ### Step 5: Write Report
257
+
258
+ Use structured format with Laravel-specific context:
259
+
260
+ ```markdown
261
+ # Laravel Code Review Report
262
+
263
+ **Generated:** <timestamp>
264
+ **Review Style:** <Strict|Balanced|Lenient>
265
+ **Laravel Version:** 12.x
266
+ **PHP Version:** 8.4
267
+ **Reviewed Files:** <count>
268
+ **Total Issues:** <count>
269
+
270
+ ---
271
+
272
+ ## Summary
273
+
274
+ | Severity | Count |
275
+ | -------------- | ----- |
276
+ | 🔴 Critical | X |
277
+ | 🟠 Warning | X |
278
+ | 🟡 Optimization | X |
279
+ | 🔵 Code Quality | X |
280
+
281
+ ---
282
+
283
+ ## Issues by Component
284
+
285
+ ### Controllers
286
+
287
+ #### `App\Http\Controllers\UserController`
288
+
289
+ ##### Issue 1: N+1 Query Problem
290
+
291
+ | Attribute | Value |
292
+ | ------------ | ----------------------------------------- |
293
+ | **Severity** | 🟠 Warning |
294
+ | **Line** | 25 |
295
+ | **Type** | Eloquent Anti-pattern |
296
+ | **File** | `app/Http/Controllers/UserController.php` |
297
+
298
+ **Description:**
299
+ Loading users without eager loading their posts causes N+1 queries.
300
+
301
+ **Code:**
302
+ ```php
303
+ // Line 25
304
+ $users = User::all();
305
+ foreach ($users as $user) {
306
+ echo $user->posts->count(); // N+1!
307
+ }
308
+ ```
309
+
310
+ **Recommendation:**
311
+ Use eager loading to prevent N+1 queries.
312
+
313
+ **Suggested Fix:**
314
+ ```php
315
+ $users = User::with('posts')->get();
316
+ foreach ($users as $user) {
317
+ echo $user->posts->count();
318
+ }
319
+ ```
320
+
321
+ **Laravel Docs:** [Eager Loading](https://laravel.com/docs/12.x/eloquent-relationships#eager-loading)
322
+
323
+ ---
324
+
325
+ <!-- MACHINE_READABLE_START
326
+ {
327
+ "file": "app/Http/Controllers/UserController.php",
328
+ "line": 25,
329
+ "severity": "warning",
330
+ "type": "eloquent-antipattern",
331
+ "category": "n-plus-one",
332
+ "description": "N+1 query problem",
333
+ "recommendation": "Use eager loading with with()",
334
+ "laravel_docs": "eloquent-relationships#eager-loading"
335
+ }
336
+ MACHINE_READABLE_END -->
337
+ ```
338
+
339
+ ## Issue Categories Reference
340
+
341
+ ### Security
342
+ - `mass-assignment` - Missing $fillable/$guarded
343
+ - `sql-injection` - Raw queries without binding
344
+ - `xss` - Unescaped output
345
+ - `csrf` - Missing CSRF protection
346
+ - `authorization` - Missing policy/gate checks
347
+
348
+ ### Eloquent
349
+ - `n-plus-one` - Missing eager loading
350
+ - `inefficient-query` - Suboptimal query patterns
351
+ - `missing-relationship` - Undefined relationships
352
+ - `mass-assignment` - Unsafe mass assignment
353
+
354
+ ### PHP 8.4
355
+ - `deprecation` - Using deprecated features
356
+ - `type-safety` - Missing type declarations
357
+ - `modern-syntax` - Not using modern PHP features
358
+
359
+ ### Laravel Conventions
360
+ - `fat-controller` - Too much logic in controller
361
+ - `validation` - Missing or improper validation
362
+ - `resource` - Missing API Resource
363
+ - `naming` - Convention violations
364
+
365
+ ## Output Location
366
+
367
+ Save to: `<project-root>/test-hunter/laravel-issues-<timestamp>.md`
368
+
369
+ ## Report Format Templates
370
+
371
+ Based on user selection, use the appropriate template:
372
+
373
+ | Format | Template File | Use Case |
374
+ | ------- | ----------------------------------- | -------------------------- |
375
+ | Full | `assets/report-template-full.md` | Comprehensive review |
376
+ | Human | `assets/report-template-human.md` | Developer-friendly reading |
377
+ | Compact | `assets/report-template-compact.md` | Quick summary |
378
+ | Agent | `assets/report-template-agent.md` | CI/CD & AI integration |
379
+
380
+ ## Resources
381
+
382
+ - See `references/laravel-patterns.md` for detailed patterns
383
+ - See `references/php84-features.md` for PHP 8.4 features