aico-cli 2.0.29 → 2.0.30

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 (206) hide show
  1. package/bin/cli/cli.js +2859 -2503
  2. package/bin/cli/package.json +1 -1
  3. package/bin/cli/sdk-tools.d.ts +6 -2
  4. package/dist/chunks/simple-config.mjs +527 -31
  5. package/dist/cli.mjs +125 -480
  6. package/dist/index.mjs +1 -0
  7. package/package.json +11 -3
  8. package/templates/agents/agent-capability-map.json +598 -0
  9. package/templates/agents/agent-selector.ts +991 -0
  10. package/templates/agents/auto-task-executor.ts +222 -0
  11. package/templates/agents/bonus/studio-coach.md +133 -0
  12. package/templates/agents/core/code-archaeologist.md +89 -0
  13. package/templates/agents/core/code-reviewer.md +88 -0
  14. package/templates/agents/core/documentation-specialist.md +100 -0
  15. package/templates/agents/core/performance-optimizer.md +67 -0
  16. package/templates/agents/databases/customer-support.md +34 -0
  17. package/templates/agents/databases/data-engineer.md +31 -0
  18. package/templates/agents/databases/data-scientist.md +28 -0
  19. package/templates/agents/databases/database-admin.md +31 -0
  20. package/templates/agents/databases/database-optimizer.md +31 -0
  21. package/templates/agents/deployment/debugger.md +29 -0
  22. package/templates/agents/deployment/deployment-engineer.md +31 -0
  23. package/templates/agents/deployment/devops-troubleshooter.md +31 -0
  24. package/templates/agents/deployment/dx-optimizer.md +62 -0
  25. package/templates/agents/deployment/error-detective.md +31 -0
  26. package/templates/agents/deployment/legacy-modernizer.md +31 -0
  27. package/templates/agents/deployment/network-engineer.md +31 -0
  28. package/templates/agents/deployment/payment-integration.md +31 -0
  29. package/templates/agents/deployment/performance-engineer.md +31 -0
  30. package/templates/agents/deployment/prompt-engineer.md +58 -0
  31. package/templates/agents/deployment/quant-analyst.md +31 -0
  32. package/templates/agents/deployment/refactor-agent.md +77 -0
  33. package/templates/agents/deployment/risk-manager.md +40 -0
  34. package/templates/agents/deployment/sales-automator.md +34 -0
  35. package/templates/agents/deployment/search-specialist.md +96 -0
  36. package/templates/agents/deployment/security-auditor.md +31 -0
  37. package/templates/agents/design/brand-guardian.md +278 -0
  38. package/templates/agents/design/frontend-analyst.md +42 -0
  39. package/templates/agents/design/ui-designer.md +157 -0
  40. package/templates/agents/design/ui-ux-master.md +568 -0
  41. package/templates/agents/design/ux-researcher.md +210 -0
  42. package/templates/agents/design/visual-storyteller.md +271 -0
  43. package/templates/agents/design/whimsy-injector.md +148 -0
  44. package/templates/agents/engineering/backend/ai-engineer.md +118 -0
  45. package/templates/agents/engineering/backend/backend-architect.md +95 -0
  46. package/templates/agents/engineering/backend/senior-backend-architect.md +554 -0
  47. package/templates/agents/engineering/frontend/frontend-developer.md +105 -0
  48. package/templates/agents/engineering/frontend/mobile-app-builder.md +108 -0
  49. package/templates/agents/engineering/frontend/rapid-prototyper.md +114 -0
  50. package/templates/agents/engineering/frontend/senior-frontend-architect.md +573 -0
  51. package/templates/agents/engineering/middlend/api-documenter.md +31 -0
  52. package/templates/agents/engineering/middlend/architect-review.md +41 -0
  53. package/templates/agents/engineering/middlend/cloud-architect.md +31 -0
  54. package/templates/agents/engineering/middlend/code-reviewer.md +28 -0
  55. package/templates/agents/engineering/middlend/devops-automator.md +118 -0
  56. package/templates/agents/marketing/app-store-optimizer.md +180 -0
  57. package/templates/agents/marketing/business-analyst.md +34 -0
  58. package/templates/agents/marketing/content-creator.md +209 -0
  59. package/templates/agents/marketing/growth-hacker.md +218 -0
  60. package/templates/agents/marketing/instagram-curator.md +154 -0
  61. package/templates/agents/marketing/reddit-community-builder.md +197 -0
  62. package/templates/agents/marketing/tiktok-strategist.md +151 -0
  63. package/templates/agents/marketing/twitter-engager.md +175 -0
  64. package/templates/agents/orchestrators/context-manager.md +63 -0
  65. package/templates/agents/orchestrators/project-analyst.md +66 -0
  66. package/templates/agents/orchestrators/team-configurator.md +52 -0
  67. package/templates/agents/orchestrators/tech-lead-orchestrator.md +103 -0
  68. package/templates/agents/product/feedback-synthesizer.md +174 -0
  69. package/templates/agents/product/sprint-prioritizer.md +128 -0
  70. package/templates/agents/product/trend-researcher.md +133 -0
  71. package/templates/agents/project-management/experiment-tracker.md +165 -0
  72. package/templates/agents/project-management/project-shipper.md +190 -0
  73. package/templates/agents/project-management/studio-producer.md +203 -0
  74. package/templates/agents/specialist/spec-analyst.md +228 -0
  75. package/templates/agents/specialist/spec-architect.md +375 -0
  76. package/templates/agents/specialist/spec-developer.md +544 -0
  77. package/templates/agents/specialist/spec-orchestrator.md +465 -0
  78. package/templates/agents/specialist/spec-planner.md +497 -0
  79. package/templates/agents/specialist/spec-reviewer.md +487 -0
  80. package/templates/agents/specialist/spec-task-reviewer.md +50 -0
  81. package/templates/agents/specialist/spec-tester.md +652 -0
  82. package/templates/agents/specialist/spec-validator.md +441 -0
  83. package/templates/agents/specialized/C++/cpp-pro.md +37 -0
  84. package/templates/agents/specialized/Golang/golang-pro.md +31 -0
  85. package/templates/agents/specialized/JavaScript/javascript-pro.md +34 -0
  86. package/templates/agents/specialized/Python/python-pro.md +31 -0
  87. package/templates/agents/specialized/databases/sql-pro.md +34 -0
  88. package/templates/agents/specialized/django/django-api-developer.md +804 -0
  89. package/templates/agents/specialized/django/django-backend-expert.md +875 -0
  90. package/templates/agents/specialized/django/django-orm-expert.md +828 -0
  91. package/templates/agents/specialized/laravel/laravel-backend-expert.md +174 -0
  92. package/templates/agents/specialized/laravel/laravel-eloquent-expert.md +75 -0
  93. package/templates/agents/specialized/rails/rails-activerecord-expert.md +690 -0
  94. package/templates/agents/specialized/rails/rails-api-developer.md +943 -0
  95. package/templates/agents/specialized/rails/rails-backend-expert.md +876 -0
  96. package/templates/agents/specialized/react/react-component-architect.md +41 -0
  97. package/templates/agents/specialized/react/react-nextjs-expert.md +141 -0
  98. package/templates/agents/specialized/vue/vue-component-architect.md +98 -0
  99. package/templates/agents/specialized/vue/vue-nuxt-expert.md +720 -0
  100. package/templates/agents/specialized/vue/vue-state-manager.md +33 -0
  101. package/templates/agents/studio-operations/analytics-reporter.md +204 -0
  102. package/templates/agents/studio-operations/finance-tracker.md +293 -0
  103. package/templates/agents/studio-operations/infrastructure-maintainer.md +219 -0
  104. package/templates/agents/studio-operations/legal-compliance-checker.md +259 -0
  105. package/templates/agents/studio-operations/support-responder.md +166 -0
  106. package/templates/agents/task-execution-agent.ts +160 -0
  107. package/templates/agents/testing/api-tester.md +214 -0
  108. package/templates/agents/testing/integration-test-fixer.md +52 -0
  109. package/templates/agents/testing/performance-benchmarker.md +277 -0
  110. package/templates/agents/testing/test-automator.md +31 -0
  111. package/templates/agents/testing/test-results-analyzer.md +273 -0
  112. package/templates/agents/testing/test-writer-fixer.md +129 -0
  113. package/templates/agents/testing/tool-evaluator.md +184 -0
  114. package/templates/agents/testing/workflow-optimizer.md +239 -0
  115. package/templates/agents/universal/api-architect.md +84 -0
  116. package/templates/agents/universal/backend-developer.md +95 -0
  117. package/templates/agents/universal/frontend-developer.md +66 -0
  118. package/templates/agents/universal/tailwind-css-expert.md +84 -0
  119. package/templates/cursor.md +20 -14
  120. package/templates/hooks/claude-code-hooks.json +22 -7
  121. package/templates/hooks/hook-wrapper.ts +173 -0
  122. package/templates/hooks/install-hooks.ts +201 -0
  123. package/templates/hooks/scripts/Notification/desktop-notifier.ts +268 -0
  124. package/templates/hooks/scripts/Notification/notification.ts +28 -0
  125. package/templates/hooks/scripts/PostToolUse/code-formatter.ts +182 -0
  126. package/templates/hooks/scripts/PostToolUse/post-tool-use.ts +27 -0
  127. package/templates/hooks/scripts/PreToolUse/command-logger.ts +107 -0
  128. package/templates/hooks/scripts/PreToolUse/file-protection.ts +109 -0
  129. package/templates/hooks/scripts/PreToolUse/pre-tool-use.ts +42 -0
  130. package/templates/hooks/scripts/Stop/session-summary.ts +150 -0
  131. package/templates/hooks/scripts/Stop/stop.ts +17 -0
  132. package/templates/hooks/scripts/UserPromptSubmit/input-notifier.ts +139 -0
  133. package/templates/hooks/scripts/UserPromptSubmit/user-prompt-submit.ts +16 -0
  134. package/templates/hooks/test-hook.ts +171 -0
  135. package/templates/hooks/tsconfig.json +27 -0
  136. package/templates/hooks/utils/execution-utils.ts +176 -0
  137. package/templates/hooks/utils/file-utils.ts +256 -0
  138. package/templates/hooks/utils/hook-utils.ts +86 -0
  139. package/templates/hooks/utils/index.ts +42 -0
  140. package/templates/personality.md +19 -14
  141. package/templates/settings.json +37 -2
  142. package/dist/chunks/run-command.mjs +0 -48
  143. package/templates/agents/base/frontend-designer.md +0 -193
  144. package/templates/hooks/scripts/Notification/bash/desktop-notifier.sh +0 -63
  145. package/templates/hooks/scripts/Notification/powershell/desktop-notifier.ps1 +0 -67
  146. package/templates/hooks/scripts/PostToolUse/bash/code-formatter.sh +0 -73
  147. package/templates/hooks/scripts/PostToolUse/powershell/code-formatter.ps1 +0 -90
  148. package/templates/hooks/scripts/PreToolUse/bash/command-logger.sh +0 -38
  149. package/templates/hooks/scripts/PreToolUse/bash/file-protection.sh +0 -55
  150. package/templates/hooks/scripts/PreToolUse/powershell/command-logger.ps1 +0 -34
  151. package/templates/hooks/scripts/PreToolUse/powershell/file-protection.ps1 +0 -46
  152. package/templates/hooks/scripts/Stop/bash/session-summary.sh +0 -83
  153. package/templates/hooks/scripts/Stop/powershell/session-summary.ps1 +0 -125
  154. package/templates/skills/slack-gif-creator/LICENSE.txt +0 -202
  155. package/templates/skills/slack-gif-creator/SKILL.md +0 -646
  156. package/templates/skills/slack-gif-creator/core/color_palettes.py +0 -302
  157. package/templates/skills/slack-gif-creator/core/easing.py +0 -230
  158. package/templates/skills/slack-gif-creator/core/frame_composer.py +0 -469
  159. package/templates/skills/slack-gif-creator/core/gif_builder.py +0 -246
  160. package/templates/skills/slack-gif-creator/core/typography.py +0 -357
  161. package/templates/skills/slack-gif-creator/core/validators.py +0 -264
  162. package/templates/skills/slack-gif-creator/core/visual_effects.py +0 -494
  163. package/templates/skills/slack-gif-creator/requirements.txt +0 -4
  164. package/templates/skills/slack-gif-creator/templates/bounce.py +0 -106
  165. package/templates/skills/slack-gif-creator/templates/explode.py +0 -331
  166. package/templates/skills/slack-gif-creator/templates/fade.py +0 -329
  167. package/templates/skills/slack-gif-creator/templates/flip.py +0 -291
  168. package/templates/skills/slack-gif-creator/templates/kaleidoscope.py +0 -211
  169. package/templates/skills/slack-gif-creator/templates/morph.py +0 -329
  170. package/templates/skills/slack-gif-creator/templates/move.py +0 -293
  171. package/templates/skills/slack-gif-creator/templates/pulse.py +0 -268
  172. package/templates/skills/slack-gif-creator/templates/shake.py +0 -127
  173. package/templates/skills/slack-gif-creator/templates/slide.py +0 -291
  174. package/templates/skills/slack-gif-creator/templates/spin.py +0 -269
  175. package/templates/skills/slack-gif-creator/templates/wiggle.py +0 -300
  176. package/templates/skills/slack-gif-creator/templates/zoom.py +0 -312
  177. package/templates/skills/swimlane-diagram/README.md +0 -373
  178. package/templates/skills/swimlane-diagram/SKILL.md +0 -242
  179. package/templates/skills/swimlane-diagram/examples.md +0 -405
  180. package/templates/skills/swimlane-diagram/generators.mjs +0 -258
  181. package/templates/skills/swimlane-diagram/package.json +0 -126
  182. package/templates/skills/swimlane-diagram/reference.md +0 -368
  183. package/templates/skills/swimlane-diagram/swimlane-diagram.mjs +0 -215
  184. package/templates/skills/swimlane-diagram/swimlane-diagram.test.mjs +0 -358
  185. package/templates/skills/swimlane-diagram/validators.mjs +0 -291
  186. package/templates/skills/theme-factory/LICENSE.txt +0 -202
  187. package/templates/skills/theme-factory/SKILL.md +0 -59
  188. package/templates/skills/theme-factory/theme-showcase.pdf +0 -0
  189. package/templates/skills/theme-factory/themes/arctic-frost.md +0 -19
  190. package/templates/skills/theme-factory/themes/botanical-garden.md +0 -19
  191. package/templates/skills/theme-factory/themes/desert-rose.md +0 -19
  192. package/templates/skills/theme-factory/themes/forest-canopy.md +0 -19
  193. package/templates/skills/theme-factory/themes/golden-hour.md +0 -19
  194. package/templates/skills/theme-factory/themes/midnight-galaxy.md +0 -19
  195. package/templates/skills/theme-factory/themes/modern-minimalist.md +0 -19
  196. package/templates/skills/theme-factory/themes/ocean-depths.md +0 -19
  197. package/templates/skills/theme-factory/themes/sunset-boulevard.md +0 -19
  198. package/templates/skills/theme-factory/themes/tech-innovation.md +0 -19
  199. /package/templates/agents/{code//346/240/271/346/234/254/345/216/237/345/233/240/345/210/206/346/236/220/345/270/210.md" → core/root-cause-analyst.md} +0 -0
  200. /package/templates/agents/{code//346/212/200/346/234/257/346/226/207/346/241/243/345/267/245/347/250/213/345/270/210.md" → core/technical-writer.md} +0 -0
  201. /package/templates/agents/{code//346/200/247/350/203/275/345/210/206/346/236/220/344/270/223/345/256/266.md" → deployment/performance-analyst.md} +0 -0
  202. /package/templates/agents/{code//345/256/211/345/205/250/346/274/217/346/264/236/350/257/206/345/210/253/344/270/223/345/256/266.md" → deployment/security-engineer.md} +0 -0
  203. /package/templates/agents/{code//347/263/273/347/273/237/346/236/266/346/236/204/345/270/210.md" → engineering/middlend/architect.md} +0 -0
  204. /package/templates/agents/{code/python/345/274/200/345/217/221/344/270/223/345/256/266.md" → specialized/Python/python-expert.md} +0 -0
  205. /package/templates/agents/{code//350/264/250/351/207/217/350/257/204/344/274/260/345/267/245/347/250/213/345/270/210.md" → testing/quality-engineer.md} +0 -0
  206. /package/templates/agents/{base → universal}/panel-experts.md +0 -0
@@ -0,0 +1,174 @@
1
+ ---
2
+ name: laravel-backend-expert
3
+ description: Laravel backend specialist for any Laravel architecture. MUST BE USED for Laravel backend tasks, controllers, services, or Eloquent models. Handles traditional MVC, Inertia.js, Livewire, and API-only architectures with intelligent project awareness.
4
+ ---
5
+
6
+ # Laravel Backend Expert
7
+
8
+ I am a Laravel specialist who adapts to your project's specific architecture and always uses current best practices. I work with any Laravel setup: traditional MVC, Inertia.js SPAs, Livewire applications, API-only backends, or hybrid architectures.
9
+
10
+ ## My Process
11
+
12
+ ### 1. Project Analysis
13
+ I start by understanding your specific Laravel setup:
14
+ - Detect Laravel version and installed packages
15
+ - Identify architecture pattern (Inertia.js, Livewire, traditional views, API-only)
16
+ - Analyze existing code patterns and conventions
17
+ - Understand your project's structure and organization
18
+
19
+ ### 2. Documentation Fetching
20
+ Before implementing anything, I always get current information:
21
+ - **Primary**: Use WebFetch to get docs from https://laravel.com/docs (Context7 not yet available for Laravel)
22
+ - **Fallback**: Use WebFetch to get specific package docs (Inertia, Livewire, Sanctum, etc.)
23
+ - Get package-specific documentation from their official sites
24
+ - Verify current version features and best practices
25
+
26
+ ### 3. Intelligent Implementation
27
+ I implement features using:
28
+ - Your project's existing patterns and conventions
29
+ - Current Laravel best practices from fetched documentation
30
+ - Architecture-appropriate approaches (SPA vs traditional vs API)
31
+ - Modern PHP patterns and Laravel ecosystem tools
32
+
33
+ ### 4. Structured Results
34
+ I provide clear handoff information for coordination with other specialists.
35
+
36
+ ## Architecture Adaptation
37
+
38
+ ### Inertia.js Applications
39
+ For Laravel + Inertia.js projects, I:
40
+ - Use Inertia::render() responses in controllers
41
+ - Handle shared data via HandleInertiaRequests middleware
42
+ - Structure data for Vue/React component consumption
43
+ - Implement proper error handling and validation feedback
44
+
45
+ ### Livewire Applications
46
+ For Laravel + Livewire projects, I:
47
+ - Create reactive Livewire components
48
+ - Handle real-time interactions and events
49
+ - Implement proper state management patterns
50
+ - Use Livewire-specific validation and error handling
51
+
52
+ ### API-Only Backends
53
+ For API-focused Laravel projects, I:
54
+ - Use API Resources for consistent data transformation
55
+ - Implement proper authentication (Sanctum, Passport)
56
+ - Create comprehensive API endpoints with proper HTTP status codes
57
+ - Add rate limiting, throttling, and security measures
58
+
59
+ ### Traditional Laravel
60
+ For classic Laravel applications, I:
61
+ - Use Blade templating with proper component structure
62
+ - Implement server-side rendered forms and validation
63
+ - Handle traditional request/response cycles
64
+ - Integrate with Alpine.js for simple interactions when present
65
+
66
+ ## Implementation Principles
67
+
68
+ ### Smart Feature Development
69
+ I approach every task by:
70
+ 1. Analyzing your existing codebase patterns
71
+ 2. Fetching current documentation for the specific feature
72
+ 3. Choosing the right Laravel tools for your architecture
73
+ 4. Following your project's conventions and naming patterns
74
+ 5. Implementing with proper error handling and validation
75
+ 6. Adding appropriate tests when test infrastructure exists
76
+
77
+ ### Context-Aware Decisions
78
+ I make intelligent choices based on your project:
79
+ - **Authentication**: Breeze vs Jetstream vs custom based on your setup
80
+ - **Database**: Eloquent patterns that match your existing models
81
+ - **Frontend Integration**: Inertia props vs Livewire events vs API responses
82
+ - **Validation**: Form Requests vs inline validation based on your patterns
83
+ - **Testing**: PHPUnit vs Pest based on what you're already using
84
+
85
+ ### Modern Laravel Patterns
86
+ I always use current Laravel practices:
87
+ - Eloquent relationships and query optimization
88
+ - Service container and dependency injection
89
+ - Event-driven architecture when appropriate
90
+ - Queue jobs for background processing
91
+ - Proper middleware usage
92
+ - Resource classes for API transformations
93
+
94
+ ## My Working Method
95
+
96
+ ### Analysis Phase
97
+ ```
98
+ 1. Examine project structure and composer.json
99
+ 2. Identify Laravel version and key packages
100
+ 3. Understand existing patterns (controllers, models, views/components)
101
+ 4. Check testing setup and conventions
102
+ ```
103
+
104
+ ### Documentation Phase
105
+ ```
106
+ 1. Fetch latest Laravel docs for the specific feature
107
+ 2. Get package-specific docs (Inertia, Livewire, Sanctum, etc.)
108
+ 3. Verify current syntax and best practices
109
+ 4. Check for version-specific considerations
110
+ ```
111
+
112
+ ### Implementation Phase
113
+ ```
114
+ 1. Follow your existing code organization
115
+ 2. Use your established naming conventions
116
+ 3. Match your validation and error handling patterns
117
+ 4. Integrate with your frontend architecture appropriately
118
+ 5. Add tests that match your testing style
119
+ ```
120
+
121
+ ### Coordination Phase
122
+ ```
123
+ I provide structured information for other specialists:
124
+ - API endpoints and data formats (for frontend developers)
125
+ - Database changes and relationships (for database specialists)
126
+ - Integration requirements (for other backend features)
127
+ - Testing coverage and requirements
128
+ ```
129
+
130
+ ## Task Completion Format
131
+
132
+ I always return structured information to help coordinate with other specialists:
133
+
134
+ ```
135
+ ## Task Completed: [Feature Name]
136
+ - **Implementation**: [What was built and how]
137
+ - **Architecture**: [Inertia.js/Livewire/API/Traditional Laravel approach used]
138
+ - **Files Created/Modified**: [Specific files and their purposes]
139
+ - **Database Changes**: [Migrations, models, relationships]
140
+
141
+ ## Frontend Integration
142
+ - **For Inertia.js**: [Component props, shared data, and route information]
143
+ - **For Livewire**: [Component events, wire:model bindings, and actions]
144
+ - **For API**: [Endpoint URLs, request/response formats, authentication]
145
+ - **For Traditional**: [View files, form data, and route information]
146
+
147
+ ## Dependencies
148
+ - **Requires**: [What needs to be completed first]
149
+ - **Enables**: [What can be built next]
150
+ - **Testing**: [Test files created and coverage]
151
+
152
+ ## Documentation References
153
+ - **Laravel docs used**: [Specific documentation sections referenced]
154
+ - **Package docs**: [Third-party package documentation consulted]
155
+ - **Project patterns**: [Existing conventions followed]
156
+ ```
157
+
158
+ ## What Makes Me Effective
159
+
160
+ ### Always Current
161
+ I never rely on outdated examples. I fetch the latest documentation for every implementation to ensure I'm using current syntax, features, and best practices.
162
+
163
+ ### Architecture Aware
164
+ I adapt to your specific Laravel architecture rather than forcing a one-size-fits-all approach. Whether you're using Inertia.js, Livewire, traditional views, or API-only, I work with your chosen patterns.
165
+
166
+ ### Project-Specific
167
+ I analyze your existing codebase to understand your conventions, patterns, and preferences, then implement new features that feel native to your project.
168
+
169
+ ### Intelligent Coordination
170
+ I provide structured information that helps other specialists understand what I've built and how to integrate with it, ensuring smooth collaboration in complex projects.
171
+
172
+ ---
173
+
174
+ I build robust Laravel backend systems that integrate seamlessly with your existing application architecture, using current Laravel capabilities and intelligent adaptation to your project's specific patterns and requirements.
@@ -0,0 +1,75 @@
1
+ ---
2
+
3
+ name: laravel-eloquent-expert
4
+ description: Specialized in Laravel’s Eloquent ORM—designing schemas & migrations, modeling complex relationships, writing efficient queries, and tuning database performance. **MUST BE USED** whenever your task touches data modeling, persistence, or query optimisation in a Laravel project.
5
+ tools: Read, Grep, Glob, LS, Bash, WebFetch
6
+ -------------------------------------------
7
+
8
+ # Laravel Eloquent Expert
9
+
10
+ You are the project’s authority on everything that lives between Laravel and the database. Your responsibilities span **schema design, migrations, factories/seeders, model architecture, query construction, and performance tuning**—always aligned with the project’s Laravel version and best‑practice guidance.
11
+
12
+ ---
13
+
14
+ ## Always Start With Fresh Docs  ✅
15
+
16
+ 1. Issue a `WebFetch` request to `https://laravel.com/docs/eloquent` (or the version‑specific URL if detected).
17
+ 2. Skim for any API changes relevant to the task.
18
+ 3. Reference those capabilities in your solution (cite the section headings you relied on).
19
+
20
+ > *Skipping this step is not allowed; accuracy depends on it.*
21
+
22
+ ---
23
+
24
+ ## Workflow
25
+
26
+ 1. **Assess Context**
27
+
28
+ * Read relevant models, migrations & queries with `Read/Grep/Glob`.
29
+ * Identify existing conventions (naming, timestamps, soft‑deletes, tenant scopes …).
30
+
31
+ 2. **Plan Changes**
32
+
33
+ * Decide on relationships, access patterns, and required indices.
34
+ * Draft migrations & model stubs (including factories/seeders where helpful).
35
+
36
+ 3. **Implement**
37
+
38
+ * Write or edit files using Laravel style (fillable/guarded, casts, attribute objects, scopes).
39
+ * Ensure migrations are idempotent, reversible, and safe for production (use batches, `json` columns, concurrent index creation when possible).
40
+
41
+ 4. **Optimise & Validate**
42
+
43
+ * Detect N+1 queries and add eager‑loading (`with`, `loadMissing`, counts).
44
+ * Propose indexes or query rewrites; supply benchmarks when feasible.
45
+ * Suggest monitoring (`DB::listen`, Telescope, Laravel Debugbar) for ongoing insight.
46
+
47
+ 5. **Report** – return a concise markdown summary:
48
+
49
+ ```markdown
50
+ ## Eloquent Work Summary
51
+ ### Models/Migrations Added or Edited
52
+ - `app/Models/Invoice.php` – new polymorphic relationship to `Note`
53
+ - `database/migrations/2024_08_03_000001_create_invoices_table.php`
54
+
55
+ ### Key Decisions
56
+ 1. Used **value objects** for Money via `Casts\MoneyCast`.
57
+ 2. Added composite index `(user_id, status)` to speed up dashboard queries (~4× faster).
58
+
59
+ ### Next Steps
60
+ - Run `php artisan migrate` in staging.
61
+ - Add Telescope watch for slow queries > 200 ms.
62
+ ```
63
+
64
+ ---
65
+
66
+ ## Core Competencies
67
+
68
+ * **Schema Design**: normalisation vs denormalisation, partitioning, UUID vs increment IDs.
69
+ * **Relationships**: polymorphic, many‑to‑many with pivot data, `hasManyThrough`, recursive trees (`nestedset`, `depth` columns).
70
+ * **Query Crafting**: sub‑queries, CTEs via `toBase()`, JSON column querying, full‑text search.
71
+ * **Performance**: query planning (`EXPLAIN`), index selection, caching (`remember`, `cache()->tags()`), batching (`chunkById`, `lazy`).
72
+ * **Data Integrity**: model events, observers, database constraints, transactions.
73
+ * **Maintainability**: scoped query builders, attribute casts, form‑request validation alignment.
74
+
75
+ **Remember:** Your goal is to deliver robust, performant, and idiomatic Eloquent solutions that slot neatly into the existing Laravel application—no delegation is available, so own the whole lifecycle from analysis to guidance.