thachvd-kit 1.0.13 → 1.0.15

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 (187) hide show
  1. package/.agent/agents/backend-specialist.md +263 -0
  2. package/.agent/agents/code-archaeologist.md +106 -0
  3. package/.agent/agents/database-architect.md +226 -0
  4. package/.agent/agents/debugger.md +225 -0
  5. package/.agent/agents/devops-engineer.md +242 -0
  6. package/.agent/agents/documentation-writer.md +104 -0
  7. package/.agent/agents/explorer-agent.md +73 -0
  8. package/.agent/agents/frontend-specialist.md +593 -0
  9. package/.agent/agents/game-developer.md +162 -0
  10. package/.agent/agents/mobile-developer.md +377 -0
  11. package/.agent/agents/orchestrator.md +416 -0
  12. package/.agent/agents/penetration-tester.md +188 -0
  13. package/.agent/agents/performance-optimizer.md +187 -0
  14. package/.agent/agents/product-manager.md +112 -0
  15. package/.agent/agents/product-owner.md +95 -0
  16. package/.agent/agents/project-planner.md +406 -0
  17. package/.agent/agents/qa-automation-engineer.md +103 -0
  18. package/.agent/agents/security-auditor.md +170 -0
  19. package/.agent/agents/seo-specialist.md +111 -0
  20. package/.agent/agents/test-engineer.md +158 -0
  21. package/.agent/rules/GEMINI.md +207 -0
  22. package/.agent/skills/api-design/SKILL.md +156 -0
  23. package/.agent/skills/api-patterns/SKILL.md +81 -0
  24. package/.agent/skills/api-patterns/api-style.md +42 -0
  25. package/.agent/skills/api-patterns/auth.md +24 -0
  26. package/.agent/skills/api-patterns/documentation.md +26 -0
  27. package/.agent/skills/api-patterns/graphql.md +41 -0
  28. package/.agent/skills/api-patterns/rate-limiting.md +31 -0
  29. package/.agent/skills/api-patterns/response.md +37 -0
  30. package/.agent/skills/api-patterns/rest.md +40 -0
  31. package/.agent/skills/api-patterns/scripts/api_validator.py +211 -0
  32. package/.agent/skills/api-patterns/security-testing.md +122 -0
  33. package/.agent/skills/api-patterns/trpc.md +41 -0
  34. package/.agent/skills/api-patterns/versioning.md +22 -0
  35. package/.agent/skills/app-builder/SKILL.md +75 -0
  36. package/.agent/skills/app-builder/agent-coordination.md +71 -0
  37. package/.agent/skills/app-builder/feature-building.md +53 -0
  38. package/.agent/skills/app-builder/project-detection.md +34 -0
  39. package/.agent/skills/app-builder/scaffolding.md +118 -0
  40. package/.agent/skills/app-builder/tech-stack.md +40 -0
  41. package/.agent/skills/app-builder/templates/SKILL.md +39 -0
  42. package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
  43. package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
  44. package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
  45. package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
  46. package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
  47. package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
  48. package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
  49. package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +122 -0
  50. package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +122 -0
  51. package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +169 -0
  52. package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +134 -0
  53. package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
  54. package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +119 -0
  55. package/.agent/skills/architecture/SKILL.md +55 -0
  56. package/.agent/skills/architecture/context-discovery.md +43 -0
  57. package/.agent/skills/architecture/examples.md +94 -0
  58. package/.agent/skills/architecture/pattern-selection.md +68 -0
  59. package/.agent/skills/architecture/patterns-reference.md +50 -0
  60. package/.agent/skills/architecture/trade-off-analysis.md +77 -0
  61. package/.agent/skills/bash-linux/SKILL.md +199 -0
  62. package/.agent/skills/behavioral-modes/SKILL.md +242 -0
  63. package/.agent/skills/brainstorming/SKILL.md +163 -0
  64. package/.agent/skills/brainstorming/dynamic-questioning.md +350 -0
  65. package/.agent/skills/clean-code/SKILL.md +201 -0
  66. package/.agent/skills/code-review-checklist/SKILL.md +109 -0
  67. package/.agent/skills/database-design/SKILL.md +52 -0
  68. package/.agent/skills/database-design/database-selection.md +43 -0
  69. package/.agent/skills/database-design/indexing.md +39 -0
  70. package/.agent/skills/database-design/migrations.md +48 -0
  71. package/.agent/skills/database-design/optimization.md +36 -0
  72. package/.agent/skills/database-design/orm-selection.md +30 -0
  73. package/.agent/skills/database-design/schema-design.md +56 -0
  74. package/.agent/skills/database-design/scripts/schema_validator.py +172 -0
  75. package/.agent/skills/deployment-procedures/SKILL.md +241 -0
  76. package/.agent/skills/desktop-design/SKILL.md +25 -0
  77. package/.agent/skills/dispatching-parallel-agents/SKILL.md +112 -0
  78. package/.agent/skills/doc.md +177 -0
  79. package/.agent/skills/docker-patterns/SKILL.md +232 -0
  80. package/.agent/skills/documentation-templates/SKILL.md +194 -0
  81. package/.agent/skills/executing-plans/SKILL.md +61 -0
  82. package/.agent/skills/finishing-a-development-branch/SKILL.md +135 -0
  83. package/.agent/skills/frontend-design/SKILL.md +418 -0
  84. package/.agent/skills/frontend-design/animation-guide.md +331 -0
  85. package/.agent/skills/frontend-design/color-system.md +311 -0
  86. package/.agent/skills/frontend-design/decision-trees.md +418 -0
  87. package/.agent/skills/frontend-design/motion-graphics.md +306 -0
  88. package/.agent/skills/frontend-design/scripts/accessibility_checker.py +183 -0
  89. package/.agent/skills/frontend-design/scripts/ux_audit.py +722 -0
  90. package/.agent/skills/frontend-design/typography-system.md +345 -0
  91. package/.agent/skills/frontend-design/ux-psychology.md +1116 -0
  92. package/.agent/skills/frontend-design/visual-effects.md +383 -0
  93. package/.agent/skills/game-development/2d-games/SKILL.md +119 -0
  94. package/.agent/skills/game-development/3d-games/SKILL.md +135 -0
  95. package/.agent/skills/game-development/SKILL.md +167 -0
  96. package/.agent/skills/game-development/game-art/SKILL.md +185 -0
  97. package/.agent/skills/game-development/game-audio/SKILL.md +190 -0
  98. package/.agent/skills/game-development/game-design/SKILL.md +129 -0
  99. package/.agent/skills/game-development/mobile-games/SKILL.md +108 -0
  100. package/.agent/skills/game-development/multiplayer/SKILL.md +132 -0
  101. package/.agent/skills/game-development/pc-games/SKILL.md +144 -0
  102. package/.agent/skills/game-development/vr-ar/SKILL.md +123 -0
  103. package/.agent/skills/game-development/web-games/SKILL.md +150 -0
  104. package/.agent/skills/geo-fundamentals/SKILL.md +156 -0
  105. package/.agent/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
  106. package/.agent/skills/golang-patterns/SKILL.md +226 -0
  107. package/.agent/skills/golang-testing/SKILL.md +182 -0
  108. package/.agent/skills/i18n-localization/SKILL.md +154 -0
  109. package/.agent/skills/i18n-localization/scripts/i18n_checker.py +241 -0
  110. package/.agent/skills/intelligent-routing/SKILL.md +335 -0
  111. package/.agent/skills/laravel-patterns/SKILL.md +224 -0
  112. package/.agent/skills/laravel-security/SKILL.md +171 -0
  113. package/.agent/skills/laravel-tdd/SKILL.md +149 -0
  114. package/.agent/skills/lint-and-validate/SKILL.md +45 -0
  115. package/.agent/skills/lint-and-validate/scripts/lint_runner.py +184 -0
  116. package/.agent/skills/lint-and-validate/scripts/type_coverage.py +173 -0
  117. package/.agent/skills/mcp-builder/SKILL.md +176 -0
  118. package/.agent/skills/mobile-design/SKILL.md +394 -0
  119. package/.agent/skills/mobile-design/decision-trees.md +516 -0
  120. package/.agent/skills/mobile-design/mobile-backend.md +491 -0
  121. package/.agent/skills/mobile-design/mobile-color-system.md +420 -0
  122. package/.agent/skills/mobile-design/mobile-debugging.md +122 -0
  123. package/.agent/skills/mobile-design/mobile-design-thinking.md +357 -0
  124. package/.agent/skills/mobile-design/mobile-navigation.md +458 -0
  125. package/.agent/skills/mobile-design/mobile-performance.md +767 -0
  126. package/.agent/skills/mobile-design/mobile-testing.md +356 -0
  127. package/.agent/skills/mobile-design/mobile-typography.md +433 -0
  128. package/.agent/skills/mobile-design/platform-android.md +666 -0
  129. package/.agent/skills/mobile-design/platform-ios.md +561 -0
  130. package/.agent/skills/mobile-design/scripts/mobile_audit.py +670 -0
  131. package/.agent/skills/mobile-design/touch-psychology.md +537 -0
  132. package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +312 -0
  133. package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -0
  134. package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -0
  135. package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -0
  136. package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
  137. package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -0
  138. package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -0
  139. package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -0
  140. package/.agent/skills/nextjs-react-expert/SKILL.md +286 -0
  141. package/.agent/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
  142. package/.agent/skills/nextjs-react-expert/scripts/react_performance_checker.py +252 -0
  143. package/.agent/skills/nodejs-best-practices/SKILL.md +333 -0
  144. package/.agent/skills/parallel-agents/SKILL.md +175 -0
  145. package/.agent/skills/performance-profiling/SKILL.md +143 -0
  146. package/.agent/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
  147. package/.agent/skills/plan-writing/SKILL.md +152 -0
  148. package/.agent/skills/powershell-windows/SKILL.md +167 -0
  149. package/.agent/skills/project-onboarding/SKILL.md +62 -0
  150. package/.agent/skills/python-patterns/SKILL.md +441 -0
  151. package/.agent/skills/react-frontend/SKILL.md +25 -0
  152. package/.agent/skills/receiving-code-review/SKILL.md +120 -0
  153. package/.agent/skills/red-team-tactics/SKILL.md +199 -0
  154. package/.agent/skills/requesting-code-review/SKILL.md +67 -0
  155. package/.agent/skills/rust-pro/SKILL.md +176 -0
  156. package/.agent/skills/seo-fundamentals/SKILL.md +129 -0
  157. package/.agent/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
  158. package/.agent/skills/server-management/SKILL.md +161 -0
  159. package/.agent/skills/subagent-driven-development/SKILL.md +76 -0
  160. package/.agent/skills/systematic-debugging/SKILL.md +109 -0
  161. package/.agent/skills/tailwind-patterns/SKILL.md +269 -0
  162. package/.agent/skills/tdd-workflow/SKILL.md +149 -0
  163. package/.agent/skills/testing-patterns/SKILL.md +178 -0
  164. package/.agent/skills/testing-patterns/scripts/test_runner.py +219 -0
  165. package/.agent/skills/using-git-worktrees/SKILL.md +122 -0
  166. package/.agent/skills/verification-before-completion/SKILL.md +99 -0
  167. package/.agent/skills/vulnerability-scanner/SKILL.md +276 -0
  168. package/.agent/skills/vulnerability-scanner/checklists.md +121 -0
  169. package/.agent/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
  170. package/.agent/skills/web-design-guidelines/SKILL.md +57 -0
  171. package/.agent/skills/webapp-testing/SKILL.md +187 -0
  172. package/.agent/skills/webapp-testing/scripts/playwright_runner.py +173 -0
  173. package/.agent/skills/writing-skills/SKILL.md +110 -0
  174. package/.agent/workflows/brainstorm.md +113 -0
  175. package/.agent/workflows/create.md +59 -0
  176. package/.agent/workflows/debug.md +103 -0
  177. package/.agent/workflows/deploy.md +176 -0
  178. package/.agent/workflows/enhance.md +63 -0
  179. package/.agent/workflows/orchestrate.md +237 -0
  180. package/.agent/workflows/plan.md +89 -0
  181. package/.agent/workflows/preview.md +81 -0
  182. package/.agent/workflows/status.md +86 -0
  183. package/.agent/workflows/test.md +144 -0
  184. package/.agent/workflows/ui-ux-pro-max.md +296 -0
  185. package/bin/cli.js +73 -6
  186. package/package.json +3 -3
  187. package/PROJECT_CONTEXT.template.md +0 -68
