@event4u/agent-config 2.25.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 (122) hide show
  1. package/.agent-src/commands/bug-fix.md +1 -0
  2. package/.agent-src/commands/feature/roadmap.md +2 -2
  3. package/.agent-src/commands/fix/seeder.md +3 -2
  4. package/.agent-src/commands/memory/add.md +3 -3
  5. package/.agent-src/commands/module/create.md +1 -0
  6. package/.agent-src/commands/module/explore.md +10 -6
  7. package/.agent-src/commands/onboard.md +9 -1
  8. package/.agent-src/commands/optimize/augmentignore.md +52 -20
  9. package/.agent-src/commands/optimize/rtk.md +56 -30
  10. package/.agent-src/commands/package-test.md +86 -10
  11. package/.agent-src/commands/quality-fix.md +49 -27
  12. package/.agent-src/commands/update-form-request-messages.md +2 -1
  13. package/.agent-src/contexts/augment-infrastructure.md +4 -7
  14. package/.agent-src/contexts/communication/rules-auto/guidelines-mechanics.md +1 -1
  15. package/.agent-src/contexts/contracts/research-schema.md +1 -1
  16. package/.agent-src/contexts/execution/interrupt-examples.md +34 -0
  17. package/.agent-src/contexts/skills-and-commands.md +2 -2
  18. package/.agent-src/rules/architecture.md +24 -10
  19. package/.agent-src/rules/artifact-drafting-protocol.md +6 -0
  20. package/.agent-src/rules/augment-edit-discipline.md +28 -0
  21. package/.agent-src/rules/augment-source-of-truth.md +2 -2
  22. package/.agent-src/rules/autonomous-execution.md +31 -0
  23. package/.agent-src/rules/context-hygiene.md +1 -1
  24. package/.agent-src/rules/domain-adoption-policy.md +4 -5
  25. package/.agent-src/rules/domain-safety-disclaimer.md +114 -0
  26. package/.agent-src/rules/domain-safety-pii.md +142 -0
  27. package/.agent-src/rules/domain-safety-retention.md +86 -0
  28. package/.agent-src/rules/downstream-changes.md +4 -4
  29. package/.agent-src/rules/framework-neutrality-in-generic-skills.md +130 -0
  30. package/.agent-src/rules/git-history-discipline.md +99 -0
  31. package/.agent-src/rules/minimal-safe-diff.md +6 -0
  32. package/.agent-src/rules/no-roadmap-references.md +4 -2
  33. package/.agent-src/rules/user-interrupt-priority.md +46 -0
  34. package/.agent-src/rules/verify-before-complete.md +11 -2
  35. package/.agent-src/skills/adversarial-review/SKILL.md +1 -1
  36. package/.agent-src/skills/ai-council/SKILL.md +1 -0
  37. package/.agent-src/skills/api-endpoint/SKILL.md +58 -154
  38. package/.agent-src/skills/api-testing/SKILL.md +11 -0
  39. package/.agent-src/skills/code-refactoring/SKILL.md +36 -30
  40. package/.agent-src/skills/code-review/SKILL.md +41 -36
  41. package/.agent-src/skills/context-authoring/SKILL.md +1 -1
  42. package/.agent-src/skills/dashboard-design/SKILL.md +1 -2
  43. package/.agent-src/skills/database/SKILL.md +8 -3
  44. package/.agent-src/skills/dependency-upgrade/SKILL.md +65 -19
  45. package/.agent-src/skills/developer-like-execution/SKILL.md +25 -14
  46. package/.agent-src/skills/eloquent/SKILL.md +1 -1
  47. package/.agent-src/skills/feature-planning/SKILL.md +1 -1
  48. package/.agent-src/skills/file-editor/SKILL.md +45 -19
  49. package/.agent-src/skills/finishing-a-development-branch/SKILL.md +2 -2
  50. package/.agent-src/skills/git-workflow/SKILL.md +4 -4
  51. package/.agent-src/skills/laravel-api-endpoint/SKILL.md +187 -0
  52. package/.agent-src/skills/{dto-creator → laravel-dto}/SKILL.md +5 -4
  53. package/.agent-src/skills/{migration-creator → laravel-migration}/SKILL.md +11 -10
  54. package/.agent-src/skills/laravel-reverb/SKILL.md +3 -3
  55. package/.agent-src/skills/{websocket → laravel-websocket}/SKILL.md +4 -3
  56. package/.agent-src/skills/learning-to-rule-or-skill/SKILL.md +1 -1
  57. package/.agent-src/skills/merge-conflicts/SKILL.md +49 -17
  58. package/.agent-src/skills/migration-architect/SKILL.md +6 -6
  59. package/.agent-src/skills/module-management/SKILL.md +1 -0
  60. package/.agent-src/skills/multi-tenancy/SKILL.md +15 -8
  61. package/.agent-src/skills/pest-testing/SKILL.md +18 -0
  62. package/.agent-src/skills/php-debugging/SKILL.md +28 -0
  63. package/.agent-src/skills/php-service/SKILL.md +3 -3
  64. package/.agent-src/skills/playwright-testing/SKILL.md +16 -1
  65. package/.agent-src/skills/project-analyzer/SKILL.md +68 -42
  66. package/.agent-src/skills/readme-writing-package/SKILL.md +94 -23
  67. package/.agent-src/skills/roadmap-management/SKILL.md +1 -1
  68. package/.agent-src/skills/rtk-output-filtering/SKILL.md +23 -8
  69. package/.agent-src/skills/rule-refactor/SKILL.md +145 -0
  70. package/.agent-src/skills/rule-writing/SKILL.md +34 -8
  71. package/.agent-src/skills/security/SKILL.md +38 -29
  72. package/.agent-src/skills/skill-reviewer/SKILL.md +1 -1
  73. package/.agent-src/skills/test-driven-development/SKILL.md +4 -4
  74. package/.agent-src/skills/test-performance/SKILL.md +6 -5
  75. package/.agent-src/skills/verify-completion-evidence/SKILL.md +24 -27
  76. package/.agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  77. package/.agent-src/templates/copilot-instructions.md +2 -2
  78. package/.agent-src/templates/rule.md +2 -2
  79. package/.claude-plugin/marketplace.json +6 -4
  80. package/AGENTS.md +1 -1
  81. package/CHANGELOG.md +74 -170
  82. package/README.md +2 -2
  83. package/docs/architecture.md +2 -2
  84. package/docs/archive/CHANGELOG-pre-2.25.0.md +191 -0
  85. package/docs/catalog.md +17 -12
  86. package/docs/contracts/file-ownership-matrix.json +473 -43
  87. package/docs/contracts/kernel-membership.md +17 -0
  88. package/docs/contracts/smoke-contracts.md +8 -8
  89. package/docs/getting-started.md +1 -1
  90. package/docs/guidelines/php/api-design.md +1 -1
  91. package/docs/guidelines/php/controllers.md +1 -1
  92. package/docs/guidelines/php/resources.md +1 -1
  93. package/docs/guidelines/php/validations.md +1 -1
  94. package/package.json +1 -1
  95. package/scripts/build_linear_digest.py +0 -1
  96. package/scripts/lint_framework_leakage.py +348 -0
  97. package/scripts/lint_framework_leakage_allowlist.json +476 -0
  98. package/scripts/measure_augment_budget.py +6 -0
  99. package/scripts/schemas/command.schema.json +5 -0
  100. package/scripts/schemas/skill.schema.json +5 -0
  101. package/scripts/skill_linter.py +60 -7
  102. package/scripts/smoke/kernel.sh +4 -4
  103. package/scripts/smoke/router.sh +2 -2
  104. package/.agent-src/rules/agent-docs.md +0 -20
  105. package/.agent-src/rules/augment-portability.md +0 -23
  106. package/.agent-src/rules/capture-learnings.md +0 -19
  107. package/.agent-src/rules/docs-sync.md +0 -20
  108. package/.agent-src/rules/domain-safety-disclaimer-consulting.md +0 -52
  109. package/.agent-src/rules/domain-safety-disclaimer-financial.md +0 -54
  110. package/.agent-src/rules/domain-safety-disclaimer-legal.md +0 -49
  111. package/.agent-src/rules/domain-safety-disclaimer-medical.md +0 -56
  112. package/.agent-src/rules/domain-safety-export-redact.md +0 -65
  113. package/.agent-src/rules/domain-safety-logging-pii-floor.md +0 -55
  114. package/.agent-src/rules/domain-safety-pii-finance.md +0 -57
  115. package/.agent-src/rules/domain-safety-pii-marketing.md +0 -60
  116. package/.agent-src/rules/domain-safety-pii-recruiting.md +0 -56
  117. package/.agent-src/rules/domain-safety-pii-support.md +0 -57
  118. package/.agent-src/rules/domain-safety-retention-finance.md +0 -48
  119. package/.agent-src/rules/domain-safety-retention-support.md +0 -55
  120. package/.agent-src/rules/e2e-testing.md +0 -19
  121. package/.agent-src/rules/no-unsolicited-rebase.md +0 -107
  122. package/.agent-src/rules/post-push-rewrite-discipline.md +0 -70
