@event4u/agent-config 2.24.0 → 2.26.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.
Files changed (161) hide show
  1. package/.agent-src/commands/bug-fix.md +1 -0
  2. package/.agent-src/commands/create-pr/description-only.md +39 -11
  3. package/.agent-src/commands/create-pr.md +59 -5
  4. package/.agent-src/commands/feature/roadmap.md +2 -2
  5. package/.agent-src/commands/fix/seeder.md +3 -2
  6. package/.agent-src/commands/memory/add.md +3 -3
  7. package/.agent-src/commands/module/create.md +1 -0
  8. package/.agent-src/commands/module/explore.md +10 -6
  9. package/.agent-src/commands/onboard.md +9 -1
  10. package/.agent-src/commands/optimize/augmentignore.md +52 -20
  11. package/.agent-src/commands/optimize/rtk.md +56 -30
  12. package/.agent-src/commands/package-test.md +86 -10
  13. package/.agent-src/commands/quality-fix.md +49 -27
  14. package/.agent-src/commands/update-form-request-messages.md +2 -1
  15. package/.agent-src/commands/video/from-script.md +5 -5
  16. package/.agent-src/commands/video/storyboard.md +1 -1
  17. package/.agent-src/contexts/augment-infrastructure.md +4 -7
  18. package/.agent-src/contexts/communication/rules-auto/guidelines-mechanics.md +1 -1
  19. package/.agent-src/contexts/contracts/research-schema.md +1 -1
  20. package/.agent-src/contexts/execution/interrupt-examples.md +34 -0
  21. package/.agent-src/contexts/execution/roadmap-process-loop.md +69 -14
  22. package/.agent-src/contexts/skills-and-commands.md +2 -2
  23. package/.agent-src/personas/README.md +3 -2
  24. package/.agent-src/personas/ai-video-technical-director.md +2 -2
  25. package/.agent-src/personas/hollywood-director.md +3 -3
  26. package/.agent-src/profiles/content_creator.yml +5 -0
  27. package/.agent-src/rules/architecture.md +24 -10
  28. package/.agent-src/rules/artifact-drafting-protocol.md +6 -0
  29. package/.agent-src/rules/augment-edit-discipline.md +28 -0
  30. package/.agent-src/rules/augment-source-of-truth.md +2 -2
  31. package/.agent-src/rules/autonomous-execution.md +31 -0
  32. package/.agent-src/rules/context-hygiene.md +1 -1
  33. package/.agent-src/rules/domain-adoption-policy.md +4 -5
  34. package/.agent-src/rules/domain-safety-disclaimer.md +114 -0
  35. package/.agent-src/rules/domain-safety-pii.md +142 -0
  36. package/.agent-src/rules/domain-safety-retention.md +86 -0
  37. package/.agent-src/rules/downstream-changes.md +4 -4
  38. package/.agent-src/rules/framework-neutrality-in-generic-skills.md +130 -0
  39. package/.agent-src/rules/git-history-discipline.md +99 -0
  40. package/.agent-src/rules/media-governance-routing.md +82 -0
  41. package/.agent-src/rules/minimal-safe-diff.md +6 -0
  42. package/.agent-src/rules/no-roadmap-references.md +4 -2
  43. package/.agent-src/rules/persona-governance.md +90 -0
  44. package/.agent-src/rules/provider-lifecycle-discipline.md +75 -0
  45. package/.agent-src/rules/roadmap-ci-steps-policy.md +145 -0
  46. package/.agent-src/rules/roadmap-progress-sync.md +11 -5
  47. package/.agent-src/rules/user-interrupt-priority.md +46 -0
  48. package/.agent-src/rules/verify-before-complete.md +11 -2
  49. package/.agent-src/skills/adversarial-review/SKILL.md +1 -1
  50. package/.agent-src/skills/ai-council/SKILL.md +1 -0
  51. package/.agent-src/skills/api-endpoint/SKILL.md +58 -154
  52. package/.agent-src/skills/api-testing/SKILL.md +11 -0
  53. package/.agent-src/skills/character-consistency/SKILL.md +12 -1
  54. package/.agent-src/skills/code-refactoring/SKILL.md +36 -30
  55. package/.agent-src/skills/code-review/SKILL.md +41 -36
  56. package/.agent-src/skills/context-authoring/SKILL.md +1 -1
  57. package/.agent-src/skills/dashboard-design/SKILL.md +1 -2
  58. package/.agent-src/skills/database/SKILL.md +8 -3
  59. package/.agent-src/skills/dependency-upgrade/SKILL.md +65 -19
  60. package/.agent-src/skills/developer-like-execution/SKILL.md +25 -14
  61. package/.agent-src/skills/eloquent/SKILL.md +1 -1
  62. package/.agent-src/skills/feature-planning/SKILL.md +1 -1
  63. package/.agent-src/skills/file-editor/SKILL.md +45 -19
  64. package/.agent-src/skills/finishing-a-development-branch/SKILL.md +2 -2
  65. package/.agent-src/skills/git-workflow/SKILL.md +135 -2
  66. package/.agent-src/skills/laravel-api-endpoint/SKILL.md +187 -0
  67. package/.agent-src/skills/{dto-creator → laravel-dto}/SKILL.md +5 -4
  68. package/.agent-src/skills/{migration-creator → laravel-migration}/SKILL.md +11 -10
  69. package/.agent-src/skills/laravel-reverb/SKILL.md +3 -3
  70. package/.agent-src/skills/{websocket → laravel-websocket}/SKILL.md +4 -3
  71. package/.agent-src/skills/learning-to-rule-or-skill/SKILL.md +1 -1
  72. package/.agent-src/skills/merge-conflicts/SKILL.md +49 -17
  73. package/.agent-src/skills/migration-architect/SKILL.md +6 -6
  74. package/.agent-src/skills/module-management/SKILL.md +1 -0
  75. package/.agent-src/skills/motion-choreographer/SKILL.md +12 -0
  76. package/.agent-src/skills/multi-tenancy/SKILL.md +15 -8
  77. package/.agent-src/skills/pest-testing/SKILL.md +18 -0
  78. package/.agent-src/skills/php-debugging/SKILL.md +28 -0
  79. package/.agent-src/skills/php-service/SKILL.md +3 -3
  80. package/.agent-src/skills/pixar-storyteller/SKILL.md +19 -6
  81. package/.agent-src/skills/playwright-testing/SKILL.md +16 -1
  82. package/.agent-src/skills/project-analyzer/SKILL.md +68 -42
  83. package/.agent-src/skills/readme-writing-package/SKILL.md +94 -23
  84. package/.agent-src/skills/roadmap-management/SKILL.md +1 -1
  85. package/.agent-src/skills/roadmap-writing/SKILL.md +10 -0
  86. package/.agent-src/skills/rtk-output-filtering/SKILL.md +23 -8
  87. package/.agent-src/skills/rule-refactor/SKILL.md +145 -0
  88. package/.agent-src/skills/rule-writing/SKILL.md +34 -8
  89. package/.agent-src/skills/scene-expander/SKILL.md +22 -7
  90. package/.agent-src/skills/security/SKILL.md +38 -29
  91. package/.agent-src/skills/skill-reviewer/SKILL.md +1 -1
  92. package/.agent-src/skills/test-driven-development/SKILL.md +4 -4
  93. package/.agent-src/skills/test-performance/SKILL.md +6 -5
  94. package/.agent-src/skills/verify-completion-evidence/SKILL.md +24 -27
  95. package/.agent-src/skills/video-director/SKILL.md +13 -0
  96. package/.agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  97. package/.agent-src/templates/copilot-instructions.md +2 -2
  98. package/.agent-src/templates/roadmaps.md +16 -0
  99. package/.agent-src/templates/rule.md +2 -2
  100. package/.claude-plugin/marketplace.json +6 -4
  101. package/AGENTS.md +1 -1
  102. package/CHANGELOG.md +80 -133
  103. package/README.md +6 -4
  104. package/config/agent-settings.template.yml +26 -0
  105. package/docs/architecture.md +2 -2
  106. package/docs/archive/CHANGELOG-pre-2.25.0.md +191 -0
  107. package/docs/catalog.md +20 -12
  108. package/docs/contracts/file-ownership-matrix.json +588 -90
  109. package/docs/contracts/kernel-membership.md +17 -0
  110. package/docs/contracts/provider-lifecycle.md +122 -0
  111. package/docs/contracts/smoke-contracts.md +8 -8
  112. package/docs/decisions/ADR-011-domain-pack-readiness.md +213 -0
  113. package/docs/decisions/INDEX.md +1 -0
  114. package/docs/getting-started-by-role.md +10 -0
  115. package/docs/getting-started.md +1 -1
  116. package/docs/guidelines/php/api-design.md +1 -1
  117. package/docs/guidelines/php/controllers.md +1 -1
  118. package/docs/guidelines/php/resources.md +1 -1
  119. package/docs/guidelines/php/validations.md +1 -1
  120. package/docs/personas.md +73 -26
  121. package/docs/profiles.md +9 -4
  122. package/package.json +1 -1
  123. package/scripts/_tmp_scan_framework_leakage.py +119 -0
  124. package/scripts/ai-video/adapters/gemini-veo.sh +5 -0
  125. package/scripts/ai-video/adapters/higgsfield.sh +6 -0
  126. package/scripts/ai-video/adapters/kling.sh +5 -0
  127. package/scripts/ai-video/adapters/openai-images.sh +5 -0
  128. package/scripts/ai-video/adapters/sora.sh +6 -0
  129. package/scripts/build_linear_digest.py +0 -1
  130. package/scripts/check_portability.py +6 -0
  131. package/scripts/lint_framework_leakage.py +348 -0
  132. package/scripts/lint_framework_leakage_allowlist.json +476 -0
  133. package/scripts/lint_media_policy_linkage.py +140 -0
  134. package/scripts/lint_persona_governance.py +164 -0
  135. package/scripts/lint_roadmap_ci_steps.py +182 -0
  136. package/scripts/measure_augment_budget.py +6 -0
  137. package/scripts/schemas/command.schema.json +5 -0
  138. package/scripts/schemas/skill.schema.json +5 -0
  139. package/scripts/skill_linter.py +60 -7
  140. package/scripts/smoke/kernel.sh +4 -4
  141. package/scripts/smoke/router.sh +2 -2
  142. package/scripts/smoke/schema.sh +1 -1
  143. package/.agent-src/personas/pixar-storyboard-artist.md +0 -98
  144. package/.agent-src/rules/agent-docs.md +0 -20
  145. package/.agent-src/rules/augment-portability.md +0 -23
  146. package/.agent-src/rules/capture-learnings.md +0 -19
  147. package/.agent-src/rules/docs-sync.md +0 -20
  148. package/.agent-src/rules/domain-safety-disclaimer-consulting.md +0 -52
  149. package/.agent-src/rules/domain-safety-disclaimer-financial.md +0 -54
  150. package/.agent-src/rules/domain-safety-disclaimer-legal.md +0 -49
  151. package/.agent-src/rules/domain-safety-disclaimer-medical.md +0 -56
  152. package/.agent-src/rules/domain-safety-export-redact.md +0 -65
  153. package/.agent-src/rules/domain-safety-logging-pii-floor.md +0 -55
  154. package/.agent-src/rules/domain-safety-pii-finance.md +0 -57
  155. package/.agent-src/rules/domain-safety-pii-marketing.md +0 -60
  156. package/.agent-src/rules/domain-safety-pii-recruiting.md +0 -56
  157. package/.agent-src/rules/domain-safety-pii-support.md +0 -57
  158. package/.agent-src/rules/domain-safety-retention-finance.md +0 -48
  159. package/.agent-src/rules/domain-safety-retention-support.md +0 -55
  160. package/.agent-src/rules/e2e-testing.md +0 -19
  161. package/.agent-src/rules/no-unsolicited-rebase.md +0 -107
