cc-codeconductor 0.2.10 → 0.3.0
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/dist/index.js +499 -266
- package/package.json +1 -1
- package/presets/agy/AGENTS.md +11 -0
- package/presets/claude/CLAUDE.md +34 -0
- package/presets/claude/skills/android/SKILL.md +119 -0
- package/presets/claude/skills/laravel-specialist/SKILL.md +264 -0
- package/presets/claude/skills/laravel-specialist/references/eloquent.md +351 -0
- package/presets/claude/skills/laravel-specialist/references/livewire.md +512 -0
- package/presets/claude/skills/laravel-specialist/references/queues.md +423 -0
- package/presets/claude/skills/laravel-specialist/references/routing.md +362 -0
- package/presets/claude/skills/laravel-specialist/references/testing.md +522 -0
- package/presets/claude/skills/php-pro/SKILL.md +208 -0
- package/presets/claude/skills/php-pro/references/async-patterns.md +412 -0
- package/presets/claude/skills/php-pro/references/laravel-patterns.md +377 -0
- package/presets/claude/skills/php-pro/references/modern-php-features.md +323 -0
- package/presets/claude/skills/php-pro/references/symfony-patterns.md +466 -0
- package/presets/claude/skills/php-pro/references/testing-quality.md +466 -0
- package/presets/codex/AGENTS.md +19 -0
- package/presets/codex/skills/android/SKILL.md +119 -0
- package/presets/codex/skills/laravel-specialist/SKILL.md +264 -0
- package/presets/codex/skills/laravel-specialist/references/eloquent.md +351 -0
- package/presets/codex/skills/laravel-specialist/references/livewire.md +512 -0
- package/presets/codex/skills/laravel-specialist/references/queues.md +423 -0
- package/presets/codex/skills/laravel-specialist/references/routing.md +362 -0
- package/presets/codex/skills/laravel-specialist/references/testing.md +522 -0
- package/presets/codex/skills/php-pro/SKILL.md +208 -0
- package/presets/codex/skills/php-pro/references/async-patterns.md +412 -0
- package/presets/codex/skills/php-pro/references/laravel-patterns.md +377 -0
- package/presets/codex/skills/php-pro/references/modern-php-features.md +323 -0
- package/presets/codex/skills/php-pro/references/symfony-patterns.md +466 -0
- package/presets/codex/skills/php-pro/references/testing-quality.md +466 -0
- package/presets/opencode/agents/orchestrator.md +121 -1
- package/presets/opencode/agents/reviewer.md +31 -0
- package/presets/opencode/prompts/v0.3.0/architect.md +221 -0
- package/presets/opencode/prompts/v0.3.0/docs.md +189 -0
- package/presets/opencode/prompts/v0.3.0/implementer.md +162 -0
- package/presets/opencode/prompts/v0.3.0/orchestrator.md +360 -0
- package/presets/opencode/prompts/v0.3.0/repo-explorer.md +110 -0
- package/presets/opencode/prompts/v0.3.0/reviewer.md +225 -0
- package/presets/opencode/prompts/v0.3.0/task-coach.md +155 -0
- package/presets/opencode/prompts/v0.3.0/tester.md +251 -0
- package/presets/opencode/skills/android/SKILL.md +119 -0
- package/presets/opencode/skills/laravel-specialist/SKILL.md +264 -0
- package/presets/opencode/skills/laravel-specialist/references/eloquent.md +351 -0
- package/presets/opencode/skills/laravel-specialist/references/livewire.md +512 -0
- package/presets/opencode/skills/laravel-specialist/references/queues.md +423 -0
- package/presets/opencode/skills/laravel-specialist/references/routing.md +362 -0
- package/presets/opencode/skills/laravel-specialist/references/testing.md +522 -0
- package/presets/opencode/skills/php-pro/SKILL.md +208 -0
- package/presets/opencode/skills/php-pro/references/async-patterns.md +412 -0
- package/presets/opencode/skills/php-pro/references/laravel-patterns.md +377 -0
- package/presets/opencode/skills/php-pro/references/modern-php-features.md +323 -0
- package/presets/opencode/skills/php-pro/references/symfony-patterns.md +466 -0
- package/presets/opencode/skills/php-pro/references/testing-quality.md +466 -0
- package/src/presets/manifests/agy.yml +3 -2
- package/src/presets/manifests/claude.yml +3 -2
- package/src/presets/manifests/codex.yml +3 -2
- package/src/presets/manifests/cursor.yml +3 -2
- package/src/presets/manifests/gemini.yml +3 -2
- package/src/presets/manifests/opencode.yml +3 -2
- package/src/presets/models/opencode.yml +6 -6
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
# Testing & Quality Assurance
|
|
2
|
+
|
|
3
|
+
## PHPUnit with Strict Types
|
|
4
|
+
|
|
5
|
+
```php
|
|
6
|
+
<?php
|
|
7
|
+
|
|
8
|
+
declare(strict_types=1);
|
|
9
|
+
|
|
10
|
+
namespace Tests\Unit\Service;
|
|
11
|
+
|
|
12
|
+
use App\Repository\UserRepositoryInterface;
|
|
13
|
+
use App\Service\UserService;
|
|
14
|
+
use App\Service\EmailService;
|
|
15
|
+
use PHPUnit\Framework\TestCase;
|
|
16
|
+
use PHPUnit\Framework\MockObject\MockObject;
|
|
17
|
+
|
|
18
|
+
final class UserServiceTest extends TestCase
|
|
19
|
+
{
|
|
20
|
+
private UserRepositoryInterface&MockObject $userRepository;
|
|
21
|
+
private EmailService&MockObject $emailService;
|
|
22
|
+
private UserService $userService;
|
|
23
|
+
|
|
24
|
+
protected function setUp(): void
|
|
25
|
+
{
|
|
26
|
+
$this->userRepository = $this->createMock(UserRepositoryInterface::class);
|
|
27
|
+
$this->emailService = $this->createMock(EmailService::class);
|
|
28
|
+
$this->userService = new UserService(
|
|
29
|
+
$this->userRepository,
|
|
30
|
+
$this->emailService
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public function testCreateUserSuccessfully(): void
|
|
35
|
+
{
|
|
36
|
+
$email = 'test@example.com';
|
|
37
|
+
$password = 'SecurePass123!';
|
|
38
|
+
|
|
39
|
+
$this->userRepository
|
|
40
|
+
->expects($this->once())
|
|
41
|
+
->method('findByEmail')
|
|
42
|
+
->with($email)
|
|
43
|
+
->willReturn(null);
|
|
44
|
+
|
|
45
|
+
$this->userRepository
|
|
46
|
+
->expects($this->once())
|
|
47
|
+
->method('create')
|
|
48
|
+
->willReturn($this->createUser($email));
|
|
49
|
+
|
|
50
|
+
$this->emailService
|
|
51
|
+
->expects($this->once())
|
|
52
|
+
->method('sendWelcomeEmail');
|
|
53
|
+
|
|
54
|
+
$user = $this->userService->createUser($email, $password);
|
|
55
|
+
|
|
56
|
+
$this->assertSame($email, $user->email);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public function testCreateUserThrowsExceptionWhenEmailExists(): void
|
|
60
|
+
{
|
|
61
|
+
$this->expectException(\DomainException::class);
|
|
62
|
+
$this->expectExceptionMessage('Email already exists');
|
|
63
|
+
|
|
64
|
+
$this->userRepository
|
|
65
|
+
->method('findByEmail')
|
|
66
|
+
->willReturn($this->createUser('test@example.com'));
|
|
67
|
+
|
|
68
|
+
$this->userService->createUser('test@example.com', 'password');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private function createUser(string $email): User
|
|
72
|
+
{
|
|
73
|
+
return new User(
|
|
74
|
+
id: 1,
|
|
75
|
+
email: $email,
|
|
76
|
+
password: password_hash('password', PASSWORD_ARGON2ID),
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Data Providers
|
|
83
|
+
|
|
84
|
+
```php
|
|
85
|
+
<?php
|
|
86
|
+
|
|
87
|
+
declare(strict_types=1);
|
|
88
|
+
|
|
89
|
+
namespace Tests\Unit\Validator;
|
|
90
|
+
|
|
91
|
+
use App\Validator\EmailValidator;
|
|
92
|
+
use PHPUnit\Framework\Attributes\DataProvider;
|
|
93
|
+
use PHPUnit\Framework\Attributes\Test;
|
|
94
|
+
use PHPUnit\Framework\TestCase;
|
|
95
|
+
|
|
96
|
+
final class EmailValidatorTest extends TestCase
|
|
97
|
+
{
|
|
98
|
+
#[Test]
|
|
99
|
+
#[DataProvider('validEmailProvider')]
|
|
100
|
+
public function itValidatesCorrectEmails(string $email): void
|
|
101
|
+
{
|
|
102
|
+
$validator = new EmailValidator();
|
|
103
|
+
$this->assertTrue($validator->isValid($email));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
#[Test]
|
|
107
|
+
#[DataProvider('invalidEmailProvider')]
|
|
108
|
+
public function itRejectsInvalidEmails(string $email): void
|
|
109
|
+
{
|
|
110
|
+
$validator = new EmailValidator();
|
|
111
|
+
$this->assertFalse($validator->isValid($email));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
public static function validEmailProvider(): array
|
|
115
|
+
{
|
|
116
|
+
return [
|
|
117
|
+
['user@example.com'],
|
|
118
|
+
['john.doe@company.co.uk'],
|
|
119
|
+
['test+filter@domain.org'],
|
|
120
|
+
];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
public static function invalidEmailProvider(): array
|
|
124
|
+
{
|
|
125
|
+
return [
|
|
126
|
+
['invalid'],
|
|
127
|
+
['@example.com'],
|
|
128
|
+
['user@'],
|
|
129
|
+
['user space@example.com'],
|
|
130
|
+
];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Laravel Feature Tests
|
|
136
|
+
|
|
137
|
+
```php
|
|
138
|
+
<?php
|
|
139
|
+
|
|
140
|
+
declare(strict_types=1);
|
|
141
|
+
|
|
142
|
+
namespace Tests\Feature;
|
|
143
|
+
|
|
144
|
+
use App\Models\User;
|
|
145
|
+
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
146
|
+
use Illuminate\Foundation\Testing\WithFaker;
|
|
147
|
+
use Tests\TestCase;
|
|
148
|
+
|
|
149
|
+
final class UserControllerTest extends TestCase
|
|
150
|
+
{
|
|
151
|
+
use RefreshDatabase, WithFaker;
|
|
152
|
+
|
|
153
|
+
public function testUserCanViewTheirProfile(): void
|
|
154
|
+
{
|
|
155
|
+
$user = User::factory()->create();
|
|
156
|
+
|
|
157
|
+
$response = $this->actingAs($user)->get('/api/users/me');
|
|
158
|
+
|
|
159
|
+
$response->assertOk()
|
|
160
|
+
->assertJson([
|
|
161
|
+
'data' => [
|
|
162
|
+
'id' => $user->id,
|
|
163
|
+
'email' => $user->email,
|
|
164
|
+
],
|
|
165
|
+
]);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
public function testUserCanUpdateTheirProfile(): void
|
|
169
|
+
{
|
|
170
|
+
$user = User::factory()->create();
|
|
171
|
+
$newName = $this->faker->name();
|
|
172
|
+
|
|
173
|
+
$response = $this->actingAs($user)->putJson('/api/users/me', [
|
|
174
|
+
'name' => $newName,
|
|
175
|
+
]);
|
|
176
|
+
|
|
177
|
+
$response->assertOk();
|
|
178
|
+
|
|
179
|
+
$this->assertDatabaseHas('users', [
|
|
180
|
+
'id' => $user->id,
|
|
181
|
+
'name' => $newName,
|
|
182
|
+
]);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
public function testUnauthorizedUserCannotAccessProfile(): void
|
|
186
|
+
{
|
|
187
|
+
$response = $this->getJson('/api/users/me');
|
|
188
|
+
|
|
189
|
+
$response->assertUnauthorized();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
public function testValidationFailsWithInvalidData(): void
|
|
193
|
+
{
|
|
194
|
+
$user = User::factory()->create();
|
|
195
|
+
|
|
196
|
+
$response = $this->actingAs($user)->putJson('/api/users/me', [
|
|
197
|
+
'email' => 'not-an-email',
|
|
198
|
+
]);
|
|
199
|
+
|
|
200
|
+
$response->assertUnprocessable()
|
|
201
|
+
->assertJsonValidationErrors(['email']);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Pest Testing (Modern Alternative)
|
|
207
|
+
|
|
208
|
+
```php
|
|
209
|
+
<?php
|
|
210
|
+
|
|
211
|
+
declare(strict_types=1);
|
|
212
|
+
|
|
213
|
+
use App\Models\User;
|
|
214
|
+
use App\Services\UserService;
|
|
215
|
+
|
|
216
|
+
beforeEach(function () {
|
|
217
|
+
$this->userService = app(UserService::class);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it('creates a user successfully', function () {
|
|
221
|
+
$user = $this->userService->createUser(
|
|
222
|
+
email: 'test@example.com',
|
|
223
|
+
password: 'SecurePass123!'
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
expect($user)
|
|
227
|
+
->toBeInstanceOf(User::class)
|
|
228
|
+
->email->toBe('test@example.com');
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
it('validates email format', function (string $email, bool $valid) {
|
|
232
|
+
$validator = new EmailValidator();
|
|
233
|
+
|
|
234
|
+
expect($validator->isValid($email))->toBe($valid);
|
|
235
|
+
})->with([
|
|
236
|
+
['test@example.com', true],
|
|
237
|
+
['invalid', false],
|
|
238
|
+
['@example.com', false],
|
|
239
|
+
]);
|
|
240
|
+
|
|
241
|
+
test('authenticated user can view profile', function () {
|
|
242
|
+
$user = User::factory()->create();
|
|
243
|
+
|
|
244
|
+
$this->actingAs($user)
|
|
245
|
+
->get('/api/users/me')
|
|
246
|
+
->assertOk()
|
|
247
|
+
->assertJson(['data' => ['email' => $user->email]]);
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
test('guest cannot access protected routes', function () {
|
|
251
|
+
$this->getJson('/api/users/me')
|
|
252
|
+
->assertUnauthorized();
|
|
253
|
+
});
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## PHPStan Configuration
|
|
257
|
+
|
|
258
|
+
```neon
|
|
259
|
+
# phpstan.neon
|
|
260
|
+
parameters:
|
|
261
|
+
level: 9
|
|
262
|
+
paths:
|
|
263
|
+
- src
|
|
264
|
+
- tests
|
|
265
|
+
excludePaths:
|
|
266
|
+
- src/bootstrap.php
|
|
267
|
+
- vendor
|
|
268
|
+
checkMissingIterableValueType: true
|
|
269
|
+
checkGenericClassInNonGenericObjectType: true
|
|
270
|
+
reportUnmatchedIgnoredErrors: true
|
|
271
|
+
tmpDir: var/cache/phpstan
|
|
272
|
+
|
|
273
|
+
ignoreErrors:
|
|
274
|
+
# Ignore specific Laravel magic
|
|
275
|
+
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Builder#'
|
|
276
|
+
|
|
277
|
+
type_coverage:
|
|
278
|
+
return_type: 100
|
|
279
|
+
param_type: 100
|
|
280
|
+
property_type: 100
|
|
281
|
+
|
|
282
|
+
includes:
|
|
283
|
+
- vendor/phpstan/phpstan-strict-rules/rules.neon
|
|
284
|
+
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## PHPStan Annotations
|
|
288
|
+
|
|
289
|
+
```php
|
|
290
|
+
<?php
|
|
291
|
+
|
|
292
|
+
declare(strict_types=1);
|
|
293
|
+
|
|
294
|
+
namespace App\Repository;
|
|
295
|
+
|
|
296
|
+
use App\Entity\User;
|
|
297
|
+
use Doctrine\ORM\EntityRepository;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* @extends EntityRepository<User>
|
|
301
|
+
*/
|
|
302
|
+
final class UserRepository extends EntityRepository
|
|
303
|
+
{
|
|
304
|
+
/**
|
|
305
|
+
* @return User[]
|
|
306
|
+
*/
|
|
307
|
+
public function findActive(): array
|
|
308
|
+
{
|
|
309
|
+
return $this->createQueryBuilder('u')
|
|
310
|
+
->where('u.status = :status')
|
|
311
|
+
->setParameter('status', 'active')
|
|
312
|
+
->getQuery()
|
|
313
|
+
->getResult();
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* @param int[] $ids
|
|
318
|
+
* @return User[]
|
|
319
|
+
*/
|
|
320
|
+
public function findByIds(array $ids): array
|
|
321
|
+
{
|
|
322
|
+
return $this->createQueryBuilder('u')
|
|
323
|
+
->where('u.id IN (:ids)')
|
|
324
|
+
->setParameter('ids', $ids)
|
|
325
|
+
->getQuery()
|
|
326
|
+
->getResult();
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* @template T
|
|
332
|
+
*/
|
|
333
|
+
final readonly class Result
|
|
334
|
+
{
|
|
335
|
+
/**
|
|
336
|
+
* @param T $data
|
|
337
|
+
*/
|
|
338
|
+
public function __construct(
|
|
339
|
+
public mixed $data,
|
|
340
|
+
public bool $success,
|
|
341
|
+
) {}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* @return T
|
|
345
|
+
*/
|
|
346
|
+
public function getData(): mixed
|
|
347
|
+
{
|
|
348
|
+
return $this->data;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
## Mockery (Advanced Mocking)
|
|
354
|
+
|
|
355
|
+
```php
|
|
356
|
+
<?php
|
|
357
|
+
|
|
358
|
+
declare(strict_types=1);
|
|
359
|
+
|
|
360
|
+
namespace Tests\Unit\Service;
|
|
361
|
+
|
|
362
|
+
use App\Repository\UserRepository;
|
|
363
|
+
use App\Service\NotificationService;
|
|
364
|
+
use Mockery;
|
|
365
|
+
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
|
|
366
|
+
use PHPUnit\Framework\TestCase;
|
|
367
|
+
|
|
368
|
+
final class NotificationServiceTest extends TestCase
|
|
369
|
+
{
|
|
370
|
+
use MockeryPHPUnitIntegration;
|
|
371
|
+
|
|
372
|
+
public function testSendsNotificationToActiveUsers(): void
|
|
373
|
+
{
|
|
374
|
+
$repository = Mockery::mock(UserRepository::class);
|
|
375
|
+
$repository->shouldReceive('findActive')
|
|
376
|
+
->once()
|
|
377
|
+
->andReturn([
|
|
378
|
+
$this->createUser('user1@example.com'),
|
|
379
|
+
$this->createUser('user2@example.com'),
|
|
380
|
+
]);
|
|
381
|
+
|
|
382
|
+
$service = new NotificationService($repository);
|
|
383
|
+
$result = $service->notifyActiveUsers('Important message');
|
|
384
|
+
|
|
385
|
+
$this->assertSame(2, $result->count());
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
public function testHandlesEmailServiceFailure(): void
|
|
389
|
+
{
|
|
390
|
+
$emailService = Mockery::mock(EmailService::class);
|
|
391
|
+
$emailService->shouldReceive('send')
|
|
392
|
+
->once()
|
|
393
|
+
->andThrow(new \RuntimeException('Email service down'));
|
|
394
|
+
|
|
395
|
+
$service = new NotificationService($emailService);
|
|
396
|
+
|
|
397
|
+
$this->expectException(\RuntimeException::class);
|
|
398
|
+
$service->sendNotification('test@example.com', 'Hello');
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
private function createUser(string $email): User
|
|
402
|
+
{
|
|
403
|
+
return new User(id: 1, email: $email, password: 'hashed');
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
## Code Coverage
|
|
409
|
+
|
|
410
|
+
```xml
|
|
411
|
+
<!-- phpunit.xml -->
|
|
412
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
413
|
+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
414
|
+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
|
415
|
+
bootstrap="vendor/autoload.php"
|
|
416
|
+
colors="true"
|
|
417
|
+
failOnRisky="true"
|
|
418
|
+
failOnWarning="true"
|
|
419
|
+
stopOnFailure="false">
|
|
420
|
+
<testsuites>
|
|
421
|
+
<testsuite name="Unit">
|
|
422
|
+
<directory>tests/Unit</directory>
|
|
423
|
+
</testsuite>
|
|
424
|
+
<testsuite name="Feature">
|
|
425
|
+
<directory>tests/Feature</directory>
|
|
426
|
+
</testsuite>
|
|
427
|
+
</testsuites>
|
|
428
|
+
<coverage>
|
|
429
|
+
<include>
|
|
430
|
+
<directory suffix=".php">src</directory>
|
|
431
|
+
</include>
|
|
432
|
+
<exclude>
|
|
433
|
+
<directory>src/bootstrap</directory>
|
|
434
|
+
<file>src/Kernel.php</file>
|
|
435
|
+
</exclude>
|
|
436
|
+
<report>
|
|
437
|
+
<html outputDirectory="coverage/html"/>
|
|
438
|
+
<clover outputFile="coverage/clover.xml"/>
|
|
439
|
+
</report>
|
|
440
|
+
</coverage>
|
|
441
|
+
<php>
|
|
442
|
+
<env name="APP_ENV" value="testing"/>
|
|
443
|
+
<env name="DB_CONNECTION" value="sqlite"/>
|
|
444
|
+
<env name="DB_DATABASE" value=":memory:"/>
|
|
445
|
+
</php>
|
|
446
|
+
</phpunit>
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
## Quick Reference
|
|
450
|
+
|
|
451
|
+
| Tool | Purpose | Command |
|
|
452
|
+
|------|---------|---------|
|
|
453
|
+
| PHPUnit | Unit/Feature tests | `./vendor/bin/phpunit` |
|
|
454
|
+
| Pest | Modern testing | `./vendor/bin/pest` |
|
|
455
|
+
| PHPStan | Static analysis | `./vendor/bin/phpstan analyse` |
|
|
456
|
+
| Psalm | Alternative static analysis | `./vendor/bin/psalm` |
|
|
457
|
+
| PHP-CS-Fixer | Code style | `./vendor/bin/php-cs-fixer fix` |
|
|
458
|
+
| PHPMD | Mess detector | `./vendor/bin/phpmd src text cleancode` |
|
|
459
|
+
|
|
460
|
+
| Assertion | PHPUnit | Pest |
|
|
461
|
+
|-----------|---------|------|
|
|
462
|
+
| Equality | `$this->assertSame()` | `expect()->toBe()` |
|
|
463
|
+
| Type | `$this->assertInstanceOf()` | `expect()->toBeInstanceOf()` |
|
|
464
|
+
| Array | `$this->assertContains()` | `expect()->toContain()` |
|
|
465
|
+
| Exception | `$this->expectException()` | `expect()->toThrow()` |
|
|
466
|
+
| Count | `$this->assertCount()` | `expect()->toHaveCount()` |
|
|
@@ -142,6 +142,102 @@ signals in order of priority:
|
|
|
142
142
|
| `[tool.pytest.ini_options]` in `pyproject.toml` | pytest configured |
|
|
143
143
|
| `django-tenants` in deps | Multi-tenant Django |
|
|
144
144
|
| `build.gradle.kts` + `org.springframework.boot` | Spring Boot + Kotlin |
|
|
145
|
+
| `next.config.js` / `next.config.mjs` / `next.config.ts` | Next.js |
|
|
146
|
+
| `requirements.txt` / `pyproject.toml` with `fastapi` | FastAPI |
|
|
147
|
+
| `pnpm-workspace.yaml` / `go.work` | Monorepo Workspace |
|
|
148
|
+
| `go.mod` / `Cargo.toml` without django/fastapi | Generic Backend |
|
|
149
|
+
| `index.html` / react/vue dependencies | Generic Frontend |
|
|
150
|
+
| `AndroidManifest.xml` present | Android |
|
|
151
|
+
| `artisan` present | Laravel |
|
|
152
|
+
| `composer.json` or `*.php` present | PHP |
|
|
153
|
+
|
|
154
|
+
### Next.js
|
|
155
|
+
|
|
156
|
+
When a Next.js project is detected, include the following skill invocation
|
|
157
|
+
instruction in the delegation message for each agent:
|
|
158
|
+
|
|
159
|
+
| Delegated agent | Instruction to include in delegation |
|
|
160
|
+
| --------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
161
|
+
| `architect` | "Invoke the `nextjs-typescript` skill before designing." |
|
|
162
|
+
| `implementer` | "Invoke `nextjs-typescript` before writing any code." |
|
|
163
|
+
| `tester` | "Invoke `testing-tdd` and write Next.js unit and integration tests (using Vitest or Playwright)." |
|
|
164
|
+
| `reviewer` | "Invoke the `nextjs-typescript` skill to check component boundaries (RSC vs RCC) and validation rules." |
|
|
165
|
+
|
|
166
|
+
### FastAPI
|
|
167
|
+
|
|
168
|
+
When a FastAPI project is detected, include the following skill invocation
|
|
169
|
+
instruction in the delegation message for each agent:
|
|
170
|
+
|
|
171
|
+
| Delegated agent | Instruction to include in delegation |
|
|
172
|
+
| --------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
173
|
+
| `architect` | "Invoke the `python-fastapi-stack` and `sqlalchemy` skills before designing." |
|
|
174
|
+
| `implementer` | "Invoke `python-fastapi-stack` and `sqlalchemy` before writing any code." |
|
|
175
|
+
| `tester` | "Invoke Python testing guidelines to write FastAPI endpoint contract tests." |
|
|
176
|
+
| `reviewer` | "Invoke `python` to verify FastAPI routers and SQLAlchemy async patterns." |
|
|
177
|
+
|
|
178
|
+
### Generic Backend
|
|
179
|
+
|
|
180
|
+
When a generic backend project is detected, include the following skill invocation
|
|
181
|
+
instruction in the delegation message for each agent:
|
|
182
|
+
|
|
183
|
+
| Delegated agent | Instruction to include in delegation |
|
|
184
|
+
| --------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
185
|
+
| `architect` | "Invoke the `security` skill to review backend boundaries, authentication schemes, and data validation rules." |
|
|
186
|
+
| `implementer` | "Invoke `security` to ensure inputs are validated, parameterized queries are used, and secrets are not exposed." |
|
|
187
|
+
| `reviewer` | "Invoke `security` to check for injection vulnerabilities, resource leaks, and lack of authorization checks." |
|
|
188
|
+
|
|
189
|
+
### Android
|
|
190
|
+
|
|
191
|
+
When an Android project is detected, include the following skill invocation instruction in the delegation message for each agent:
|
|
192
|
+
|
|
193
|
+
| Delegated agent | Instruction to include in delegation |
|
|
194
|
+
| --------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
195
|
+
| `architect` | "Invoke the `android` skill before designing." |
|
|
196
|
+
| `implementer` | "Invoke `android` before writing any code." |
|
|
197
|
+
| `tester` | "Invoke the `android` skill to write unit or instrumentation tests (JUnit 5, MockK, Espresso, Compose UI Testing)." |
|
|
198
|
+
| `reviewer` | "Invoke the `android` skill to verify Jetpack Compose components stability, ExoPlayer resource cleanup, and Kotlin Coroutines/Flows dispatchers." |
|
|
199
|
+
|
|
200
|
+
### Laravel
|
|
201
|
+
|
|
202
|
+
When a Laravel project is detected, include the following skill invocation instruction in the delegation message for each agent:
|
|
203
|
+
|
|
204
|
+
| Delegated agent | Instruction to include in delegation |
|
|
205
|
+
| --------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
206
|
+
| `architect` | "Invoke the `laravel-specialist` and `php-pro` skills before designing." |
|
|
207
|
+
| `implementer` | "Invoke `laravel-specialist` and `php-pro` before writing any code." |
|
|
208
|
+
| `tester` | "Invoke the `laravel-specialist` skill to write Pest/PHPUnit tests for Laravel features." |
|
|
209
|
+
| `reviewer` | "Invoke the `laravel-specialist` skill to verify Eloquent queries, Sanctum authentication, and Livewire components." |
|
|
210
|
+
|
|
211
|
+
### PHP
|
|
212
|
+
|
|
213
|
+
When a PHP project is detected, include the following skill invocation instruction in the delegation message for each agent:
|
|
214
|
+
|
|
215
|
+
| Delegated agent | Instruction to include in delegation |
|
|
216
|
+
| --------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
217
|
+
| `architect` | "Invoke the `php-pro` skill before designing." |
|
|
218
|
+
| `implementer` | "Invoke `php-pro` before writing any code." |
|
|
219
|
+
| `tester` | "Invoke PHP testing and quality assurance guidelines in the `php-pro` skill." |
|
|
220
|
+
| `reviewer` | "Invoke the `php-pro` skill to analyze strict typing, PHPStan level 9 violations, and PSR standards." |
|
|
221
|
+
|
|
222
|
+
### Generic Frontend
|
|
223
|
+
|
|
224
|
+
When a generic frontend project is detected, include the following skill invocation
|
|
225
|
+
instruction in the delegation message for each agent:
|
|
226
|
+
|
|
227
|
+
| Delegated agent | Instruction to include in delegation |
|
|
228
|
+
| --------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
229
|
+
| `architect` | "Invoke the `security` skill and accessibility guidelines to plan keyboard navigation and semantic HTML structures." |
|
|
230
|
+
| `implementer` | "Invoke `modern-web-guidance` and accessibility rules to implement semantically clean and keyboard-accessible UI." |
|
|
231
|
+
| `tester` | "Invoke `a11y-debugging` to verify focus handling, tab order, and screen reader labels." |
|
|
232
|
+
| `reviewer` | "Verify compliance with frontend security standards and web accessibility guidelines." |
|
|
233
|
+
|
|
234
|
+
### Monorepo Workspaces
|
|
235
|
+
|
|
236
|
+
When a monorepo workspace signal is present, include this instruction for ALL agents:
|
|
237
|
+
|
|
238
|
+
> "This is a monorepo. Focus all file reads, edits, and commands strictly within
|
|
239
|
+
> the sub-package or workspace directory specified in the Task Card scope. Avoid
|
|
240
|
+
> modifying files or running commands outside this package's directory."
|
|
145
241
|
|
|
146
242
|
### Python / Django / PostgreSQL
|
|
147
243
|
|
|
@@ -155,7 +251,7 @@ instruction in the delegation message for each agent:
|
|
|
155
251
|
| `tester` | "Invoke `django-testing` before writing any test. The project uses multi-tenant PostgreSQL — do not use `TestCase` for tenant app models." |
|
|
156
252
|
| `reviewer` | "Invoke `python` to check clean code conventions before reviewing." |
|
|
157
253
|
|
|
158
|
-
**TDD gate for medium and high risk Python tasks:**
|
|
254
|
+
**TDD gate for medium and high risk Python/Backend tasks:**
|
|
159
255
|
|
|
160
256
|
For tasks classified medium or high, modify the agent sequence to enforce
|
|
161
257
|
test-first development:
|
|
@@ -176,6 +272,30 @@ Include this instruction in the `implementer` delegation:
|
|
|
176
272
|
|
|
177
273
|
---
|
|
178
274
|
|
|
275
|
+
## Intense Workflow — Loop Agent Mode
|
|
276
|
+
|
|
277
|
+
For high-complexity tasks, or when verification tests fail, the orchestrator
|
|
278
|
+
routes the agents through an iterative feedback loop:
|
|
279
|
+
|
|
280
|
+
1. **Cycle**: Implementer -> Tester -> Orchestrator validation.
|
|
281
|
+
2. If the `tester` reports failing tests:
|
|
282
|
+
- Route back to `implementer` with the specific test failures.
|
|
283
|
+
- Instruct the implementer to make target adjustments to resolve the failures.
|
|
284
|
+
3. This cycle repeats up to 3 times. If tests are still failing after the 3rd iteration, escalate to the human with a full diagnostics summary.
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Multi-Team / Teammate Delegation
|
|
289
|
+
|
|
290
|
+
When the preset target supports multi-team execution (e.g. Claude Code with
|
|
291
|
+
`CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` enabled):
|
|
292
|
+
1. Spawn parallel teammates (`tester`, `reviewer`, etc.) to run verification and checks concurrently when possible.
|
|
293
|
+
2. Assign the most cost-efficient models for secondary roles:
|
|
294
|
+
- Primary Orchestrator / Architect: `sonnet` / `pro` (maximum context / reasoning).
|
|
295
|
+
- Task Coach, Docs, Repo Explorer, Reviewer: `haiku` / `flash` (fast, cost-effective).
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
179
299
|
## Routing documentation
|
|
180
300
|
|
|
181
301
|
Every routing decision must be documented in this format before the first agent
|
|
@@ -123,6 +123,37 @@ _(none)_ — if no suggestions
|
|
|
123
123
|
- **approved with warnings** — no CRITICAL, at least one WARNING
|
|
124
124
|
- **approved** — no CRITICAL, no WARNING (suggestions do not block)
|
|
125
125
|
|
|
126
|
+
## Stricter Stack-Specific Checklist
|
|
127
|
+
|
|
128
|
+
Apply these detailed checks based on the detected stack:
|
|
129
|
+
|
|
130
|
+
### Next.js
|
|
131
|
+
- [ ] RSC vs RCC boundary: Client directives (`"use client"`) are only placed on interactive leaf node files, not on static layouts/pages.
|
|
132
|
+
- [ ] Server Actions input: Every Server Action validates `FormData` or arguments using a schema library (like Zod) before performing mutations. No raw data is trusted.
|
|
133
|
+
- [ ] Browser APIs: Window, document, and localStorage access are guarded (e.g. `typeof window !== 'undefined'`) or only run inside `useEffect`.
|
|
134
|
+
|
|
135
|
+
### FastAPI
|
|
136
|
+
- [ ] Request Typing: All endpoints use typed Pydantic models (v2) for request bodies and path/query parameters.
|
|
137
|
+
- [ ] Dependency Injection: Middleware, databases, and services are injected cleanly using FastAPI `Depends`.
|
|
138
|
+
|
|
139
|
+
### Generic Backend
|
|
140
|
+
- [ ] No SQL Injection: Database queries use parameterized placeholders or proper ORM queries; string concatenation or template literals for SQL are block-worthy.
|
|
141
|
+
- [ ] Resource management: Connections, files, sockets, and sessions are closed explicitly or via context managers (e.g. `with` block).
|
|
142
|
+
|
|
143
|
+
### Generic Frontend
|
|
144
|
+
- [ ] Keyboard accessibility: All interactive elements are focusable (using `button`, `a`, or explicit `tabindex="0"`) and react to both click and keydown (Enter/Space) events.
|
|
145
|
+
- [ ] ARIA & alt text: All images have descriptive `alt` attributes. Form fields have corresponding `<label>` or `aria-label` tags.
|
|
146
|
+
- [ ] Semantic HTML: Page structures use semantic landmarks (`<main>`, `<header>`, `<footer>`, `<nav>`, `<article>`, `<section>`).
|
|
147
|
+
|
|
148
|
+
### Android
|
|
149
|
+
- [ ] Jetpack Compose Stability: Ensure all custom state model classes passed to Composables are immutable (annotated with `@Immutable` or `@Stable`) to prevent unnecessary recompositions.
|
|
150
|
+
- [ ] ExoPlayer / Media3 Resource Management: Verify that ExoPlayer or Media3 player instances are properly cleaned up and released (e.g. in `onDestroy` or when the service is stopped) to prevent resource/memory leaks.
|
|
151
|
+
- [ ] Coroutine Dispatchers: Ensure Coroutines are launched using injected dispatchers rather than hardcoding `Dispatchers.IO` or `Dispatchers.Default` directly in ViewModels or domain/data service classes.
|
|
152
|
+
- [ ] Battery & Wake Locks: Verify that Wake Locks are managed carefully and released when playback is paused or stopped to prevent draining the user's battery.
|
|
153
|
+
|
|
154
|
+
### Monorepo Workspaces
|
|
155
|
+
- [ ] Workspace boundary: No relative imports escape a workspace package root to reference another package's files directly. Inter-package imports must resolve through configured workspace dependencies.
|
|
156
|
+
|
|
126
157
|
## What You Never Do
|
|
127
158
|
|
|
128
159
|
- Edit any file — source, test, documentation, or configuration
|