@@ -53,7 +53,7 @@ what it does, whether it fits their stack, how to install it, and how to use it.
53
53
 
54
54
  Read files that define actual package behavior:
55
55
 
56
- - `composer.json` / `package.json` — name, description, requirements, scripts
56
+ - Manifest: `composer.json`, `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, or `*.gemspec` — name, description, requirements, scripts
57
57
  - Source entrypoints — public API surface, main classes/functions
58
58
  - Config files — publishable configs, defaults
59
59
  - CI workflows — what gets tested, supported versions matrix
@@ -83,32 +83,103 @@ Skip sections that have no real content. Never pad.
83
83
 
84
84
  ### 4. Write requirements and compatibility
85
85
 
86
- State only what is tested and supported:
86
+ State only what is tested and supported. Pull the values from the package's manifest, not from memory. Examples per stack:
87
87
 
88
88
  ```
89
- ## Requirements
89
+ ## Requirements (PHP)
90
90
 
91
91
  - PHP ^8.2
92
- - Laravel 11.x
92
+ - Laravel 11.x (optional integration)
93
93
  - ext-json
94
94
  ```
95
95
 
96
- Do NOT imply broad compatibility if only tested in narrow range.
97
- Include framework version, language version, required extensions, services.
96
+ ```
97
+ ## Requirements (JS / TS)
98
+
99
+ - Node.js >= 20
100
+ - TypeScript >= 5.4 (for typed consumers)
101
+ - npm / pnpm / yarn / bun
102
+ ```
103
+
104
+ ```
105
+ ## Requirements (Python)
106
+
107
+ - Python >= 3.11
108
+ - pip / poetry / uv
109
+ - Optional: `fastapi >= 0.110` for the FastAPI integration
110
+ ```
111
+
112
+ ```
113
+ ## Requirements (Go)
114
+
115
+ - Go >= 1.22
116
+ ```
117
+
118
+ ```
119
+ ## Requirements (Rust)
120
+
121
+ - Rust >= 1.78 (stable)
122
+ - `cargo` workspace member or standalone crate
123
+ ```
124
+
125
+ ```
126
+ ## Requirements (Ruby)
127
+
128
+ - Ruby >= 3.2
129
+ - Bundler >= 2.5
130
+ - Optional: Rails 7.1+ for the Rails integration
131
+ ```
132
+
133
+ Do NOT imply broad compatibility if only tested in a narrow range.
134
+ Include language version, framework version, required extensions, and services.
98
135
 
99
136
  ### 5. Write installation that actually works
100
137
 
101
- Document the exact install command and any required follow-up:
138
+ Document the exact install command and any required follow-up. Use the
139
+ package manager native to the stack — never edit manifests by hand.
102
140
 
103
141
  ```bash