@@ -25,16 +25,17 @@ Roadmap touch = create / rename / delete / move file, add/rename/remove a phase,
25
25
  ```
26
26
  EVERY DONE STEP FLIPS [ ] → [x] IN THE SAME REPLY THAT LANDS THE WORK.
27
27
  NO "I UPDATE THE ROADMAP AT THE END OF THE PHASE."
28
- NO "FOUR STEPS DONE, ONE COMMIT, ONE REGEN."
29
28
  A REPLY THAT LANDS A VERIFIED STEP WITHOUT FLIPPING ITS CHECKBOX
30
29
  IS A RULE VIOLATION, NOT AN OVERSIGHT.
31
30
  ```
32
31
 
33
- `/roadmap:process-step`, `/roadmap:process-phase`, `/roadmap:process-full`, and any other multi-step autonomous run flip the box for step N **before** moving on to step N+1. The dashboard is a real-time monitor, not a post-hoc summary. Batched flips at the archive commit defeat the dashboard's purpose.
32
+ `/roadmap:process-step`, `/roadmap:process-phase`, `/roadmap:process-full`, and any other multi-step autonomous run flip the box for step N **before** moving on to step N+1. The checkbox itself is the real-time monitor the markdown file is the source of truth, the dashboard is a derived view.
34
33
 