@@ -0,0 +1,171 @@
1
+ ---
2
+ name: laravel-security
3
+ description: Laravel security best practices. Use when adding authentication or authorization, handling user input and file uploads, building new API endpoints, managing secrets, or hardening production deployments.
4
+ allowed-tools: Read, Edit, Grep
5
+ ---
6
+
7
+ # Laravel Security Best Practices
8
+
9
+ ## Core Security Settings
10
+
11
+ - `APP_DEBUG=false` in production
12
+ - `APP_KEY` must be set and rotated on compromise
13
+ - `SESSION_SECURE_COOKIE=true` and `SESSION_SAME_SITE=lax` (or `strict` for sensitive apps)
14
+ - Configure trusted proxies for correct HTTPS detection
15
+
16
+ ## Authentication and Tokens (Sanctum)
17
+
18
+ ```php
19
+ Route::middleware('auth:sanctum')->get('/me', function (Request $request) {
20
+ return $request->user();
21
+ });
22
+ ```
23
+
24
+ - Use short-lived tokens with refresh flows for sensitive data
25
+ - Revoke tokens on logout and compromised accounts
26
+
27
+ ## Password Security
28
+
29
+ ```php
30
+ $validated = $request->validate([
31
+ 'password' => ['required', 'string', Password::min(12)->letters()->mixedCase()->numbers()->symbols()],
32
+ ]);
33
+
34
+ $user->update(['password' => Hash::make($validated['password'])]);
35
+ ```
36
+
37
+ ## Authorization: Policies and Gates
38
+
39
+ ```php
40
+ // In controller
41
+ $this->authorize('update', $project);
42
+
43
+ // Route-level enforcement
44
+ Route::put('/projects/{project}', [ProjectController::class, 'update'])
45
+ ->middleware(['auth:sanctum', 'can:update,project']);
46
+ ```
47
+
48
+ ## Rate Limiting
49
+
50
+ ```php
51
+ RateLimiter::for('login', function (Request $request) {
52
+ return [
53
+ Limit::perMinute(5)->by($request->ip()),
54
+ Limit::perMinute(5)->by(strtolower((string) $request->input('email'))),
55
+ ];
56
+ });
57
+ ```
58
+
59
+ ## File Upload Safety
60
+
61
+ ```php
62
+ final class UploadInvoiceRequest extends FormRequest
63
+ {
64
+ public function authorize(): bool
65
+ {
66
+ return (bool) $this->user()?->can('upload-invoice');
67
+ }
68
+
69
+ public function rules(): array
70
+ {
71
+ return [
72
+ 'invoice' => ['required', 'file', 'mimes:pdf', 'max:5120'],
73
+ ];
74
+ }
75
+ }
76
+
77
+ // Store outside public path
78
+ $path = $request->file('invoice')->store('invoices', 'local');
79
+ ```
80
+
81
+ ## Mass Assignment Protection
82
+
83
+ - Use `$fillable` or `$guarded` — avoid `Model::unguard()`
84
+ - Prefer DTOs or explicit attribute mapping
85
+
86
+ ## SQL Injection Prevention
87
+
88
+ - Use Eloquent or query builder parameter binding
89
+ - Avoid raw SQL unless strictly necessary
90
+
91
+ ```php
92
+ DB::select('select * from users where email = ?', [$email]);
93
+ ```
94
+
95
+ ## XSS Prevention
96
+
97
+ - Blade escapes output by default (`{{ }}`)
98
+ - Use `{!! !!}` only for trusted, sanitized HTML
99
+
100
+ ## CSRF Protection
101
+
102
+ - Keep `VerifyCsrfToken` middleware enabled
103
+ - Include `@csrf` in forms
104
+ - For SPA + Sanctum: configure stateful domains
105
+
106
+ ```php
107
+ // config/sanctum.php
108
+ 'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', 'localhost')),
109
+ ```
110
+
111
+ ## Encrypted Attributes
112
+
113
+ ```php
114
+ protected $casts = [
115
+ 'api_token' => 'encrypted',
116
+ ];
117
+ ```
118
+
119
+ ## Security Headers Middleware
120
+
121
+ ```php
122
+ final class SecurityHeaders
123
+ {
124
+ public function handle(Request $request, \Closure $next): Response
125
+ {
126
+ $response = $next($request);
127
+ $response->headers->add([
128
+ 'Content-Security-Policy' => "default-src 'self'",
129
+ 'Strict-Transport-Security' => 'max-age=31536000',
130
+ 'X-Frame-Options' => 'DENY',
131
+ 'X-Content-Type-Options' => 'nosniff',
132
+ 'Referrer-Policy' => 'no-referrer',
133
+ ]);
134
+ return $response;
135
+ }
136
+ }
137
+ ```
138
+
139
+ ## CORS Configuration
140
+
141
+ ```php
142
+ // config/cors.php
143
+ return [
144
+ 'paths' => ['api/*', 'sanctum/csrf-cookie'],
145
+ 'allowed_origins' => ['https://app.example.com'], // Never wildcard for auth routes
146
+ 'supports_credentials' => true,
147
+ ];
148
+ ```
149
+
150
+ ## Logging and PII
151
+
152
+ ```php
153
+ // Never log passwords, tokens, card data
154
+ Log::info('User updated profile', [
155
+ 'user_id' => $user->id,
156
+ 'email' => '[REDACTED]',
157
+ ]);
158
+ ```
159
+
160
+ ## Signed URLs
161
+
162
+ ```php
163
+ $url = URL::temporarySignedRoute('downloads.invoice', now()->addMinutes(15), ['invoice' => $invoice->id]);
164
+ ```
165
+
166
+ ## Secrets Management
167
+
168
+ - Never commit secrets to source control
169
+ - Use environment variables and secret managers (AWS SSM, Vault)
170
+ - Rotate keys after exposure and invalidate sessions
171
+ - Run `composer audit` regularly for dependency vulnerabilities
@@ -0,0 +1,149 @@
1
+ ---
2
+ name: laravel-tdd
3
+ description: Laravel TDD workflow with PHPUnit and Pest. Use when writing tests for Laravel applications, implementing red-green-refactor cycle, testing HTTP endpoints, auth, queues, events, or setting up test configuration.
4
+ allowed-tools: Bash, Read, Edit, Write
5
+ ---
6
+
7
+ # Laravel TDD Workflow
8
+
9
+ ## Red-Green-Refactor Cycle
10
+
11
+ 1. Write a failing test (RED)
12
+ 2. Implement the minimal change to pass (GREEN)
13
+ 3. Refactor while keeping tests green (REFACTOR)
14
+
15
+ ## Test Layers
16
+
17
+ | Layer | Use For |
18
+ |-------|---------|
19
+ | **Unit** | Pure PHP classes, value objects, services |
20
+ | **Feature** | HTTP endpoints, auth, validation, policies |
21
+ | **Integration** | DB + queue + external boundaries together |
22
+
23
+ ## Database Strategy
24
+
25
+ - **`RefreshDatabase`** — Default for tests touching the DB. Runs migrations once per run, wraps each test in a transaction.
26
+ - **`DatabaseTransactions`** — When schema is already migrated, only need per-test rollback.
27
+ - **`DatabaseMigrations`** — When you need full migrate/fresh for every test.
28
+
29
+ ## Testing Framework
30
+
31
+ - Default to **Pest** for new tests when available
32
+ - Use **PHPUnit** if project has standardized on it
33
+
34
+ ## PHPUnit Example
35
+
36
+ ```php
37
+ use App\Models\User;
38
+ use Illuminate\Foundation\Testing\RefreshDatabase;
39
+ use Tests\TestCase;
40
+
41
+ final class ProjectControllerTest extends TestCase
42
+ {
43
+ use RefreshDatabase;
44
+
45
+ public function test_owner_can_create_project(): void
46
+ {
47
+ $user = User::factory()->create();
48
+
49
+ $response = $this->actingAs($user)->postJson('/api/projects', [
50
+ 'name' => 'New Project',
51
+ ]);
52
+
53
+ $response->assertCreated();
54
+ $this->assertDatabaseHas('projects', ['name' => 'New Project']);
55
+ }
56
+ }
57
+ ```
58
+
59
+ ## Pest Example
60
+
61
+ ```php
62
+ use App\Models\User;
63
+ use Illuminate\Foundation\Testing\RefreshDatabase;
64
+
65
+ uses(RefreshDatabase::class);
66
+
67
+ test('owner can create project', function () {
68
+ $user = User::factory()->create();
69
+
70
+ $response = actingAs($user)->postJson('/api/projects', [
71
+ 'name' => 'New Project',
72
+ ]);
73
+
74
+ $response->assertCreated();
75
+ assertDatabaseHas('projects', ['name' => 'New Project']);
76
+ });
77
+ ```
78
+
79
+ ## Factories and States
80
+
81
+ ```php
82
+ $user = User::factory()->state(['role' => 'admin'])->create();
83
+
84
+ // Factory sequences
85
+ User::factory()->count(3)->for($project)->create();
86
+ ```
87
+
88
+ ## Fakes for Side Effects
89
+
90
+ ```php
91
+ Queue::fake();
92
+ dispatch(new SendOrderConfirmation($order->id));
93
+ Queue::assertPushed(SendOrderConfirmation::class);
94
+
95
+ Mail::fake();
96
+ Notification::fake();
97
+ Event::fake();
98
+ ```
99
+
100
+ ## Auth Testing (Sanctum)
101
+
102
+ ```php
103
+ use Laravel\Sanctum\Sanctum;
104
+
105
+ Sanctum::actingAs($user);
106
+
107
+ $response = $this->getJson('/api/projects');
108
+ $response->assertOk();
109
+ ```
110
+
111
+ ## HTTP and External Services
112
+
113
+ ```php
114
+ // Isolate external APIs
115
+ Http::fake(['api.stripe.com/*' => Http::response(['id' => 'evt_123'], 200)]);
116
+ Http::assertSent(fn ($request) => $request->url() === 'https://api.stripe.com/...');
117
+ ```
118
+
119
+ ## Authorization Tests
120
+
121
+ ```php
122
+ $this->assertTrue(Gate::forUser($user)->allows('update', $project));
123
+ $this->assertFalse(Gate::forUser($otherUser)->allows('update', $project));
124
+ ```
125
+
126
+ ## Coverage Targets
127
+
128
+ - Enforce 80%+ coverage for unit + feature tests
129
+ - Use `pcov` or `XDEBUG_MODE=coverage` in CI
130
+
131
+ ## Test Commands
132
+
133
+ ```bash
134
+ php artisan test
135
+ php artisan test --parallel # Parallel execution
136
+ vendor/bin/pest
137
+ vendor/bin/phpunit
138
+ ```
139
+
140
+ ## Test Configuration (phpunit.xml)
141
+
142
+ ```xml
143
+ <php>
144
+ <env name="DB_CONNECTION" value="sqlite"/>
145
+ <env name="DB_DATABASE" value=":memory:"/>
146
+ <env name="CACHE_DRIVER" value="array"/>
147
+ <env name="QUEUE_CONNECTION" value="sync"/>
148
+ </php>
149
+ ```
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: lint-and-validate
3
+ description: Automatic quality control, linting, and static analysis procedures. Use after every code modification to ensure syntax correctness and project standards. Triggers onKeywords: lint, format, check, validate, types, static analysis.
4
+ allowed-tools: Read, Glob, Grep, Bash
5
+ ---
6
+
7
+ # Lint and Validate Skill
8
+
9
+ > **MANDATORY:** Run appropriate validation tools after EVERY code change. Do not finish a task until the code is error-free.
10
+
11
+ ### Procedures by Ecosystem
12
+
13
+ #### Node.js / TypeScript
14
+ 1. **Lint/Fix:** `npm run lint` or `npx eslint "path" --fix`
15
+ 2. **Types:** `npx tsc --noEmit`
16
+ 3. **Security:** `npm audit --audit-level=high`
17
+
18
+ #### Python
19
+ 1. **Linter (Ruff):** `ruff check "path" --fix` (Fast & Modern)
20
+ 2. **Security (Bandit):** `bandit -r "path" -ll`
21
+ 3. **Types (MyPy):** `mypy "path"`
22
+
23
+ ## The Quality Loop
24
+ 1. **Write/Edit Code**
25
+ 2. **Run Audit:** `npm run lint && npx tsc --noEmit`
26
+ 3. **Analyze Report:** Check the "FINAL AUDIT REPORT" section.
27
+ 4. **Fix & Repeat:** Submitting code with "FINAL AUDIT" failures is NOT allowed.
28
+
29
+ ## Error Handling
30
+ - If `lint` fails: Fix the style or syntax issues immediately.
31
+ - If `tsc` fails: Correct type mismatches before proceeding.
32
+ - If no tool is configured: Check the project root for `.eslintrc`, `tsconfig.json`, `pyproject.toml` and suggest creating one.
33
+
34
+ ---
35
+ **Strict Rule:** No code should be committed or reported as "done" without passing these checks.
36
+
37
+ ---
38
+
39
+ ## Scripts
40
+
41
+ | Script | Purpose | Command |
42
+ |--------|---------|---------|
43
+ | `scripts/lint_runner.py` | Unified lint check | `python scripts/lint_runner.py <project_path>` |
44
+ | `scripts/type_coverage.py` | Type coverage analysis | `python scripts/type_coverage.py <project_path>` |
45
+
@@ -0,0 +1,184 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Lint Runner - Unified linting and type checking
4
+ Runs appropriate linters based on project type.
5
+
6
+ Usage:
7
+ python lint_runner.py <project_path>
8
+
9
+ Supports:
10
+ - Node.js: npm run lint, npx tsc --noEmit
11
+ - Python: ruff check, mypy
12
+ """
13
+
14
+ import subprocess
15
+ import sys
16
+ import json
17
+ import platform
18
+ import shutil
19
+ from pathlib import Path
20
+ from datetime import datetime
21
+
22
+ # Fix Windows console encoding
23
+ try:
24
+ sys.stdout.reconfigure(encoding='utf-8', errors='replace')
25
+ except:
26
+ pass
27
+
28
+
29
+ def detect_project_type(project_path: Path) -> dict:
30
+ """Detect project type and available linters."""
31
+ result = {
32
+ "type": "unknown",
33
+ "linters": []
34
+ }
35
+
36
+ # Node.js project
37
+ package_json = project_path / "package.json"
38
+ if package_json.exists():
39
+ result["type"] = "node"
40
+ try:
41
+ pkg = json.loads(package_json.read_text(encoding='utf-8'))
42
+ scripts = pkg.get("scripts", {})
43
+ deps = {**pkg.get("dependencies", {}), **pkg.get("devDependencies", {})}
44
+
45
+ # Check for lint script
46
+ if "lint" in scripts:
47
+ result["linters"].append({"name": "npm lint", "cmd": ["npm", "run", "lint"]})
48
+ elif "eslint" in deps:
49
+ result["linters"].append({"name": "eslint", "cmd": ["npx", "eslint", "."]})
50
+
51
+ # Check for TypeScript
52
+ if "typescript" in deps or (project_path / "tsconfig.json").exists():
53
+ result["linters"].append({"name": "tsc", "cmd": ["npx", "tsc", "--noEmit"]})
54
+
55
+ except:
56
+ pass
57
+
58
+ # Python project
59
+ if (project_path / "pyproject.toml").exists() or (project_path / "requirements.txt").exists():
60
+ result["type"] = "python"
61
+
62
+ # Check for ruff
63
+ result["linters"].append({"name": "ruff", "cmd": ["ruff", "check", "."]})
64
+
65
+ # Check for mypy
66
+ if (project_path / "mypy.ini").exists() or (project_path / "pyproject.toml").exists():
67
+ result["linters"].append({"name": "mypy", "cmd": ["mypy", "."]})
68
+
69
+ return result
70
+
71
+
72
+ def run_linter(linter: dict, cwd: Path) -> dict:
73
+ """Run a single linter and return results."""
74
+ result = {
75
+ "name": linter["name"],
76
+ "passed": False,
77
+ "output": "",
78
+ "error": ""
79
+ }
80
+
81
+ try:
82
+ cmd = linter["cmd"]
83
+
84
+ # Windows compatibility for npm/npx
85
+ if platform.system() == "Windows":
86
+ if cmd[0] in ["npm", "npx"]:
87
+ # Force .cmd extension on Windows
88
+ if not cmd[0].lower().endswith(".cmd"):
89
+ cmd[0] = f"{cmd[0]}.cmd"
90
+
91
+ proc = subprocess.run(
92
+ cmd,
93
+ cwd=str(cwd),
94
+ capture_output=True,
95
+ text=True,
96
+ encoding='utf-8',
97
+ errors='replace',
98
+ timeout=120,
99
+ shell=platform.system() == "Windows" # Shell=True often helps with path resolution on Windows
100
+ )
101
+
102
+ result["output"] = proc.stdout[:2000] if proc.stdout else ""
103
+ result["error"] = proc.stderr[:500] if proc.stderr else ""
104
+ result["passed"] = proc.returncode == 0
105
+
106
+ except FileNotFoundError:
107
+ result["error"] = f"Command not found: {linter['cmd'][0]}"
108
+ except subprocess.TimeoutExpired:
109
+ result["error"] = "Timeout after 120s"
110
+ except Exception as e:
111
+ result["error"] = str(e)
112
+
113
+ return result
114
+
115
+
116
+ def main():
117
+ project_path = Path(sys.argv[1] if len(sys.argv) > 1 else ".").resolve()
118
+
119
+ print(f"\n{'='*60}")
120
+ print(f"[LINT RUNNER] Unified Linting")
121
+ print(f"{'='*60}")
122
+ print(f"Project: {project_path}")
123
+ print(f"Time: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
124
+
125
+ # Detect project type
126
+ project_info = detect_project_type(project_path)
127
+ print(f"Type: {project_info['type']}")
128
+ print(f"Linters: {len(project_info['linters'])}")
129
+ print("-"*60)
130
+
131
+ if not project_info["linters"]:
132
+ print("No linters found for this project type.")
133
+ output = {
134
+ "script": "lint_runner",
135
+ "project": str(project_path),
136
+ "type": project_info["type"],
137
+ "checks": [],
138
+ "passed": True,
139
+ "message": "No linters configured"
140
+ }
141
+ print(json.dumps(output, indent=2))
142
+ sys.exit(0)
143
+
144
+ # Run each linter
145
+ results = []
146
+ all_passed = True
147
+
148
+ for linter in project_info["linters"]:
149
+ print(f"\nRunning: {linter['name']}...")
150
+ result = run_linter(linter, project_path)
151
+ results.append(result)
152
+
153
+ if result["passed"]:
154
+ print(f" [PASS] {linter['name']}")
155
+ else:
156
+ print(f" [FAIL] {linter['name']}")
157
+ if result["error"]:
158
+ print(f" Error: {result['error'][:200]}")
159
+ all_passed = False
160
+
161
+ # Summary
162
+ print("\n" + "="*60)
163
+ print("SUMMARY")
164
+ print("="*60)
165
+
166
+ for r in results:
167
+ icon = "[PASS]" if r["passed"] else "[FAIL]"
168
+ print(f"{icon} {r['name']}")
169
+
170
+ output = {
171
+ "script": "lint_runner",
172
+ "project": str(project_path),
173
+ "type": project_info["type"],
174
+ "checks": results,
175
+ "passed": all_passed
176
+ }
177
+
178
+ print("\n" + json.dumps(output, indent=2))
179
+
180
+ sys.exit(0 if all_passed else 1)
181
+
182
+
183
+ if __name__ == "__main__":
184
+ main()