142
+ # PHP / Composer
104
143
  composer require vendor/package
105
-
106
- # If framework integration needed:
144
+ # Optional Laravel integration:
107
145
  php artisan vendor:publish --tag=package-config
108
146
  ```
109
147
 
148
+ ```bash
149
+ # JS / TS — pick whichever the consumer uses
150
+ npm install <package>
151
+ pnpm add <package>
152
+ yarn add <package>
153
+ bun add <package>
154
+ ```
155
+
156
+ ```bash
157
+ # Python
158
+ pip install <package>
159
+ poetry add <package>
160
+ uv add <package>
161
+ ```
162
+
163
+ ```bash
164
+ # Go
165
+ go get github.com/<owner>/<package>@latest
166
+ ```
167
+
168
+ ```bash
169
+ # Rust
170
+ cargo add <package>
171
+ ```
172
+
173
+ ```bash
174
+ # Ruby
175
+ bundle add <package>
176
+ # or, for a standalone gem:
177
+ gem install <package>
178
+ ```
179
+
110
180
  Validate each step against the actual codebase.
111
- Include post-install steps (publish, register, env setup) if required.
181
+ Include post-install steps (config publish, service / module / provider
182
+ registration, env vars, codegen, migrations) if the package requires them.
112
183
 
113
184
  ### 6. Write the minimal working example
114
185
 
@@ -148,10 +219,10 @@ splitting, duplication between README and `/docs/`).
148
219
 
149
220
  #### Per-AI catalog pattern (multi-platform AI / CLI packages)
150
221
 
151
- For packages targeting many AI assistants or platforms (CLI installers,
152
- agent-config tools, language SDKs with 10+ targets), prefer flat per-AI
153
- catalog over giant matrix. One line per target, install command on left,
154
- aligned trailing comment naming platform:
222
+ For packages that target many AI assistants or platforms (CLI installers,
223
+ agent-config tools, language SDKs with 10+ targets), prefer a flat per-AI
224
+ catalog over a giant matrix. One line per target, install command on the
225
+ left, aligned trailing comment naming the platform:
155
226
 
156
227
  ```bash
157
228
  npx <package> init --tools=claude-code # Claude Code
@@ -160,22 +231,22 @@ npx <package> init --tools=windsurf # Windsurf
160
231
  # ... one line per supported target
161
232
  ```
162
233
 
163
- Pair catalog with separate "Global install" subsection (same flags plus
164
- `--global`) and "Other commands" subsection. Reference example:
234
+ Pair the catalog with a separate "Global install" subsection (same flags
235
+ plus `--global`) and an "Other commands" subsection. Reference example:
165
236
  [`README.md § Pick specific AIs`](../../../README.md#pick-specific-ais) in
166
- this repo. Inspiration:
237
+ this repository. Inspiration:
167
238
  [`ui-ux-pro-max-skill § Installation`](https://github.com/nextlevelbuilder/ui-ux-pro-max-skill#installation).
168
239
 
169
- Use catalog when package's primary install action varies by platform; use
170
- matrix table (Tool / Rules / Skills / Commands) for capability comparison.
171
- Different jobs — install vs. coverage.
240
+ Use the catalog when the package's primary install action varies by
241
+ platform; use a matrix table (Tool / Rules / Skills / Commands) for
242
+ capability comparison. They serve different jobs — install vs. coverage.
172
243
 
173
244
  README = enough to adopt. Docs = enough to master.
174
245
 
175
246
  ### 8. Validate
176
247
 
177
248
  - [ ] Install command is correct and complete
178
- - [ ] Compatibility/requirements match `composer.json` / `package.json` / CI matrix
249
+ - [ ] Compatibility/requirements match the manifest (`composer.json`, `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, `*.gemspec`) and the CI matrix
179
250
  - [ ] First example matches real API (verified against source code)
180
251
  - [ ] All documented commands exist in repo
181
252
  - [ ] No invented features or capabilities
@@ -199,8 +270,8 @@ README = enough to adopt. Docs = enough to master.
199
270
  - Model tends to invent compatibility claims or setup steps