35
34
  **Step counts as done** when its code/doc change is written and saved AND the verification cited in the step has passed (fresh output in this reply or an earlier one).
36
35
 
37
- **In-progress marker.** When a step takes more than one reply, mark it `[~]` the moment work starts and regen — the user sees one row move `[ ] → [~] → [x]` instead of silent rows. `[~]` stays open for `count_open` but advances the phase percentage.
36
+ **In-progress marker.** When a step takes more than one reply, mark it `[~]` the moment work starts — the user sees one row move `[ ] → [~] → [x]` instead of silent rows. `[~]` stays open for `count_open` but advances the phase percentage.
37
+
38
+ **Dashboard regen cadence — opt-in batching.** The checkbox flip is non-batchable. The **subprocess regen** (`./agent-config roadmap:progress`) is batchable per `roadmap.dashboard_regen_cadence` in `.agent-settings.yml` (`per_step` default · `every_5_steps` · `phase_boundary`). Run end, phase boundary, and any file-shape touch (rename / phase add / archive — Iron Law 1) always force an immediate regen regardless of cadence.
38
39
 
39
40
  ## Pre-send self-check — MANDATORY
40
41
 
@@ -42,10 +43,15 @@ Before sending any reply that landed roadmap work:
42
43
 
43
44
  1. Did this reply land a step (code/doc saved + verification passed)?
44
45
  2. Is its checkbox flipped to `[x]` / `[~]` / `[-]` in `agents/roadmaps/<file>.md`? If no → flip, then continue.
45
- 3. Did `./agent-config roadmap:progress` run after the flip? If no → run, then continue.
46
+ 3. Is regen due now per `roadmap.dashboard_regen_cadence`?
47
+ - `per_step` → yes, always.
48
+ - `every_5_steps` → yes when this is the 5th, 10th, … closed step in the run, or the last step of the reply.
49
+ - `phase_boundary` → only when this reply closes the phase or run.
50
+ - Any file-shape touch (rename / phase add / archive) → yes, regardless of cadence.
51
+ If yes and not run yet → run `./agent-config roadmap:progress`, then continue.
46
52
  4. Did `count_open` reach 0? If yes → `git mv` to `archive/` and regen again — same reply.
47
53
 
48
- Any "no" at step 2 or 3 → reply is incomplete. Do not send.
54
+ Any "no" at step 2 → reply is incomplete. Do not send. A skipped step 3 regen is fine when cadence permits — checkbox truth lives in the markdown file.
49
55
 
50
56
  Long-form mechanics (failure-mode catalog, Copilot fallback, `[~]` vs `[ ]` semantics, hook + CI defence-in-depth) live in `guideline:agent-infra/roadmap-progress-mechanics`.
51
57
  Trigger-set above activates this routing under the `balanced` and `full` profiles.
