@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.
- package/.agent-src/commands/bug-fix.md +1 -0
- package/.agent-src/commands/create-pr/description-only.md +39 -11
- package/.agent-src/commands/create-pr.md +59 -5
- package/.agent-src/commands/feature/roadmap.md +2 -2
- package/.agent-src/commands/fix/seeder.md +3 -2
- package/.agent-src/commands/memory/add.md +3 -3
- package/.agent-src/commands/module/create.md +1 -0
- package/.agent-src/commands/module/explore.md +10 -6
- package/.agent-src/commands/onboard.md +9 -1
- package/.agent-src/commands/optimize/augmentignore.md +52 -20
- package/.agent-src/commands/optimize/rtk.md +56 -30
- package/.agent-src/commands/package-test.md +86 -10
- package/.agent-src/commands/quality-fix.md +49 -27
- package/.agent-src/commands/update-form-request-messages.md +2 -1
- package/.agent-src/commands/video/from-script.md +5 -5
- package/.agent-src/commands/video/storyboard.md +1 -1
- package/.agent-src/contexts/augment-infrastructure.md +4 -7
- package/.agent-src/contexts/communication/rules-auto/guidelines-mechanics.md +1 -1
- package/.agent-src/contexts/contracts/research-schema.md +1 -1
- package/.agent-src/contexts/execution/interrupt-examples.md +34 -0
- package/.agent-src/contexts/execution/roadmap-process-loop.md +69 -14
- package/.agent-src/contexts/skills-and-commands.md +2 -2
- package/.agent-src/personas/README.md +3 -2
- package/.agent-src/personas/ai-video-technical-director.md +2 -2
- package/.agent-src/personas/hollywood-director.md +3 -3
- package/.agent-src/profiles/content_creator.yml +5 -0
- package/.agent-src/rules/architecture.md +24 -10
- package/.agent-src/rules/artifact-drafting-protocol.md +6 -0
- package/.agent-src/rules/augment-edit-discipline.md +28 -0
- package/.agent-src/rules/augment-source-of-truth.md +2 -2
- package/.agent-src/rules/autonomous-execution.md +31 -0
- package/.agent-src/rules/context-hygiene.md +1 -1
- package/.agent-src/rules/domain-adoption-policy.md +4 -5
- package/.agent-src/rules/domain-safety-disclaimer.md +114 -0
- package/.agent-src/rules/domain-safety-pii.md +142 -0
- package/.agent-src/rules/domain-safety-retention.md +86 -0
- package/.agent-src/rules/downstream-changes.md +4 -4
- package/.agent-src/rules/framework-neutrality-in-generic-skills.md +130 -0
- package/.agent-src/rules/git-history-discipline.md +99 -0
- package/.agent-src/rules/media-governance-routing.md +82 -0
- package/.agent-src/rules/minimal-safe-diff.md +6 -0
- package/.agent-src/rules/no-roadmap-references.md +4 -2
- package/.agent-src/rules/persona-governance.md +90 -0
- package/.agent-src/rules/provider-lifecycle-discipline.md +75 -0
- package/.agent-src/rules/roadmap-ci-steps-policy.md +145 -0
- package/.agent-src/rules/roadmap-progress-sync.md +11 -5
- package/.agent-src/rules/user-interrupt-priority.md +46 -0
- package/.agent-src/rules/verify-before-complete.md +11 -2
- package/.agent-src/skills/adversarial-review/SKILL.md +1 -1
- package/.agent-src/skills/ai-council/SKILL.md +1 -0
- package/.agent-src/skills/api-endpoint/SKILL.md +58 -154
- package/.agent-src/skills/api-testing/SKILL.md +11 -0
- package/.agent-src/skills/character-consistency/SKILL.md +12 -1
- package/.agent-src/skills/code-refactoring/SKILL.md +36 -30
- package/.agent-src/skills/code-review/SKILL.md +41 -36
- package/.agent-src/skills/context-authoring/SKILL.md +1 -1
- package/.agent-src/skills/dashboard-design/SKILL.md +1 -2
- package/.agent-src/skills/database/SKILL.md +8 -3
- package/.agent-src/skills/dependency-upgrade/SKILL.md +65 -19
- package/.agent-src/skills/developer-like-execution/SKILL.md +25 -14
- package/.agent-src/skills/eloquent/SKILL.md +1 -1
- package/.agent-src/skills/feature-planning/SKILL.md +1 -1
- package/.agent-src/skills/file-editor/SKILL.md +45 -19
- package/.agent-src/skills/finishing-a-development-branch/SKILL.md +2 -2
- package/.agent-src/skills/git-workflow/SKILL.md +135 -2
- package/.agent-src/skills/laravel-api-endpoint/SKILL.md +187 -0
- package/.agent-src/skills/{dto-creator → laravel-dto}/SKILL.md +5 -4
- package/.agent-src/skills/{migration-creator → laravel-migration}/SKILL.md +11 -10
- package/.agent-src/skills/laravel-reverb/SKILL.md +3 -3
- package/.agent-src/skills/{websocket → laravel-websocket}/SKILL.md +4 -3
- package/.agent-src/skills/learning-to-rule-or-skill/SKILL.md +1 -1
- package/.agent-src/skills/merge-conflicts/SKILL.md +49 -17
- package/.agent-src/skills/migration-architect/SKILL.md +6 -6
- package/.agent-src/skills/module-management/SKILL.md +1 -0
- package/.agent-src/skills/motion-choreographer/SKILL.md +12 -0
- package/.agent-src/skills/multi-tenancy/SKILL.md +15 -8
- package/.agent-src/skills/pest-testing/SKILL.md +18 -0
- package/.agent-src/skills/php-debugging/SKILL.md +28 -0
- package/.agent-src/skills/php-service/SKILL.md +3 -3
- package/.agent-src/skills/pixar-storyteller/SKILL.md +19 -6
- package/.agent-src/skills/playwright-testing/SKILL.md +16 -1
- package/.agent-src/skills/project-analyzer/SKILL.md +68 -42
- package/.agent-src/skills/readme-writing-package/SKILL.md +94 -23
- package/.agent-src/skills/roadmap-management/SKILL.md +1 -1
- package/.agent-src/skills/roadmap-writing/SKILL.md +10 -0
- package/.agent-src/skills/rtk-output-filtering/SKILL.md +23 -8
- package/.agent-src/skills/rule-refactor/SKILL.md +145 -0
- package/.agent-src/skills/rule-writing/SKILL.md +34 -8
- package/.agent-src/skills/scene-expander/SKILL.md +22 -7
- package/.agent-src/skills/security/SKILL.md +38 -29
- package/.agent-src/skills/skill-reviewer/SKILL.md +1 -1
- package/.agent-src/skills/test-driven-development/SKILL.md +4 -4
- package/.agent-src/skills/test-performance/SKILL.md +6 -5
- package/.agent-src/skills/verify-completion-evidence/SKILL.md +24 -27
- package/.agent-src/skills/video-director/SKILL.md +13 -0
- package/.agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/.agent-src/templates/copilot-instructions.md +2 -2
- package/.agent-src/templates/roadmaps.md +16 -0
- package/.agent-src/templates/rule.md +2 -2
- package/.claude-plugin/marketplace.json +6 -4
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +80 -133
- package/README.md +6 -4
- package/config/agent-settings.template.yml +26 -0
- package/docs/architecture.md +2 -2
- package/docs/archive/CHANGELOG-pre-2.25.0.md +191 -0
- package/docs/catalog.md +20 -12
- package/docs/contracts/file-ownership-matrix.json +588 -90
- package/docs/contracts/kernel-membership.md +17 -0
- package/docs/contracts/provider-lifecycle.md +122 -0
- package/docs/contracts/smoke-contracts.md +8 -8
- package/docs/decisions/ADR-011-domain-pack-readiness.md +213 -0
- package/docs/decisions/INDEX.md +1 -0
- package/docs/getting-started-by-role.md +10 -0
- package/docs/getting-started.md +1 -1
- package/docs/guidelines/php/api-design.md +1 -1
- package/docs/guidelines/php/controllers.md +1 -1
- package/docs/guidelines/php/resources.md +1 -1
- package/docs/guidelines/php/validations.md +1 -1
- package/docs/personas.md +73 -26
- package/docs/profiles.md +9 -4
- package/package.json +1 -1
- package/scripts/_tmp_scan_framework_leakage.py +119 -0
- package/scripts/ai-video/adapters/gemini-veo.sh +5 -0
- package/scripts/ai-video/adapters/higgsfield.sh +6 -0
- package/scripts/ai-video/adapters/kling.sh +5 -0
- package/scripts/ai-video/adapters/openai-images.sh +5 -0
- package/scripts/ai-video/adapters/sora.sh +6 -0
- package/scripts/build_linear_digest.py +0 -1
- package/scripts/check_portability.py +6 -0
- package/scripts/lint_framework_leakage.py +348 -0
- package/scripts/lint_framework_leakage_allowlist.json +476 -0
- package/scripts/lint_media_policy_linkage.py +140 -0
- package/scripts/lint_persona_governance.py +164 -0
- package/scripts/lint_roadmap_ci_steps.py +182 -0
- package/scripts/measure_augment_budget.py +6 -0
- package/scripts/schemas/command.schema.json +5 -0
- package/scripts/schemas/skill.schema.json +5 -0
- package/scripts/skill_linter.py +60 -7
- package/scripts/smoke/kernel.sh +4 -4
- package/scripts/smoke/router.sh +2 -2
- package/scripts/smoke/schema.sh +1 -1
- package/.agent-src/personas/pixar-storyboard-artist.md +0 -98
- package/.agent-src/rules/agent-docs.md +0 -20
- package/.agent-src/rules/augment-portability.md +0 -23
- package/.agent-src/rules/capture-learnings.md +0 -19
- package/.agent-src/rules/docs-sync.md +0 -20
- package/.agent-src/rules/domain-safety-disclaimer-consulting.md +0 -52
- package/.agent-src/rules/domain-safety-disclaimer-financial.md +0 -54
- package/.agent-src/rules/domain-safety-disclaimer-legal.md +0 -49
- package/.agent-src/rules/domain-safety-disclaimer-medical.md +0 -56
- package/.agent-src/rules/domain-safety-export-redact.md +0 -65
- package/.agent-src/rules/domain-safety-logging-pii-floor.md +0 -55
- package/.agent-src/rules/domain-safety-pii-finance.md +0 -57
- package/.agent-src/rules/domain-safety-pii-marketing.md +0 -60
- package/.agent-src/rules/domain-safety-pii-recruiting.md +0 -56
- package/.agent-src/rules/domain-safety-pii-support.md +0 -57
- package/.agent-src/rules/domain-safety-retention-finance.md +0 -48
- package/.agent-src/rules/domain-safety-retention-support.md +0 -55
- package/.agent-src/rules/e2e-testing.md +0 -19
- 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
|
|
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
|
|
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.
|
|
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
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
17
|
-
- API design decisions (use `api-design`
|
|
18
|
-
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
|
145
|
-
|
|
|
146
|
-
|
|
|
147
|
-
|
|
|
148
|
-
|
|
|
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
|
-
|
|
56
|
+
## Stack-specific procedures
|
|
151
57
|
|
|
152
|
-
|
|
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
|
-
-
|
|
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 —
|
|
161
|
-
2. Test file with happy path and validation
|
|
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
|
|
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
|
-
-
|
|
169
|
-
-
|
|
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
|
|
174
|
-
- Do NOT skip
|
|
175
|
-
- Do NOT return raw
|
|
176
|
-
- Do NOT create
|
|
177
|
-
- Do NOT
|
|
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 idioms — read 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
|
-
-
|
|
186
|
-
-
|
|
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
|
|
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
|
|
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
|
|
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 /
|
|
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`
|
|
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
|
|
48
|
+
### Step 3: Update API layer (if request handlers / endpoints are affected)
|
|
49
49
|
|
|
50
|
-
When refactoring touches
|
|
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
|
-
|
|
|
52
|
+
| Layer | What to check and update |
|
|
53
53
|
|---|---|
|
|
54
|
-
| **
|
|
55
|
-
| **
|
|
56
|
-
| **
|
|
57
|
-
| **
|
|
58
|
-
| **
|
|
59
|
-
| **
|
|
60
|
-
| **
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
|
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
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
|
146
|
-
1. Create new
|
|
147
|
-
changes → update docs → run PHPStan → run tests → remove old
|
|
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 →
|