200
271
  - First example is often too large, too abstract, or uses pseudo-code
201
272
  - Model over-explains internals before showing how to use the package
202
- - Existing README may be outdated — verify against actual `composer.json` / source, not old text
203
- - Model forgets post-install steps (config publish, service provider, env vars)
273
+ - Existing README may be outdated — verify against the actual manifest (`composer.json`, `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, `*.gemspec`) and source, not the old prose
274
+ - Model forgets post-install steps (config publish, service / module / provider registration, env vars, codegen, migrations) — list whichever the stack requires
204
275
 
205
276
  ## Frugality Standards
206
277
 
@@ -93,7 +93,7 @@ Every roadmap follows this structure:
93
93
  ## Acceptance Criteria
94
94
 
95
95
  - [ ] {Observable, testable criterion}
96
- - [ ] All quality gates pass (PHPStan, Rector, tests)
96
+ - [ ] All quality gates pass — the project's type-checker, auto-fixer, linter, and full test suite (see the `quality-tools` skill for stack-specific invocations)
97
97
 
98
98
  ## Notes
99
99
 
@@ -37,12 +37,22 @@ rtk npm test # same for JS/TS
37
37
  rtk docker compose ps # compact container status
38
38
  ```
39
39
 
40
- ## Procedure: Wrap commands with rtk
40
+ ## Procedure: Analyze, then wrap commands with rtk
41
41
 
42
- 1. Read `personal.rtk_installed` from `.agent-settings.yml`.
43
- 2. **If `true`** → prefix commands with `rtk` when output >30 lines expected.
44
- 3. **If `false` or missing** → use plain commands. Do not prompt the user.
45
- 4. After wrapping: verify output is useful (not truncated on completeness-critical commands).
42
+ ### 1. Analyze the current setup
43
+
44
+ - Read `personal.rtk_installed` from `.agent-settings.yml`.
45
+ - Review the command about to run: estimated output size, whether
46
+ completeness matters (e.g. diff review), and whether a project-local
47
+ filter exists in `.rtk/filters.toml`.
48
+
49
+ ### 2. Wrap (or skip)
50
+
51
+ 1. **If `personal.rtk_installed: true`** → prefix commands with `rtk`
52
+ when output >30 lines expected.
53
+ 2. **If `false` or missing** → use plain commands. Do not prompt the user.
54
+ 3. After wrapping: verify output is useful (not truncated on
55
+ completeness-critical commands).
46
56
 
47
57
  Installation and one-time setup are owned by
48
58
  [`/onboard`](../../commands/onboard.md). If the user asks to install rtk
@@ -153,10 +163,15 @@ When debugging or reviewing diffs, **always run the raw command** without rtk.
153
163
 
154
164
  ## Project-Local Filters
155
165
 
156
- Custom filters for the project's PHP/Laravel toolchain live in `.rtk/filters.toml`
157
- (project root, versioned in Git). These override global filters for matching commands.
166
+ Project-local custom filters live in `.rtk/filters.toml` (project root, versioned in Git). These override global filters for matching commands. Add entries for whatever tools the project actually runs.
158
167
 
159
- Covered: PHPStan, Pest, ECS, Rector, Docker Compose, Artisan, Composer.
168
+ Coverage shipped with this package (extend per project):
169
+ - PHP / Laravel: PHPStan, Pest, PHPUnit, ECS, Rector, Composer, Artisan
170
+ - JS / TS: tsc, eslint, prettier, vitest, jest, playwright, pnpm/npm/yarn install + run
171
+ - Python: ruff, mypy, pyright, pytest, pip / poetry / uv
172
+ - Go: `go test`, `go build`, `go vet`, `golangci-lint`
173
+ - Rust: `cargo build`, `cargo test`, `cargo clippy`, `cargo fmt`
174
+ - Infra / runtime: Docker Compose, Terraform, kubectl
160
175
 
161
176
  To generate or update project-local filters → use the `/optimize-rtk-filters` command.
162
177
 
@@ -0,0 +1,145 @@
1
+ ---
2
+ name: rule-refactor
3
+ description: "Use when the rule set is over the Augment budget, when a new rule would breach it, or when asked to audit / merge / prune rules — runs the audit pipeline and proposes a verdict per rule."
4
+ source: package
5
+ domain: process
6
+ ---
7
+
8
+ <!-- cloud_safe: degrade -->
9
+
10
+ # rule-refactor
11
+
12
+ ## When to use
13
+
14
+ * `measure_augment_budget --check` fails (utilisation ≥ 0.95)
15
+ * A new rule would push the budget over 0.95 — caught by the budget
16
+ gate in [`rule-writing`](../rule-writing/SKILL.md)
17
+ * User says "audit rules", "rule cleanup", "rules over budget",
18
+ "prune rules", "merge rules", "rule system review"
19
+ * Periodic governance pass after a batch of rule additions
20
+
21
+ Do NOT use this skill for:
22
+
23
+ * Editing a single rule's content → [`rule-writing`](../rule-writing/SKILL.md)
24
+ * Picking always vs auto for one new rule → [`rule-writing`](../rule-writing/SKILL.md)
25
+
26
+ ## Iron Law
27
+
28
+ **Threshold-lift is forbidden.** When the budget breaches, the
29
+ content must shrink — not the gate. Loosening `FAIL_THRESHOLD` in
30
+ `scripts/measure_augment_budget.py` to make CI pass is an explicit
31
+ anti-pattern. The only valid budget-growth move is an ADR that
32
+ raises `TOTAL_CAP`.
33
+
34
+ ## Procedure
35
+
36
+ ### 1. Inspect the current budget state
37
+
38
+ ```bash
39
+ python3 scripts/measure_augment_budget.py --json > /tmp/budget-before.json
40
+ python3 scripts/measure_rule_budget.py --json > /tmp/rule-budget-before.json
41
+ ```
42
+
43
+ ### 2. Run the audit pipeline
44
+
45
+ The audit infrastructure already exists — compose it:
46
+
47
+ ```bash
48
+ python3 scripts/audit_auto_rules.py # → agents/reports/auto-rules-audit.{json,md}
49
+ python3 scripts/audit_overlap.py # → appends overlap pairs to the MD
50
+ python3 scripts/audit_likelihood.py # → agents/reports/auto-rules-likelihood.json
51
+ ```
52
+
53
+ Then read `agents/reports/auto-rules-audit.md` end-to-end.
54
+
55
+ ### 3. Categorise every flagged rule
56
+
57
+ For each rule the audit surfaces (overlap pair, low-likelihood, oversized,
58
+ or the new addition that triggered this skill), assign exactly one verdict:
59
+
60
+ | Verdict | Test |
61
+ |---|---|
62
+ | **keep** | Iron-Law / always-on safety net, no overlap, fires often |
63
+ | **merge** | ≥ 2 rules same domain, near-identical triggers, overlap ≥ 0.4 |
64
+ | **delete** | Never fires (low-likelihood + no path/keyword hit in 30 days), or fully subsumed by a skill |
65
+ | **move-to-context** | Body is reference material (tables, mechanics, examples) — the obligation is short, the rest is lookup |
66
+ | **promote-to-skill** | Body has numbered steps / a workflow — not a constraint |
67
+
68
+ ### 4. Present the verdict table to the user
69
+
70
+ One Markdown table, one row per flagged rule, **before** any file
71
+ change. User approves the list. No silent edits.
72
+
73
+ ### 5. Apply approved changes
74
+
75
+ For each approved verdict:
76
+
77
+ * **merge** → rewrite the surviving rule to cover both domains;
78
+ delete the absorbed one; update any `routes_to:` references.
79
+ * **delete** → remove the file from `.agent-src.uncompressed/rules/`
80
+ and the corresponding `.agent-src/rules/` projection.
81
+ * **move-to-context** → extract the body into
82
+ `.agent-src.uncompressed/contexts/<area>/<name>.md`, replace the
83
+ rule body with the obligation + a `load_context:` pointer.
84
+ * **promote-to-skill** → create
85
+ `.agent-src.uncompressed/skills/<name>/SKILL.md`, replace the rule
86
+ with an auto-trigger stub that routes to it (or delete the rule
87
+ entirely if the skill's own trigger suffices).
88
+
89
+ ### 6. Re-validate
90
+
91
+ ```bash
92
+ bash scripts/compress.sh --sync
93
+ python3 scripts/compress.py --generate-tools
94
+ python3 scripts/measure_augment_budget.py --check # must exit 0
95
+ python3 scripts/skill_linter.py --all # 0 FAIL
96
+ ```
97
+
98
+ Then run your package's full CI pipeline (see `Taskfile.yml` for the
99
+ canonical sequence) before pushing.
100
+
101
+ ### 7. Record the delta
102
+
103
+ Append a snapshot to `agents/.augment-budget-history.jsonl`:
104
+
105
+ ```bash
106
+ python3 scripts/measure_augment_budget.py --trend-append
107
+ ```
108
+
109
+ Commit the cleanup as a separate chunk from any rule-add commits so
110
+ the history shows "added X" + "cleaned up Y" as distinct steps.
111
+
112
+ ## Output format
113
+
114
+ 1. Verdict table (approved by user) at the top of the cleanup PR description
115
+ 2. Per-verdict commits (one per merge / delete / move / promote group)
116
+ 3. Final `measure_augment_budget --check` output showing utilisation < 0.95
117
+ 4. Trend snapshot recorded
118
+
119
+ ## Gotchas
120
+
121
+ * Do NOT raise `FAIL_THRESHOLD` to dodge the audit
122
+ * Do NOT delete a rule that has a `routes_to:` pointer without
123
+ updating the pointer's source
124
+ * Do NOT merge rules across tier boundaries (e.g. tier-1 always
125
+ with a tier-3 stub) without surfacing the tier collapse to the user
126
+ * Do NOT skip the trend-append — the history is what tells future
127
+ agents how the cap was managed
128
+
129
+ ## Do NOT
130
+
131
+ * Do NOT loosen the budget gate
132
+ * Do NOT touch the cap (`TOTAL_CAP`) without an ADR
133
+ * Do NOT apply changes before user approves the verdict table
134
+ * Do NOT delete the rule-refactor audit reports — they're the
135
+ artifact reviewers cite
136
+
137
+ ## Cloud Behavior
138
+
139
+ On cloud surfaces, the audit scripts are not reachable. The skill
140
+ still applies — prose-only:
141
+
142
+ * Inspect the rule list (frontmatter + descriptions) and propose the
143
+ verdict table from reading alone.
144
+ * Tell the user to run the audit scripts locally before applying.
145
+ * Do not attempt to call any script.
@@ -129,12 +129,38 @@ the PR or split by responsibility.
129
129
  * Run the full CI pipeline locally (see `Taskfile.yml` in this repo for
130
130
  the script list) — must exit 0 except for tolerated warnings.
131
131
 
132
+ ### 5b. Budget-discipline gate — hard stop
133
+
134
+ After validation, before declaring the rule done, run:
135
+
136
+ ```bash
137
+ python3 scripts/measure_augment_budget.py --check
138
+ ```
139
+
140
+ If utilisation is `≥ 0.95` (or the check exits non-zero), **STOP** and
141
+ invoke [`rule-refactor`](../rule-refactor/SKILL.md). Do NOT:
142
+
143
+ * Trim the new rule further to "just fit" — if it needs that body to
144
+ do its job, the rule is right and the rule set around it is wrong.
145
+ * Raise `FAIL_THRESHOLD` in `scripts/measure_augment_budget.py` —
146
+ threshold-lift is explicitly forbidden (see the
147
+ [`validation-budget`](../../rules/validation-budget.md) rule and
148
+ the `rule-refactor` Iron Law).
149
+ * Promote an always-rule to auto to dodge the cap if the rule's
150
+ semantics require always-on visibility — that breaks the rule, not
151
+ the budget.
152
+
153
+ The discipline: budget pressure is the signal that the rule **set**
154
+ needs a cleanup pass, not that the new rule needs to be smaller. The
155
+ `rule-refactor` skill runs the audit and proposes merge / delete /
156
+ move-to-context / promote-to-skill so the new rule earns its space.
157
+
132
158
  ### 6. Governance baseline (when introducing a new linter check)
133
159
 
134
160
  **Advisory, reviewer-checked — no CI gate.** When the same PR adds a
135
- new check to `scripts/skill_linter.py` (or strengthens an existing one)
136
- such that previously-clean rules now warn, the PR body MUST record the
137
- pre-existing violations on `main` in a Markdown table:
161
+ new check to `scripts/skill_linter.py` (or strengthens an existing
162
+ one) such that previously-clean rules now warn, the PR body MUST
163
+ record the pre-existing violations on `main` in a Markdown table:
138
164
 
139
165
  ```markdown
140
166
  ### Pre-existing baseline (informational)
@@ -144,11 +170,11 @@ pre-existing violations on `main` in a Markdown table:
144
170
  | {new_code} | N | (a) genuine fix · (b) accept · (c) check too aggressive |
145
171
  ```
146
172
 
147
- Forward-only: the new check applies to **the rule under review** and to
148
- **future** edits. The baseline table is informational so reviewers can
149
- distinguish genuine debt from acceptable carry-overs without diffing the
150
- full lint output. See `agents/analysis/lint-warning-triage.md` for the
151
- 3-bucket reference.
173
+ Forward-only: the new check applies to **the rule under review** and
174
+ to **future** edits. The baseline table is informational so reviewers
175
+ can distinguish genuine debt from acceptable carry-overs without
176
+ diffing the full lint output. See
177
+ `agents/analysis/lint-warning-triage.md` for the 3-bucket reference.
152
178
 
153
179
  ## Frontmatter shape
154
180
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: security
3
- description: "Use when applying security best practices — authentication, authorization via Policies, CSRF protection, input sanitization, rate limiting, or secure coding."
3
+ description: "Use when applying security best practices — authentication, authorization, CSRF protection, input sanitization, rate limiting, or secure coding — stack-agnostic."
4
4
  source: package
5
5
  domain: quality
6
6
  ---
@@ -13,65 +13,74 @@ Use when implementing authentication, authorization, or any security-sensitive f
13
13
 
14
14
  Do NOT use when:
15
15
 
16
- * Validation logic only — route to [`laravel-validation`](../laravel-validation/SKILL.md)
17
- * Full security audit — route to [`security-audit`](../security-audit/SKILL.md)
18
- * You need a pre-implementation threat model — route to
19
- [`threat-modeling`](../threat-modeling/SKILL.md)
20
- * You need end-to-end authorization analysis — route to
21
- [`authz-review`](../authz-review/SKILL.md)
16
+ * Validation logic only — route to the project's validation carve-out ([`laravel-validation`](../laravel-validation/SKILL.md) for Laravel; otherwise the framework-native primitive — Zod / class-validator, Pydantic, struct-tag validators).
17
+ * Full security audit — route to [`security-audit`](../security-audit/SKILL.md).
18
+ * You need a pre-implementation threat model — route to [`threat-modeling`](../threat-modeling/SKILL.md).
19
+ * You need end-to-end authorization analysis — route to [`authz-review`](../authz-review/SKILL.md).
22
20
 
23
- ## Procedure: Implement security for a feature
21
+ ## Stack-specific carve-outs
22
+
23
+ The procedure below is stack-agnostic. For framework-specific primitives (Laravel Policies / Gates / FormRequests, Symfony voters, NestJS guards, Next.js middleware), defer to:
24
+
25
+ | Stack | Carve-out |
26
+ |---|---|
27
+ | Laravel | [`laravel`](../laravel/SKILL.md), [`laravel-validation`](../laravel-validation/SKILL.md), [`laravel-middleware`](../laravel-middleware/SKILL.md) |
28
+ | Symfony | [`symfony-workflow`](../symfony-workflow/SKILL.md) |
29
+ | Next.js / TS | [`nextjs-patterns`](../nextjs-patterns/SKILL.md) |
30
+
31
+ ## Procedure: Implement security for a feature (stack-neutral)
24
32
 
25
33
  ### Step 0: Inspect
26
34
 
27
- 1. Read `agents/authentication.md` for auth flow.
28
- 2. Read `agents/gates.md` for gate/policy patterns.
29
- 3. Check existing policies in `app/Policies/`.
35
+ 1. Read the project's auth doc (`agents/authentication.md`, `docs/auth.md`, or framework docs).
36
+ 2. Read the project's authorization doc (gates / policies / voters / guards).
37
+ 3. Locate existing authorization rules in the project's idiomatic location (Laravel `app/Policies/`, Symfony `src/Security/Voter/`, NestJS `*.guard.ts`).
30
38
 
31
39
  ### Step 1: Authentication
32
40
 
33
- - Check auth setup: `tymon/jwt-auth` or `laravel/sanctum`.
34
- - Check `config/auth.php` for guards and providers.
35
- - Customer identification happens after auth — see `multi-tenancy` skill.
41
+ - Identify the auth mechanism in use (session, JWT, OAuth, API token) — read the framework's auth config (`config/auth.php`, `next-auth.config.ts`, Symfony `security.yaml`, FastAPI dependency).
42
+ - Check guard / strategy / provider configuration.
43
+ - Multi-tenant identification happens **after** authentication — see [`multi-tenancy`](../multi-tenancy/SKILL.md).
36
44
 
37
45
  ### Step 2: Authorization
38
46
 
39
- 1. Create policy in `app/Policies/` if needed.
40
- 2. Use in FormRequest `authorize()` or controller `$this->authorize()`.
41
- 3. Check `agents/gates.md` for non-model gates.
47
+ 1. Create / locate the authz rule in the framework's idiomatic primitive (Policy, voter, guard, middleware, route dependency).
48
+ 2. Apply it at the request boundary (FormRequest `authorize()`, controller / route-handler dependency, middleware chain).
49
+ 3. Cover non-model gates (cross-aggregate rules) — keep them centralised, not scattered across handlers.
42
50
 
43
51
  ### Step 3: Review for adversarial
44
52
 
45
- For security-sensitive changes, run `adversarial-review` skill.
53
+ For security-sensitive changes, run [`adversarial-review`](../adversarial-review/SKILL.md).
46
54
  Focus on: attack surface, trusting user input, authorization gaps.
47
55
 
48
56
  ## Conventions
49
57
 
50
- See guideline `php/security.md` for auth, SQL injection, XSS, CSRF, headers, session, mass assignment.
58
+ For PHP / Laravel specifics (auth helpers, mass assignment, Blade escaping, CSRF middleware): see guideline `docs/guidelines/php/security.md`.
59
+ → For other stacks, follow the framework's hardening guide and the carve-outs above.
51
60
 
52
61
  ### Validate
53
62
 
54
- - Verify all user input is validated via FormRequest before use.
55
- - Confirm authorization check exists (Policy or Gate) for every state-changing action.
56
- - Check that no raw user input reaches SQL, HTML output, or shell commands.
57
- - Run PHPStan — must pass (catches type-safety issues that enable injection).
63
+ - Verify all user input is validated at the boundary via the framework's primitive — never trust raw request data.
64
+ - Confirm an authorization check exists for every state-changing action.
65
+ - Check that no raw user input reaches SQL, HTML output, shell commands, or template renderers without escaping.
66
+ - Run the project's type-checker — must pass (catches type-safety issues that enable injection).
58
67
 
59
68
  ## Output format
60
69
 
61
- 1. Security-hardened code with auth, validation, and sanitization
62
- 2. Policy class for authorization if needed
70
+ 1. Security-hardened code with auth, input validation at the boundary, and output encoding.
71
+ 2. Authorization rule (Policy / voter / guard / middleware) co-located with the route.
63
72
 
64
73
  ## Gotcha
65
74
 
66
75
  - Validation ensures format, not intent — don't trust input after validation alone.
67
- - `Gate::authorize()` throws, `Gate::allows()` returns bool choose based on error handling.
68
- - Rate limiting: ALL public endpoints, not just login.
76
+ - "Throw" vs "boolean" authz APIs behave differently (`Gate::authorize()` throws vs `Gate::allows()` returns bool in Laravel; `CanActivate` in NestJS throws; FastAPI dependencies throw `HTTPException`). Pick based on how the framework expects failure to surface.
77
+ - Rate-limit ALL public endpoints, not just login.
69
78
  - Never log passwords, tokens, or API keys.
70
79
 
71
80
  ## Do NOT
72
81
 
73
- - Do NOT bypass FormRequest validation in controllers.
74
- - Do NOT use `$request->all()` for mass assignment use `$request->validated()`.
82
+ - Do NOT bypass the framework's request-validation primitive inside handlers.
83
+ - Do NOT bulk-bind raw request payloads to ORM entities without an explicit allow-list (`$fillable` / `$guarded`, DTO mapping, Pydantic model).
75
84
  - Do NOT store plaintext passwords or secrets in the database.
76
85
  - Do NOT expose internal error details in production API responses.
77
86
 
@@ -193,7 +193,7 @@ Before scoring the 5 Killers, verify structure:
193
193
  ```markdown
194
194
  | Skill | K1 Desc | K2 Over | K3 Obvious | K4 Gotcha | K5 Size | K6 Pointer | K7 Analysis | Verdict |
195
195
  |---|---|---|---|---|---|---|---|---|
196
- | dto-creator | ❌ | ✅ | ✅ | ⚠️ | ✅ | ✅ | ✅ | Fix description |
196
+ | laravel-dto | ❌ | ✅ | ✅ | ⚠️ | ✅ | ✅ | ✅ | Fix description |
197
197
  ```
198
198
 
199
199
  ## Output format
@@ -172,7 +172,7 @@ For mock-isolation failure modes (separate concern), see
172
172
 
173
173
  ## Examples
174
174
 
175
- ### PHP / Pest
175
+ ### Example A — PHP / Pest
176
176
 
177
177
  ```php
178
178
  // tests/Unit/EmailValidatorTest.php — RED
@@ -203,7 +203,7 @@ final class EmailValidator
203
203
  Run the filter again → passes. No additional rules (format, MX, length)
204
204
  until a next failing test drives them.
205
205
 
206
- ### JS / Vitest
206
+ ### Example B — TypeScript / Vitest
207
207
 
208
208
  ```ts
209
209
  // src/retry.test.ts — RED
@@ -270,8 +270,8 @@ wait for their own failing tests.
270
270
 
271
271
  ## When to hand over to another skill
272
272
 
273
- * Quality tools, PHPStan, ECS, Rector → [`quality-tools`](../quality-tools/SKILL.md)
274
- * Full Pest conventions, Laravel testing helpers → [`pest-testing`](../pest-testing/SKILL.md)
273
+ * Project type-checker / linter / formatter (PHPStan, ECS, Rector for PHP — tsc / eslint / prettier for TS — ruff / mypy for Python) → [`quality-tools`](../quality-tools/SKILL.md)
274
+ * Full Pest conventions and Laravel test helpers → [`pest-testing`](../pest-testing/SKILL.md)
275
275
  * Running tests inside Docker → [`tests-execute`](../tests-execute/SKILL.md)
276
276
  * Investigating why a test is failing for non-obvious reasons →
277
277
  [`systematic-debugging`](../systematic-debugging/SKILL.md)
@@ -3,6 +3,7 @@ name: test-performance
3
3
  description: "Use when optimizing test suite performance — database setup, seeder optimization, parallel testing, CI pipeline efficiency, or RefreshDatabase alternatives."
4
4
  source: package
5
5
  domain: quality
6
+ framework: laravel
6
7
  ---
7
8
 
8
9
  # test-performance
@@ -16,7 +17,7 @@ Use this skill when:
16
17
  - Parallel testing needs optimization
17
18
  - Seeders need performance analysis
18
19
  - CI pipeline test jobs need to be faster
19
- - Investigating flaky tests caused by DB state
20
+ - Investigating flaky tests caused by database state
20
21
 
21
22
  ## Procedure: Analyze test performance
22
23
 
@@ -56,7 +57,7 @@ Check these areas in order of typical impact:
56
57
  | **Migration count** | How many CREATE TABLE statements? | High if >20 |
57
58
  | **Schema dump** | Is `database/schema/` used? | High if missing |
58
59
  | **Seeder INSERT method** | Individual `save()` vs bulk insert? | Medium |
59
- | **Truncation** | Per-seeder truncate vs centralized? | Low (but correctness issues) |
60
+ | **Truncation** | Per-seeder truncate vs centralized? | Low (but causes correctness issues) |
60
61
  | **Connection discovery** | Dynamic `getPdo()` probing? | Low |
61
62
  | **Parallel worker setup** | Does each worker re-migrate? | High |
62
63
 
@@ -77,7 +78,7 @@ php artisan schema:dump --database=api_database
77
78
  #### B. Template DB Cloning (high ROI for parallel tests)
78
79
 
79
80
  Instead of each parallel worker running migrate+seed independently:
80
- 1. Prepare ONE template DB (migrate + seed)
81
+ 1. Prepare ONE template database (migrate + seed)
81
82
  2. Clone template for each worker via mysqldump
82
83
 
83
84
  ```bash
@@ -93,7 +94,7 @@ mysqldump template_db | mysql worker_db_test_1
93
94
 
94
95
  #### C. Skip Migrate+Seed Flag (high ROI for local dev)
95
96
 
96
- Add a config flag to skip DB setup when DB is already prepared:
97
+ Add a config flag to skip database setup when DB is already prepared:
97
98
 
98
99
  ```php
99
100
  // config/testing.php
@@ -159,7 +160,7 @@ Replace dynamic `getPdo()` probing with explicit config:
159
160
  ## Gotcha
160
161
 
161
162
  - Don't use RefreshDatabase when DatabaseTransactions suffices — full refresh is 10x slower.
162
- - The model forgets that parallel tests share the DB — use unique identifiers in test data.
163
+ - The model forgets that parallel tests share the database — use unique identifiers in test data.
163
164
  - Seeder optimization has the highest ROI — a 2s seeder running 100 times = 200s wasted.
164
165
  - Don't add indexes to test databases just for test performance — the real fix is better test design.
165
166