@@ -0,0 +1,46 @@
1
+ ---
2
+ type: "always"
3
+ tier: "1"
4
+ description: "User interrupts override the current task — STOP, complete new task in full, then ASK before resuming; never silently return to prior work"
5
+ alwaysApply: true
6
+ source: package
7
+ load_context:
8
+ - ../contexts/execution/interrupt-examples.md
9
+ ---
10
+
11
+ # User-Interrupt Priority
12
+
13
+ A new instruction mid-flight is **not** a continuation. Examples and failure modes: [`contexts/execution/interrupt-examples.md`](../contexts/execution/interrupt-examples.md).
14
+
15
+ ## The Iron Law
16
+
17
+ ```
18
+ NEW TASK FROM USER MID-FLIGHT → STOP CURRENT TASK.
19
+ COMPLETE NEW TASK IN FULL.
20
+ THEN ASK BEFORE RESUMING THE OLD TASK.
21
+ NEVER SILENTLY RESUME.
22
+ ```
23
+
24
+ Holds regardless of `personal.autonomy`, a standing autonomy directive, or roadmap authorization. Autonomy narrows trivial workflow questions — it does not authorize ignoring a fresh instruction.
25
+
26
+ ## Classify every user turn
27
+
28
+ | Bucket | Signal | Action |
29
+ |---|---|---|
30
+ | **Continuation** | Same deliverable + target + success criterion. "weiter", "next step". | Keep working. |
31
+ | **Clarification** | Question / correction about the current task. No new deliverable. | Answer, then continue. |
32
+ | **Interrupt** | Different deliverable, target, or success criterion. Meta-tasks ("audit", "stop and analyze") count. | STOP. Run new task. ASK before resume. |
33
+
34
+ In doubt → treat as interrupt. Cost of a spurious ask is one turn; cost of silent-resume is the rest of the unwanted work.
35
+
36
+ ## Stop-ask-resume protocol
37
+
38
+ 1. **STOP** — abandon the current tool plan. No "one more check" unless the new instruction says so.
39
+ 2. **EXECUTE** the new task in full. All other rules (Hard Floor, scope, autonomy) apply.
40
+ 3. **ASK** when done — name the interrupted task and request a resume decision:
41
+
42
+ ```
43
+ Done with <new task>. Resume <interrupted task name>? (yes / no / different)
44
+ ```
45
+
46
+ Only resume on `yes` or a restatement. "and then continue with X" = explicit resume authorization; no re-ask.
@@ -22,7 +22,7 @@ If you haven't run the verification command **in this message**, you cannot clai
22
22
 
23
23
  Before claiming ANY work is complete:
24
24
 
25
- 1. **IDENTIFY** — What command proves this claim? (tests, PHPStan, build, etc.)
25
+ 1. **IDENTIFY** — What command proves this claim? (tests, type-checker, linter, build — whichever the project actually runs)
26
26
  2. **RUN** — Execute the full command (fresh, complete, not cached)
27
27
  3. **READ** — Full output, check exit code, count failures
28
28
  4. **VERIFY** — Does the output actually confirm the claim?
@@ -43,7 +43,7 @@ Skip any step = the claim is unverified.
43
43
  - Expressing satisfaction before running verification
44
44
  - About to commit/push without running tests + quality
45
45
  - Trusting a previous run from earlier in the conversation
46
- - Relying on partial verification (ran tests but not PHPStan)
46
+ - Relying on partial verification (ran tests but skipped the type-checker / linter)
47
47
  - ANY wording implying success without fresh evidence
48
48
 
49
49
  ## Verification commands
@@ -64,3 +64,12 @@ all live in
64
64
  The Iron Law and the Gate above are the obligation surface; the
65
65
  mechanics context is the lookup material the agent pulls when the
66
66
  gate fires.
67
+
68
+ ## Examples
69
+
70
+ Pattern Memory — wrong / right / why demos for the Iron Law and the
71
+ red-flags list:
72
+ [`verify-before-complete-demos`](../docs/guidelines/agent-infra/verify-before-complete-demos.md)
73
+ (hedged claims, trusting earlier runs, partial-verification creep).
74
+ Outcome baseline locked at
75
+ [`tests/golden/outcomes/verify_before_complete.json`](../../tests/golden/outcomes/verify_before_complete.json).
@@ -104,7 +104,7 @@ Only surface trade-offs or concerns that need the user's input.
104
104
  - **feature-planning** — adversarial review after Understanding Lock, before presenting the plan.
105
105
  - **bug-analyzer** — review the proposed fix before implementing.
106
106
  - **code-review** — self-review before creating a PR.
107
- - **migration-creator** — review migration for data safety.
107
+ - **laravel-migration** (or framework-native equivalent) — review migration for data safety.
108
108
  - **api-design** — review API design for consistency and breaking changes.
109
109
  - **security** — review security-sensitive changes for attack surface.
110
110
 
@@ -3,6 +3,7 @@ name: ai-council
3
3
  description: "Use when polling external AIs (OpenAI, Anthropic) outside the host session for a neutral second opinion on a roadmap, diff, prompt, or file set — or 'cross-check with another model'."
4
4
  source: package
5
5
  domain: process
6
+ meta_skill: true
6
7
  ---
7
8
 
8
9
  <!-- cloud_safe: degrade -->
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: api-endpoint
3
- description: "Use when the user says "create endpoint", "new API route", or "add controller". Creates a complete endpoint with Controller, FormRequest, Resource, route, and OpenAPI docs."
3
+ description: "Use when creating an API endpoint or HTTP route handler detects the project stack and routes to the matching carve-out (laravel-api-endpoint, nextjs-patterns, symfony-workflow)."
4
4
  source: package
5
5
  domain: engineering
6
6
  ---
@@ -9,178 +9,82 @@ domain: engineering
9
9
 
10
10
  ## When to use
11
11
 
12
- Use this skill when the user asks to create a new API endpoint, REST route, or controller action.
13
-
12
+ Use this skill when the user asks to create a new API endpoint, REST route, or HTTP handler.
14
13
 
15
14
  Do NOT use when:
16
- - Modifying existing endpoints (use `code-refactoring` skill)
17
- - API design decisions (use `api-design` skill)
18
-
19
- ## Procedure: Create an API endpoint
20
-
21
- 1. **Read project docs** Check `./agents/` and `AGENTS.md` for controller conventions, resource patterns, routing.
22
- 2. **Create route** — Add to the correct `routes/api.php` or module route file.
23
- 3. **Create controller** Thin controller, delegate logic to service.
24
- 4. **Create FormRequest** — Validate all input at the boundary.
25
- 5. **Create Resource** — Transform model output via API Resource.
26
- 6. **Verify** — Run PHPStan, run tests, confirm response shape matches conventions.
27
-
28
- ## Laravel projects
29
-
30
- ### What to generate
31
-
32
- 1. **Controller** — Single Action (invokable). Read `agents/docs/controller.md` and `../../../docs/guidelines/php/controllers.md`.
33
- 2. **FormRequest** — Validation rules, `authorize()` via policies. Read `../../../docs/guidelines/php/validations.md`.
34
- 3. **Resource** — JSON response transformation. Read `agents/docs/api-resources.md`.
35
- 4. **Route** — Add to the correct versioned route file.
36
- 5. **Policy** — If authorization is needed.
37
- 6. **Filter classes** — If it's a list endpoint with filtering. Read `agents/docs/query-filter.md` (if it exists).
38
-
39
- ### Conventions
40
-
41
- - Controllers are thin — delegate to Services.
42
- - **Every controller MUST return an API Resource** — never raw arrays, models, or `response()->json()`.
43
- - Controllers type-hint the return value as the Resource class (e.g. `): ProjectResource`).
44
- - Use `Resource::make()` for single items, `Resource::collection()` for lists.
45
- - Use method injection on `__invoke()` for new controllers.
46
- - Use DTOs for data transfer between layers.
47
-
48
- ### Show endpoint example
49
-
50
- ```php
51
- declare(strict_types=1);
52
-
53
- namespace App\Http\Controllers\v1\Project;
54
-
55
- use App\Http\Controllers\Controller;
56
- use App\Http\Requests\v1\Projects\ShowProjectRequest;
57
- use App\Http\Resources\v1\Project\ProjectResource;
58
- use App\Models\ExternalCustomerDatabase\Project\Project;
59
- use App\OpenApi\Schema\Request\ShowResourceRequestSchema;
60
- use App\OpenApi\Schema\Response\ResourceNotFoundResponse;
61
- use App\OpenApi\Schema\Response\ShowResourceResponseSchema;
62
-
63
- class ShowProjectController extends Controller
64
- {
65
- #[ShowResourceRequestSchema(path: '/projects/{id}', version: '1', resource: ProjectResource::class)]
66
- #[ShowResourceResponseSchema(ProjectResource::class, wrapInDataObject: false)]
67
- #[ResourceNotFoundResponse(ProjectResource::class)]
68
- public function __invoke(ShowProjectRequest $request, Project $project): ProjectResource
69
- {
70
- return ProjectResource::make($project);
71
- }
72
- }
73
- ```
74
-
75
- ### Create endpoint with service injection
76
-
77
- ```php
78
- class CreateCustomerController extends Controller
79
- {
80
- #[CreateCustomerRequestSchema(path: '/customers', version: '1', resource: CustomerResource::class)]
81
- #[CreateResourceResponseSchema(resource: CreatedCustomerResource::class, wrapInDataObject: false)]
82
- #[ValidationErrorResponse]
83
- public function __invoke(
84
- CreateCustomerRequest $request,
85
- CustomerModelService $customerService,
86
- ): CustomerResource {
87
- $result = $customerService->create(CreateCustomerDTO::fromRequest($request));
88
-
89
- return CreatedCustomerResource::make($result);
90
- }
91
- }
92
- ```
93
-
94
- ### FormRequest example
95
-
96
- ```php
97
- declare(strict_types=1);
98
-
99
- namespace App\Http\Requests\v1\Projects;
100
-
101
- use Illuminate\Foundation\Http\FormRequest;
102
-
103
- class ShowProjectRequest extends FormRequest
104
- {
105
- public function authorize(): bool
106
- {
107
- return $this->user()->can('view', $this->route('project'));
108
- }
109
-
110
- /** @return array<string, mixed> */
111
- public function rules(): array
112
- {
113
- return [];
114
- }
115
- }
116
- ```
117
-
118
- ### List endpoint with CollectionFormRequest
119
-
120
- For list endpoints, extend `CollectionFormRequest` which provides `perPage`, `page`, and `orderBy` rules:
121
-
122
- ```php
123
- use App\Contracts\Http\Requests\CollectionFormRequest;
124
-
125
- class ListProjectsRequest extends CollectionFormRequest
126
- {
127
- public string $model = Project::class;
128
-
129
- /** @return array<string, mixed> */
130
- public function rules(): array
131
- {
132
- return [
133
- ...parent::rules(),
134
- 'status' => ['sometimes', 'string'],
135
- ];
136
- }
137
- }
138
- ```
139
-
140
- ### File locations
141
-
142
- | Component | Path |
15
+ - Modifying existing endpoints use the code-refactoring skill.
16
+ - API design decisions (versioning, deprecation, contract shape) — use [`api-design`](../api-design/SKILL.md).
17
+
18
+ ## Stack routing
19
+
20
+ Detect the stack, then hand off to the matching carve-out skill for the framework-specific procedure (file layout, validation primitive, response-shaping convention).
21
+
22
+ | Detected stack | Carve-out skill |
143
23
  |---|---|
144
- | Controller | `app/Http/Controllers/v{N}/{Domain}/{Action}{Entity}Controller.php` |
145
- | FormRequest | `app/Http/Requests/v{N}/{Domain}/{Action}{Entity}Request.php` |
146
- | Resource | `app/Http/Resources/v{N}/{Domain}/{Entity}Resource.php` |
147
- | Route | `routes/api/v{N}/{domain}.php` |
148
- | Policy | `app/Policies/{Entity}Policy.php` |
24
+ | Laravel (`artisan` + `composer.json` with `laravel/framework`) | [`laravel-api-endpoint`](../laravel-api-endpoint/SKILL.md) |
25
+ | Symfony (`bin/console` + `composer.json` with `symfony/framework-bundle`) | [`symfony-workflow`](../symfony-workflow/SKILL.md) |
26
+ | Next.js (`next` in `package.json`) | [`nextjs-patterns`](../nextjs-patterns/SKILL.md) |
27
+ | Express / Fastify / NestJS / plain Node | follow project conventions in `agents/` + `package.json scripts` |
28
+ | FastAPI / Django / Flask | follow project conventions in `agents/` + `pyproject.toml` |
29
+ | Go (`net/http`, `gin`, `echo`, `fiber`) | follow project conventions in `agents/` + `go.mod` |
30
+ | Rust (`axum`, `actix-web`, `rocket`) | follow project conventions in `agents/` + `Cargo.toml` |
31
+
32
+ If the project doc folder (`agents/`) has an endpoint-creation guide, that is the source of truth — read it before generating code.
33
+
34
+ ## Procedure: Create an API endpoint (stack-neutral)
35
+
36
+ 1. **Read project docs** — Check `./agents/` and `AGENTS.md` for endpoint conventions, routing layout, response shape.
37
+ 2. **Detect stack** and route to the carve-out per the table above.
38
+ 3. **Plan the endpoint** — method, path, request shape, response shape, auth requirement, idempotency.
39
+ 4. **Create the route registration** in the project's routing surface (route file, decorator-annotated handler, file-based router).
40
+ 5. **Create the request handler / controller** — thin; delegate business logic to a service / use-case.
41
+ 6. **Validate input at the boundary** via the framework's validation primitive (FormRequest, Zod, class-validator, Pydantic, struct-tag validators, etc.) — never inline ad-hoc `if` checks.
42
+ 7. **Authorize the action** via the framework's authz primitive (Policy, voter, guard, middleware, route dependency).
43
+ 8. **Shape the response** through a transformer / serializer / DTO — never return raw ORM entities.
44
+ 9. **Document** the endpoint (OpenAPI annotations / generated spec / project doc).
45
+ 10. **Verify** — run the project type-checker + targeted tests + smoke probe (`curl` / Bruno / Postman / integration test).
46
+
47
+ ## Conventions (apply on every stack)
48
+
49
+ - **One handler, one responsibility** — prefer single-purpose handlers over multi-action controllers when the framework supports it.
50
+ - **No business logic in the handler** — delegate to a service / use-case layer.
51
+ - **Validate at the boundary** — never trust raw request data inside the handler.
52
+ - **Authorize every state-changing action** — no unprotected mutating endpoints.
53
+ - **Shape responses through a transformer** — DTO, serializer, API resource, response model — never expose raw ORM entities.
54
+ - **Version the API surface** explicitly (`/v1/`, header, content-type) — don't rely on implicit versioning.
149
55
 
150
- ### OpenAPI documentation
56
+ ## Stack-specific procedures
151
57
 
152
- Controllers use PHP 8 attributes for OpenAPI spec generation from `App\OpenApi\Schema\`:
58
+ For Laravel projects (the most fully-fleshed-out carve-out in this package), see [`laravel-api-endpoint`](../laravel-api-endpoint/SKILL.md) — covers single-action controllers, `FormRequest`, `Resource`, `Policy`, `CollectionFormRequest`, OpenAPI attributes, and the versioned route layout.
153
59
 
154
- - `ShowResourceRequestSchema`, `ListResourceRequestSchema`, `CreateResourceRequestSchema`
155
- - `ShowResourceResponseSchema`, `ListResourceResponseSchema`, `CreateResourceResponseSchema`
156
- - `ResourceNotFoundResponse`, `ValidationErrorResponse`
60
+ For other stacks, read the matching carve-out from the table above and combine with the project's `agents/` docs.
157
61
 
158
62
  ## Output format
159
63
 
160
- 1. Generated files — controller, route registration, FormRequest, Resource, Policy
161
- 2. Test file with happy path and validation error cases
162
- 3. Summary of created files and their locations
64
+ 1. Generated files — route registration, handler, request validator, response shaper, authorization rule.
65
+ 2. Test file with happy path and validation-error cases (using the project's test framework).
66
+ 3. Summary of created files and their locations.
163
67
 
164
68
  ## Gotcha
165
69
 
166
- - Don't forget to register the route — creating the controller without the route is a common miss.
70
+ - Don't forget to register the route — creating the handler without the route is a common miss.
167
71
  - Always check if a similar endpoint already exists — duplicates cause confusion.
168
- - FormRequest validation rules must match the OpenAPI schema — keep them in sync.
169
- - The model tends to forget the `return` type on Resource `toArray()` methods.
72
+ - Validation rules must match the documented contract (OpenAPI / schema / typed client) — keep them in sync.
73
+ - Response shapes are part of the public contract adding a field is additive; renaming or removing is breaking.
170
74
 
171
75
  ## Do NOT
172
76
 
173
- - Do NOT put business logic in controllers — delegate to services.
174
- - Do NOT skip FormRequest validation — every controller needs a FormRequest.
175
- - Do NOT return raw Eloquent models — always use API Resources.
176
- - Do NOT create routes without proper authorization (Policy in FormRequest or middleware).
177
- - Do NOT create multi-action controllersonly single-action with `__invoke()`.
178
- - Do NOT use `response()->json()` — use `Resource::make()`.
77
+ - Do NOT put business logic in the handler — delegate to services / use-cases.
78
+ - Do NOT skip request validation — every handler validates at the boundary via the framework's primitive.
79
+ - Do NOT return raw ORM entities — always go through a transformer / serializer / response model.
80
+ - Do NOT create unprotected state-changing endpoints authorize every mutation.
81
+ - Do NOT improvise framework idiomsread the carve-out (`laravel-api-endpoint`, `nextjs-patterns`, etc.) for the stack-correct shape.
179
82
 
180
83
  ## Auto-trigger keywords
181
84
 
182
85
  - create endpoint
183
86
  - new API route
87
+ - route handler
184
88
  - controller creation
185
- - form request
186
- - API resource
89
+ - REST endpoint
90
+ - add endpoint
@@ -151,6 +151,17 @@ expect($data['title'])->toBeString();
151
151
  expect($data['total'])->toBeString(); // Money as string, not float
152
152
  ```
153
153
 
154
+ When a failing test dumps the full JSON body, narrow the diagnosis with `jq` or `grep`
155
+ instead of scrolling the whole payload:
156
+
157
+ ```bash
158
+ # Extract only the failing assertion path
159
+ echo "$RESPONSE_JSON" | jq '.data.status, .errors'
160
+
161
+ # Targeted log scan
162
+ rg --json 'API call failed' storage/logs/laravel.log | jq -r '.data.lines.text'
163
+ ```
164
+
154
165
  ## External service mocking
155
166
 
156
167
  ```php
@@ -2,7 +2,6 @@
2
2
  name: character-consistency
3
3
  description: "Use when a character must stay visually identical across AI video scenes — locks identity tokens (silhouette, palette, wardrobe, prop) in JSON. Triggers 'character lock', 'same character'."
4
4
  personas:
5
- - pixar-storyboard-artist
6
5
  - hollywood-director
7
6
  source: package
8
7
  domain: product
@@ -118,3 +117,15 @@ the lock.
118
117
  - Do NOT skip the reference frame after the first render — visual
119
118
  regression has nothing to compare against.
120
119
  - Do NOT lock a character that appears in only one scene.
120
+
121
+ ## Policies
122
+
123
+ When a character lock would identify or render a real person, consult before emitting the JSON:
124
+
125
+ - [`agents/policies/media/likeness.md`](../../../agents/policies/media/likeness.md) — real-person identity tokens require a cited likeness release.
126
+ - [`agents/policies/media/public-figures.md`](../../../agents/policies/media/public-figures.md) — recognised public figures carry the harder gate (publicity rights + transformative-intent).
127
+ - [`agents/policies/media/voice-cloning.md`](../../../agents/policies/media/voice-cloning.md) — when `voice_note` references a real person's voice.
128
+ - [`agents/policies/media/disclosure.md`](../../../agents/policies/media/disclosure.md) — outputs carrying a real-person lock require the non-removable AI-generation disclosure downstream.
129
+
130
+ Refuse-and-surface the file path; do not silently sanitise the prompt.
131
+
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: code-refactoring
3
- description: "Use when the user says "refactor this", "rename class", or "move method". Safely refactors PHP code — finds all callers, updates downstream dependencies, and verifies with quality tools."
3
+ description: "Use when the user says 'refactor this', 'rename class', or 'move method'. Safely refactors code in any language — finds all callers, updates downstream dependencies, verifies via quality tools."
4
4
  source: package
5
5
  domain: engineering
6
6
  ---
@@ -20,7 +20,7 @@ Do NOT use when:
20
20
  ## Before refactoring
21
21
 
22
22
  1. **Read the agent docs** — check `agents/docs/` and `agents/contexts/` for the area you're refactoring.
23
- For modules, also read `app/Modules/{Module}/agents/`. See the `project-docs` skill for the mapping.
23
+ For modules, also read the project's module-docs directory (path varies by stack — Laravel: `app/Modules/{Module}/agents/`; Nx: `apps/{app}/docs/`; mono-repo: per-package `docs/`). See the `project-docs` skill for the mapping.
24
24
  2. **Understand the scope** — what exactly needs to change and why?
25
25
  3. **Find ALL references** — use `codebase-retrieval` and `view` with `search_query_regex` to find every
26
26
  caller, implementation, test, and configuration that references the code being changed.
@@ -34,34 +34,35 @@ Do NOT use when:
34
34
  - Rename, extract, move, or restructure the target code.
35
35
  - Keep the change minimal and focused.
36
36
 
37
- ### Step 2: Update all downstream deps
37
+ ### Step 2: Update all downstream dependencies
38
38
 
39
39
  For each affected file (from the impact analysis):
40
40
 
41
41
  - **Callers**: Update method calls, constructor arguments, imports.
42
42
  - **Interfaces / abstract methods**: Update all implementations to match new signatures.
43
43
  - **Subclasses**: Update overridden methods.
44
- - **Type hints / PHPDoc**: Update type references.
44
+ - **Type hints / annotations**: Update type references (PHPDoc, TypeScript types, Python type hints, Go generics, Rust generics).
45
45
  - **Config / bindings**: Update service container bindings, route references, etc.
46
- - **Imports**: Add or update `use` statements.
46
+ - **Imports**: Add or update import statements (`use` for PHP, `import` for JS/TS/Python, `import` blocks for Go, `use` for Rust).
47
47
 
48
- ### Step 3: Update API layer (if controllers/endpoints are affected)
48
+ ### Step 3: Update API layer (if request handlers / endpoints are affected)
49
49
 
50
- When refactoring touches controllers, requests, resources, or routes:
50
+ When refactoring touches handlers, route registrations, request validators, or response shapers, walk the stack-appropriate boundary. Use the carve-out skill for the project's framework if one exists; otherwise consult the table below for what to check on each stack.
51
51
 
52
- | Component | What to check and update |
52
+ | Layer | What to check and update |
53
53
  |---|---|
54
- | **Controller** | `__invoke()` signature, injected services, return type |
55
- | **FormRequest** | `authorize()`, `rules()`, validated field names |
56
- | **Resource** | `toArray()` field mapping, conditional fields, nested resources |
57
- | **OpenAPI Schema Attributes** | Request schemas (`ShowResourceRequestSchema`, `CreateResourceRequestSchema`, etc.) |
58
- | **OpenAPI Response Attributes** | Response schemas (`ShowResourceResponseSchema`, `CreateResourceResponseSchema`, etc.) |
59
- | **OpenAPI Error Attributes** | `ResourceNotFoundResponse`, `ValidationErrorResponse` |
60
- | **Custom Request Schemas** | Extended schema classes in `app/OpenApi/Schema/Request/v{N}/` |
61
- | **Route definition** | Route file in `routes/api/v{N}/`, route name, URL path, HTTP method |
62
- | **Route model binding** | Parameter name in route must match variable name in controller |
63
- | **Version inheritance** | If v1 extends v2 (or vice versa), check both versions |
64
- | **Module routes** | Module routes in `app/Modules/*/Routes/api.php` with version prefix |
54
+ | **Route registration** | Route file / decorator / file-based-router entry — name, URL, HTTP method, parameter binding |
55
+ | **Handler / Controller** | Entry signature, injected dependencies, return type |
56
+ | **Request validator** | Validation rule definitions, allowlisted fields (FormRequest, Zod schema, class-validator DTO, Pydantic model, struct tags) |
57
+ | **Response shaper** | Field mapping in the transformer (API Resource, serializer, DTO mapper, response model) |
58
+ | **API contract** | OpenAPI annotations, generated spec, typed client (regenerate if generated) |
59
+ | **Authorization rule** | Policy / voter / guard / middleware / route dependency that protects the route |
60
+ | **Module routes** | Module-local routing surface (Laravel `app/Modules/*/Routes/`, Nx `apps/*/src/routes`, mono-repo per-package routes) |
61
+
62
+ Carve-out routing:
63
+ - Laravel: [`laravel-api-endpoint`](../laravel-api-endpoint/SKILL.md)
64
+ - Next.js: [`nextjs-patterns`](../nextjs-patterns/SKILL.md)
65
+ - Symfony: [`symfony-workflow`](../symfony-workflow/SKILL.md)
65
66
 
66
67
  ### Step 4: Update tests — with user approval
67
68
 
@@ -89,19 +90,24 @@ When refactoring touches controllers, requests, resources, or routes:
89
90
  - Do NOT delete tests — adapt them to the new code structure.
90
91
  - Do NOT reduce test coverage — if you split a class, split the test too.
91
92
 
92
- ### Step 5: Verify with quality tools
93
+ ### Step 5: Verify with the project's quality tools
93
94
 
94
- Run quality tools after each significant step — do NOT batch everything to the end:
95
+ Run the project's type-checker and linter after each significant step — do NOT batch everything to the end. The exact command set depends on the stack; resolve via `quality-tools` skill or the project's `Taskfile.yml` / `package.json scripts` / `composer.json scripts` / `Makefile`.
95
96
 
96
- - Run PHPStan: `vendor/bin/phpstan analyse` (see `quality-tools` skill for detection).
97
- - If PHPStan finds new errors from the refactoring → fix immediately before continuing.
98
- - Run Rector + ECS: `vendor/bin/rector process && vendor/bin/ecs check --fix`.
99
- - Run PHPStan again after Rector (Rector can introduce issues).
97
+ | Stack | Typical pipeline |
98
+ |---|---|
99
+ | Laravel / PHP | `vendor/bin/phpstan analyse` → `vendor/bin/rector process` `vendor/bin/ecs check --fix` → re-run PHPStan |
100
+ | TypeScript | `tsc --noEmit` `eslint --fix` `prettier --write` |
101
+ | Python | `mypy` (or `pyright`) → `ruff check --fix` → `ruff format` |
102
+ | Go | `go vet ./...` → `golangci-lint run --fix` → `gofmt -w` |
103
+ | Rust | `cargo check` → `cargo clippy --fix` → `cargo fmt` |
104
+
105
+ If auto-fixers can rewrite types (Rector for PHP, `eslint --fix` for TS), re-run the type-checker after them — auto-fixers can introduce new errors.
100
106
 
101
107
  ### Step 6: Run tests
102
108
 
103
- - Run tests related to the changed code first (`php artisan test --filter=...`).
104
- - Then run the full test suite (`php artisan test`).
109
+ - Run tests related to the changed code first (`php artisan test --filter=...`, `pnpm test -- <pattern>`, `pytest -k <pattern>`, `go test ./{path}/...`, `cargo test {pattern}`).
110
+ - Then run the full test suite (`php artisan test`, `pnpm test`, `pytest`, `go test ./...`, `cargo test`).
105
111
  - All tests must pass before the refactoring is considered complete.
106
112
 
107
113
  ### Step 7: Update documentation
@@ -142,9 +148,9 @@ After the code changes are verified, update all affected documentation:
142
148
  1. Update controller + request + resource + OpenAPI schemas + route → present test changes →
143
149
  update docs (`agents/docs/controller.md`, `agents/docs/api-resources.md`) → run PHPStan → run tests.
144
150
 
145
- ### Replace impl (e.g. switch service)
146
- 1. Create new impl → update binding → find all direct references → update → present test
147
- changes → update docs → run PHPStan → run tests → remove old impl.
151
+ ### Replace implementation (e.g. switch service)
152
+ 1. Create new implementation → update binding → find all direct references → update → present test
153
+ changes → update docs → run PHPStan → run tests → remove old implementation.
148
154
 
149
155
  ### Move/restructure module
150
156
  1. Move files → update namespaces → update `ModuleServiceProvider` if needed → update module routes →