@event4u/agent-config 1.28.0 → 1.31.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 (52) hide show
  1. package/.agent-src/commands/agents/audit.md +101 -197
  2. package/.agent-src/commands/{copilot-agents → agents}/init.md +18 -10
  3. package/.agent-src/commands/agents/optimize.md +181 -0
  4. package/.agent-src/commands/agents.md +19 -12
  5. package/.agent-src/commands/optimize/agents-dir.md +111 -0
  6. package/.agent-src/commands/optimize.md +10 -8
  7. package/.agent-src/contexts/communication/rules-auto/guidelines-mechanics.md +6 -0
  8. package/.agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +2 -3
  9. package/.agent-src/contexts/contracts/agents-md-anatomy.md +132 -0
  10. package/.agent-src/skills/agents-md-thin-root/SKILL.md +8 -1
  11. package/.agent-src/skills/async-python-patterns/SKILL.md +147 -0
  12. package/.agent-src/skills/command-writing/SKILL.md +49 -0
  13. package/.agent-src/skills/copilot-agents-optimization/SKILL.md +3 -3
  14. package/.agent-src/skills/defense-in-depth/SKILL.md +152 -0
  15. package/.agent-src/skills/error-handling-patterns/SKILL.md +134 -0
  16. package/.agent-src/skills/mcp-builder/SKILL.md +108 -0
  17. package/.agent-src/skills/prompt-engineering-patterns/SKILL.md +145 -0
  18. package/.agent-src/skills/repomix-packer/SKILL.md +135 -0
  19. package/.agent-src/skills/roadmap-writing/SKILL.md +9 -0
  20. package/.agent-src/skills/rule-writing/SKILL.md +21 -0
  21. package/.agent-src/skills/secrets-management/SKILL.md +142 -0
  22. package/.agent-src/skills/skill-writing/SKILL.md +19 -0
  23. package/.agent-src/skills/testing-anti-patterns/SKILL.md +152 -0
  24. package/.agent-src/templates/AGENTS.md +9 -10
  25. package/.claude-plugin/marketplace.json +12 -7
  26. package/AGENTS.md +1 -2
  27. package/CHANGELOG.md +113 -0
  28. package/CONTRIBUTING.md +90 -0
  29. package/README.md +3 -3
  30. package/docs/architecture.md +3 -3
  31. package/docs/catalog.md +19 -13
  32. package/docs/contracts/command-clusters.md +20 -3
  33. package/docs/contracts/file-ownership-matrix.json +511 -48
  34. package/docs/contracts/package-self-orientation.md +1 -1
  35. package/docs/getting-started.md +1 -1
  36. package/docs/guidelines/code-clarity.md +95 -0
  37. package/docs/guidelines/php/general.md +8 -0
  38. package/docs/guidelines/php/php-coding-patterns.md +1 -0
  39. package/docs/skills-catalog.md +27 -3
  40. package/llms.txt +26 -2
  41. package/package.json +1 -1
  42. package/scripts/chat_history.py +166 -36
  43. package/scripts/check_command_count_messaging.py +12 -3
  44. package/scripts/check_portability.py +1 -0
  45. package/scripts/lint_agents_md.py +33 -0
  46. package/scripts/release.py +77 -2
  47. package/scripts/skill_linter.py +10 -3
  48. package/.agent-src/commands/agents/cleanup.md +0 -194
  49. package/.agent-src/commands/agents/prepare.md +0 -141
  50. package/.agent-src/commands/copilot-agents/optimize.md +0 -255
  51. package/.agent-src/commands/copilot-agents.md +0 -44
  52. package/.agent-src/commands/optimize/agents.md +0 -144
@@ -0,0 +1,135 @@
1
+ ---
2
+ name: repomix-packer
3
+ description: "Use when packaging a codebase to a single AI-friendly file for LLM analysis — local or remote, XML/Markdown/JSON, token counting, gitignore filtering, peer-side `repomix` CLI."
4
+ source: package
5
+ ---
6
+
7
+ > **Pinned upstream:** `repomix` CLI (npm: `repomix`, brew: `repomix`). Re-verify per minor bump. Repomix is an **optional dependency** — this skill never installs it silently.
8
+
9
+ # repomix-packer
10
+
11
+ Wraps the upstream [`yamadashy/repomix`](https://github.com/yamadashy/repomix) CLI for codebase-snapshot workflows: pack a local or remote repo into a single XML / Markdown / JSON file with token counts and secret detection, then feed it to an LLM for review, audit, or migration scoping.
12
+
13
+ ## When to use
14
+
15
+ - Producing an LLM-ingestible snapshot of a repo (or a sub-tree) for review or audit.
16
+ - Comparing two branches by packaging each and diffing the snapshots.
17
+ - Pulling a remote third-party library into context without cloning.
18
+ - Pre-flighting a token budget before sending a codebase to an LLM.
19
+
20
+ Do NOT use when:
21
+
22
+ - You only need a few specific files — read them directly with `view`.
23
+ - The snapshot will only feed a non-text format (PDF, image, audio) — route to [`markitdown`](../markitdown/SKILL.md).
24
+ - The repo is sensitive and `--no-security-check` would be needed — STOP, route to a human.
25
+
26
+ ## Procedure: Snapshot a repo for LLM review
27
+
28
+ ### 1. Inspect: verify `repomix` is installed (peer-side)
29
+
30
+ ```bash
31
+ repomix --version
32
+ ```
33
+
34
+ If the binary is missing, surface one of the install recipes and STOP — do not install silently:
35
+
36
+ ```bash
37
+ # npm (preferred for project-local installs)
38
+ npm install -g repomix
39
+
40
+ # Homebrew (macOS / Linux)
41
+ brew install repomix
42
+ ```
43
+
44
+ ### 2. Decide local vs remote
45
+
46
+ ```bash
47
+ # Local: pack the current directory.
48
+ repomix
49
+
50
+ # Remote shorthand: owner/repo
51
+ npx repomix --remote owner/repo
52
+
53
+ # Remote URL with a pinned commit
54
+ npx repomix --remote https://github.com/owner/repo/commit/<sha>
55
+ ```
56
+
57
+ ### 3. Filter the snapshot to the smallest useful slice
58
+
59
+ ```bash
60
+ # Include patterns
61
+ repomix --include "src/**/*.php,*.md"
62
+
63
+ # Add ignore patterns on top of .gitignore
64
+ repomix -i "tests/**,*.test.js"
65
+
66
+ # Strip comments to save tokens
67
+ repomix --remove-comments
68
+ ```
69
+
70
+ ### 4. Pick the output format and destination
71
+
72
+ ```bash
73
+ repomix --style markdown -o snapshot.md # human-readable
74
+ repomix --style xml -o snapshot.xml # default; clearest separators for LLMs
75
+ repomix --style json -o snapshot.json # programmatic post-processing
76
+ repomix --copy # also copy to clipboard
77
+ ```
78
+
79
+ ### 5. Verify token budget and secrets
80
+
81
+ Repomix prints per-file and total token counts and runs Secretlint on the output. Check the totals against the target LLM context window:
82
+
83
+ | Model | Approx context |
84
+ |--------------------|----------------|
85
+ | Claude Sonnet 4.5 | ~200K tokens |
86
+ | GPT-4 family | ~128K tokens |
87
+ | GPT-3.5 | ~16K tokens |
88
+
89
+ If Secretlint flags anything, STOP — sanitize the input or add the offending paths to `.repomixignore` before re-packing. Never use `--no-security-check` on an unfamiliar codebase.
90
+
91
+ ### 6. Hand the snapshot to the consumer skill
92
+
93
+ Most workflows that call this skill pass the snapshot to:
94
+
95
+ - A code-review pass — pair with [`judge-bug-hunter`](../judge-bug-hunter/SKILL.md) or [`judge-security-auditor`](../judge-security-auditor/SKILL.md).
96
+ - Reference-repo analysis — route to [`analyze-reference-repo`](../../commands/analyze-reference-repo.md).
97
+ - Migration scoping — route to [`blast-radius-analyzer`](../blast-radius-analyzer/SKILL.md).
98
+
99
+ Cite the snapshot path so the consumer skill can read it.
100
+
101
+ ## Output format
102
+
103
+ 1. The repomix invocation (one shell line, with all filters and the output path).
104
+ 2. The output file path + format + total token count.
105
+ 3. Any Secretlint findings, verbatim. Empty section if none.
106
+
107
+ ## Gotcha
108
+
109
+ - `--copy` puts the entire snapshot on the clipboard — surprising on large repos. Prefer `-o <path>` for anything > a few KB.
110
+ - `--no-gitignore` plus a wildcard include can pull in `.env`, `vendor/`, `node_modules/` — never combine without a tight `--include` first.
111
+ - Remote `npx repomix --remote owner/repo` defaults to the latest commit on the default branch — pin a commit SHA when reproducing a previous snapshot.
112
+ - Token counts are LLM-tokenizer estimates, not exact — leave a 10–15% headroom under the model's documented context window.
113
+
114
+ ## Do NOT
115
+
116
+ - Do NOT run `repomix --no-security-check` on an unfamiliar codebase.
117
+ - Do NOT install repomix silently — surface the recipe and let the consumer install it.
118
+ - Do NOT commit `repomix-output.*` artifacts — add the pattern to `.gitignore`.
119
+ - Do NOT package `.env`, key material, or `.git/` — adjust `.repomixignore` first.
120
+ - Do NOT vendor repomix into the repo — it is a peer-side CLI.
121
+
122
+ ## Auto-trigger keywords
123
+
124
+ - repomix
125
+ - pack codebase
126
+ - repository snapshot
127
+ - llm context bundle
128
+ - codebase to single file
129
+
130
+ ## Provenance
131
+
132
+ - Upstream tool: https://github.com/yamadashy/repomix (MIT).
133
+ - Adopted from: `Microck/ordinary-claude-skills@8f5c83174f7aa683b4ddc7433150471983b93131:skills_all/repomix/SKILL.md` (MIT, © 2025 Microck) — wrapper-style adoption, no upstream code vendored.
134
+ - Provenance registry: `agents/contexts/skills-provenance.yml` (entry: `repomix`).
135
+ - Iron-Law floor: `non-destructive-by-default`, `missing-tool-handling`, `tool-safety`.
@@ -131,6 +131,11 @@ to every roadmap you author.
131
131
  template rule 13 + [`scope-control`](../../rules/scope-control.md#git-operations--permission-gated).
132
132
  * Plan automatic branch switches mid-roadmap (template rule 14).
133
133
  * Ship a phase without checkboxes (`roadmap-progress-sync` Iron Law #2).
134
+ * Write merge, push, or commit steps into the roadmap. Roadmaps plan
135
+ **work**; merge / push / commit are delivery decisions owned by the
136
+ user (`commit-policy` Iron Law). A roadmap is "implementation-complete"
137
+ once its checkboxes are ticked and verification has been run — merge
138
+ timing is tracked outside the roadmap.
134
139
  * Use ALL-CAPS Iron-Law fenced blocks — those belong in
135
140
  [`kernel-membership`](../../../docs/contracts/kernel-membership.md)-listed
136
141
  rules, not roadmaps.
@@ -149,6 +154,10 @@ to every roadmap you author.
149
154
  - **Author-during-execution branch switches** — the agent should not
150
155
  propose a new branch mid-roadmap; that decision is fenced to
151
156
  authoring time.
157
+ - **Merge / commit steps in roadmap body** — checkboxes like
158
+ "merge PR #X" or "commit phase Y" couple roadmap closure to git
159
+ operations the user has not authorized. Roadmap completion is
160
+ decoupled from delivery; ship-the-PR is its own decision.
152
161
 
153
162
  ## Examples
154
163
 
@@ -128,6 +128,27 @@ the PR or split by responsibility.
128
128
  * Run the full CI pipeline locally (see `Taskfile.yml` in this repo for
129
129
  the script list) — must exit 0 except for tolerated warnings.
130
130
 
131
+ ### 6. Governance baseline (when introducing a new linter check)
132
+
133
+ **Advisory, reviewer-checked — no CI gate.** When the same PR adds a
134
+ new check to `scripts/skill_linter.py` (or strengthens an existing one)
135
+ such that previously-clean rules now warn, the PR body MUST record the
136
+ pre-existing violations on `main` in a Markdown table:
137
+
138
+ ```markdown
139
+ ### Pre-existing baseline (informational)
140
+
141
+ | Code | Count on main | Bucket |
142
+ |---|---:|---|
143
+ | {new_code} | N | (a) genuine fix · (b) accept · (c) check too aggressive |
144
+ ```
145
+
146
+ Forward-only: the new check applies to **the rule under review** and to
147
+ **future** edits. The baseline table is informational so reviewers can
148
+ distinguish genuine debt from acceptable carry-overs without diffing the
149
+ full lint output. See `agents/analysis/lint-warning-triage.md` for the
150
+ 3-bucket reference.
151
+
131
152
  ## Frontmatter shape
132
153
 
133
154
  ```yaml
@@ -0,0 +1,142 @@
1
+ ---
2
+ name: secrets-management
3
+ description: "Use when picking a secrets store, designing rotation, or wiring scanning gates — multi-cloud (Vault, AWS, Azure, GCP), CI, and Kubernetes — decision framework, provider deep-dives externalized."
4
+ source: package
5
+ status: active
6
+ refresh_trigger: "A cited provider deprecates an auth method, OR External Secrets Operator ships a major version with breaking CRD changes, OR ≥30% of cited scanner tools change their gate semantics."
7
+ sunset_criterion: "When provider docs (Vault, AWS Secrets Manager, Azure Key Vault, GCP Secret Manager) all converge on a single rotation + scanning standard AND consumer projects no longer cite this skill in PR reviews for two consecutive review cycles."
8
+ ---
9
+
10
+ # secrets-management
11
+
12
+ Decision framework for storing, rotating, and scanning secrets across cloud, CI, and Kubernetes. **Provider deep-dives live upstream** (links in § Provenance) — this skill is the predicate, not the per-vendor cookbook. Sunset-policy compliant.
13
+
14
+ ## When to use
15
+
16
+ - Designing where a new secret lives (env var, Vault, AWS Secrets Manager, Azure KV, GCP SM, GitHub/GitLab CI, k8s).
17
+ - Reviewing a diff that introduces a credential, API key, signing key, or DB password.
18
+ - Setting up secret rotation for an existing application.
19
+ - Wiring secret-scanning gates into pre-commit, CI, or org-policy.
20
+
21
+ Do NOT use when:
22
+
23
+ - The secret is project-AWS-only and `aws-infrastructure` already covers the placement — route there.
24
+ - The work is a security audit of running code — route to [`security-audit`](../security-audit/SKILL.md) or [`threat-modeling`](../threat-modeling/SKILL.md).
25
+ - The decision is which cipher to use for at-rest encryption — read the provider's KMS docs directly.
26
+
27
+ ## Decision framework
28
+
29
+ ### Step 1 — Pick the store
30
+
31
+ ```
32
+ Ephemeral, dev-only, never leaves the laptop → .env (gitignored). Stop.
33
+ Single-cloud, single-app → that cloud's native store
34
+ (AWS Secrets Manager / Azure Key Vault /
35
+ GCP Secret Manager).
36
+ Multi-cloud OR on-prem hybrid → HashiCorp Vault (or cloud-agnostic equivalent).
37
+ CI-only (deploy keys, signing tokens) → GitHub/GitLab repo+environment secrets;
38
+ scope to environment (production/staging).
39
+ Kubernetes workload secrets → External Secrets Operator pulling from
40
+ the canonical store above; never hand-rolled
41
+ k8s `Secret` objects committed to git.
42
+ Cross-tenant / cross-org shared secret → don't. Re-architect; shared secrets are an
43
+ outage and a breach class on their own.
44
+ ```
45
+
46
+ ### Step 2 — Pick the access pattern
47
+
48
+ ```
49
+ Application reads at boot → fetch once, hold in memory; re-fetch on rotation event.
50
+ Application reads per-request → cache with TTL ≤ rotation period / 2.
51
+ Short-lived workload (Lambda, Job) → fetch per-invocation; rely on platform IAM.
52
+ Long-lived workload → leased / dynamic credentials (Vault DB engine,
53
+ AWS IAM role) — never static creds.
54
+ Human access → no shared logins; per-user identity + audit.
55
+ ```
56
+
57
+ ### Step 3 — Define the rotation contract
58
+
59
+ Every secret MUST have:
60
+
61
+ - **Owner** — team/person responsible for rotation; tracked in code or runbook.
62
+ - **Period** — calendar trigger (e.g. 90 days for static creds, hours/minutes for dynamic).
63
+ - **Mechanism** — automated (Lambda + Secrets Manager rotation, Vault dynamic secret, IAM role) or documented manual procedure.
64
+ - **Verification** — post-rotation health check; alert if old credential still observed in use after rotation grace window.
65
+
66
+ Static secrets without a rotation mechanism are a deferred incident — refuse to merge.
67
+
68
+ ### Step 4 — Wire the scanning gates
69
+
70
+ Three layers, all required:
71
+
72
+ ```
73
+ Pre-commit → gitleaks / TruffleHog / detect-secrets pre-commit hook.
74
+ CI → server-side scan on every PR; block merge on high-confidence finding.
75
+ Org policy → push-protection at the SCM (GitHub Advanced Security secret scanning,
76
+ GitLab Secret Detection); rotate any leaked secret immediately.
77
+ ```
78
+
79
+ A leaked secret is rotated, not deleted. Git history retention defeats deletion.
80
+
81
+ ### Step 5 — Egress controls
82
+
83
+ ```
84
+ Logs → mask before write; CI runners must mark secrets as masked.
85
+ Stack traces → never include secret values; sanitize at the boundary.
86
+ Error responses → never echo the secret back, even on failure.
87
+ Telemetry / APM → strip from request/response captures; allowlist headers.
88
+ ```
89
+
90
+ ## Procedure: Apply to a new secret
91
+
92
+ 1. **Inspect** the existing secret inventory and IaC for store conventions; run Step 1 and lock the store decision in code/IaC.
93
+ 2. Define the access pattern (Step 2); choose static-vs-dynamic explicitly.
94
+ 3. Write the rotation contract (Step 3) into the runbook **before** the secret ships.
95
+ 4. Verify the three scanning gates (Step 4) cover the repo.
96
+ 5. Audit egress paths (Step 5) for the new secret class.
97
+ 6. Hand the design to a reviewer; cite this skill.
98
+
99
+ ## Output format
100
+
101
+ 1. Secret-inventory entry: name · store · access-pattern · owner · rotation-period · mechanism.
102
+ 2. Scanner-gate matrix: layer · tool · scope · failure mode.
103
+ 3. Egress-control checklist with sign-off per category.
104
+
105
+ ## Gotcha
106
+
107
+ - "We rotate in Secrets Manager" — but the application caches the value forever. Cache TTL must be ≤ rotation grace.
108
+ - External Secrets Operator pulls into a k8s `Secret`; that Secret is base64, **not encrypted**. Threat-model node access accordingly.
109
+ - GitHub environment secrets are NOT available on `pull_request` events from forks — designs that rely on them silently break for external contributors.
110
+ - Vault dynamic creds expire faster than long-running connection pools assume; close + re-acquire on lease near-expiry, don't wait for the failure.
111
+ - Pre-commit scanners fire only when developers install the hook — CI scanners are the load-bearing gate.
112
+
113
+ ## Do NOT
114
+
115
+ - Do NOT commit a secret, even to a private repo. Rotate any leaked secret; deletion does not work.
116
+ - Do NOT pass secrets via CLI args (`ps` exposes them) — use env or stdin.
117
+ - Do NOT echo secrets in logs, stack traces, error responses, or APM captures.
118
+ - Do NOT hand-roll Kubernetes `Secret` objects committed to git — use External Secrets Operator.
119
+ - Do NOT inline the per-provider cookbooks into this skill — externalize per Sunset Policy.
120
+
121
+ ## Auto-trigger keywords
122
+
123
+ - secrets management
124
+ - secret rotation
125
+ - vault / aws secrets manager / azure key vault / gcp secret manager
126
+ - external secrets operator
127
+ - secret scanning / gitleaks / trufflehog
128
+ - credential leak
129
+
130
+ ## Provenance
131
+
132
+ - Adopted from: `Microck/ordinary-claude-skills@8f5c83174f7aa683b4ddc7433150471983b93131:skills_all/secrets-management/SKILL.md` (MIT, © 2025 Microck) — **Sunset Policy applied**: 346-line provider cookbook reduced to a ~140-line decision framework; per-provider deep-dives externalized to upstream docs below.
133
+ - Externalized provider docs:
134
+ - HashiCorp Vault: https://developer.hashicorp.com/vault/docs · https://developer.hashicorp.com/vault/docs/secrets/databases
135
+ - AWS Secrets Manager: https://docs.aws.amazon.com/secretsmanager/ · rotation: https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets.html
136
+ - Azure Key Vault: https://learn.microsoft.com/en-us/azure/key-vault/general/
137
+ - GCP Secret Manager: https://cloud.google.com/secret-manager/docs
138
+ - External Secrets Operator: https://external-secrets.io/
139
+ - GitHub secret scanning: https://docs.github.com/en/code-security/secret-scanning · gitleaks: https://github.com/gitleaks/gitleaks · TruffleHog: https://github.com/trufflesecurity/trufflehog
140
+ - Cross-linked: [`aws-infrastructure`](../aws-infrastructure/SKILL.md), [`security-audit`](../security-audit/SKILL.md), [`threat-modeling`](../threat-modeling/SKILL.md), [`security`](../security/SKILL.md).
141
+ - Provenance registry: `agents/contexts/skills-provenance.yml` (entry: `secrets-management`).
142
+ - Iron-Law floor: `verify-before-complete`, `skill-quality`, `non-destructive-by-default`.
@@ -59,6 +59,25 @@ Ask: **"Does the model need this to do its job correctly?"**
59
59
  * If the model knows it but does it wrong in THIS project → **Rule or Guideline**
60
60
  * If the model needs a multi-step workflow to get it right → **Skill**
61
61
 
62
+ ### Skills and commands share the `.claude/skills/` namespace
63
+
64
+ Skills (`.agent-src.uncompressed/skills/{name}/SKILL.md`) AND commands
65
+ (`.agent-src.uncompressed/commands/{name}.md`) both project into
66
+ `.claude/skills/` (`scripts/compress.py` → `generate_claude_skills` +
67
+ `generate_claude_commands`). Claude treats the directory as native
68
+ skills.
69
+
70
+ * Same-name collision: skill wins, command is skipped
71
+ (`generate_claude_commands` honors this). Don't reuse a command's
72
+ slug for a skill unless the command should retire.
73
+ * Both compete on `description` for routing. A weak skill description
74
+ is shadowed by a stronger same-domain command — and vice versa.
75
+ Trigger phrasing must be precise (§ 1b below).
76
+ * Workflow has both "user types `/foo`" path AND "model picks this up
77
+ from intent" path → author the skill first, let the command delegate
78
+ via `skills:` frontmatter. Two artifacts with the same trigger
79
+ surface fight each other in the router.
80
+
62
81
  ### When "Nothing" is the right answer
63
82
 
64
83
  Do NOT create a skill or rule for:
@@ -0,0 +1,152 @@
1
+ ---
2
+ name: testing-anti-patterns
3
+ description: "Use BEFORE writing or changing tests, adding mocks, or putting test-only methods on production classes — five Iron Laws and gates against mocking-the-mock, production pollution, silent partial mocks."
4
+ source: package
5
+ ---
6
+
7
+ # testing-anti-patterns
8
+
9
+ Tests must verify real behavior, not mock behavior. Mocks isolate; they are not the thing under test. This skill is the **prevention** layer; [`judge-test-coverage`](../judge-test-coverage/SKILL.md) catches what slips through afterwards.
10
+
11
+ ## When to use
12
+
13
+ - About to write a new test that mocks a collaborator.
14
+ - Tempted to add a method to a production class purely for test cleanup.
15
+ - Mock setup is becoming longer than the test logic itself.
16
+ - A test passes but you cannot explain *what real behavior* it verified.
17
+ - Code review of a diff that adds mocks — run the gates below before approving.
18
+
19
+ Do NOT use when:
20
+
21
+ - You need to *write* tests (no anti-pattern present yet) — route to [`pest-testing`](../pest-testing/SKILL.md) or [`test-driven-development`](../test-driven-development/SKILL.md).
22
+ - The test failure is a real bug — route to [`systematic-debugging`](../systematic-debugging/SKILL.md).
23
+ - You need overall coverage assessment of a finished diff — route to [`judge-test-coverage`](../judge-test-coverage/SKILL.md).
24
+
25
+ ## The Iron Laws
26
+
27
+ ```
28
+ 1. NEVER test mock behavior — assert on real component behavior.
29
+ 2. NEVER add test-only methods to production classes — put them in test utilities.
30
+ 3. NEVER mock without understanding the dependency chain — observe first, mock minimally.
31
+ 4. NEVER ship partial mocks — mirror the real response shape completely.
32
+ 5. NEVER treat tests as an afterthought — write the failing test first.
33
+ ```
34
+
35
+ ## Procedure: Run the gate before each anti-pattern
36
+
37
+ ### 1. Inspect the diff before any new mock
38
+
39
+ Before writing or extending a test, **inspect** the code under test and identify which collaborators are real, which are mocked, and which produce side effects the assertion depends on. Open the file, read the dependency chain, and write the chain down. Do not start mocking until the chain is on paper.
40
+
41
+ ### Anti-Pattern 1 — Asserting on mock elements
42
+
43
+ Symptom: `expect(screen.getByTestId('sidebar-mock')).toBeInTheDocument()` or `$this->assertSee('mock-sidebar')`. Test passes when the mock is present, fails when it is not — proves nothing about the component.
44
+
45
+ Gate:
46
+
47
+ ```
48
+ BEFORE asserting on any mocked element / id / class:
49
+ Ask: "Am I asserting that the mock exists, or that the component behaves correctly?"
50
+
51
+ IF asserting that the mock exists:
52
+ STOP — delete the assertion or unmock the dependency.
53
+ Replace with a behavior assertion (role, output, side effect).
54
+ ```
55
+
56
+ ### Anti-Pattern 2 — Test-only methods in production classes
57
+
58
+ Symptom: `Session::destroy()` only ever called from `tearDown`. Production class polluted with code dangerous in production.
59
+
60
+ Gate:
61
+
62
+ ```
63
+ BEFORE adding any method to a production class:
64
+ Ask: "Is this only used by tests?"
65
+ IF yes:
66
+ STOP — move it to a test utility / trait / helper.
67
+ Ask: "Does this class own this resource's lifecycle?"
68
+ IF no:
69
+ STOP — wrong class for this method.
70
+ ```
71
+
72
+ Replacement: a `tests/Support/cleanupSession.php` helper or a trait used only by test classes.
73
+
74
+ ### Anti-Pattern 3 — Mocking without understanding
75
+
76
+ Symptom: A mocked method had a side effect the test depended on (e.g. wrote config). Mock kills the side effect; the test passes for the wrong reason or fails mysteriously.
77
+
78
+ Gate:
79
+
80
+ ```
81
+ BEFORE mocking any method:
82
+ STOP — do not mock yet.
83
+ 1. List the side effects the real method produces.
84
+ 2. List which of those side effects the test actually depends on.
85
+ 3. If the test depends on any of them, mock at a *lower* level (the slow / external bit), preserving the necessary behavior.
86
+ IF unsure:
87
+ Run the test with the real implementation FIRST. Observe what fails.
88
+ THEN mock minimally, just below the failing seam.
89
+
90
+ Red flags:
91
+ - "I'll mock this just to be safe."
92
+ - "This might be slow, better mock it."
93
+ - You cannot draw the dependency chain.
94
+ ```
95
+
96
+ ### Anti-Pattern 4 — Partial / incomplete mocks
97
+
98
+ Symptom: Mock returns only the fields the immediate test reads. Downstream code accesses an absent field and the test passes; integration breaks.
99
+
100
+ Iron Rule: mock the **complete** response shape that the real API returns, not just the fields your assertion uses. If you cannot enumerate the shape, you should not mock.
101
+
102
+ ```
103
+ BEFORE creating a mock response object:
104
+ 1. Examine the real response (docs, recorded fixture, type definition).
105
+ 2. Include EVERY documented field — even ones the test does not read.
106
+ 3. If the shape is unknown, capture a real response into `tests/fixtures/` instead of inventing one.
107
+ ```
108
+
109
+ **Concrete capture tools** for recording the real shape: `curl -s <url> | jq '.'` against a staging endpoint, Postman's "Save Response", Laravel's `Http::fake()` in record mode, or a Playwright network-trace export. Filter the captured payload with `jq` / `grep` to keep only the fields your fixture documents — **do not** dump unredacted secrets into `tests/fixtures/`.
110
+
111
+ ### Anti-Pattern 5 — Tests as an afterthought
112
+
113
+ Symptom: "Implementation complete, ready for testing." Implementation went in without tests. TDD was skipped, anti-patterns 1–4 are now likely.
114
+
115
+ Gate: a feature is not complete until a failing-then-passing test cycle ran for it. Route to [`test-driven-development`](../test-driven-development/SKILL.md).
116
+
117
+ ## Output format
118
+
119
+ 1. The mocking decision recorded as a one-line comment in the test file (`// mock at <seam>: <reason>`).
120
+ 2. The replacement test (or refactor) once an anti-pattern is identified.
121
+ 3. If a test-only method moved out of production, the diff must show both the deletion and the test-utility addition.
122
+
123
+ ## Gotcha
124
+
125
+ - Vague-test asserts (`assertTrue($result)`) hide mock-behavior assertions — flag any test where the assertion does not name an observable behavior.
126
+ - A "complete" mock that mirrors a v1 API silently rots when v2 ships — link mock fixtures to a real recorded response and re-record on schema changes.
127
+ - Layer 3 environment guards from [`defense-in-depth`](../defense-in-depth/SKILL.md) often expose anti-pattern 2: if a production guard fires only in tests, the test setup is wrong, not the guard.
128
+ - Long mock setups (> 50% of the test) are a signal that integration tests would be simpler — consider it before piling on more mocks.
129
+ - **Diagnose, do not brute-force.** If a test fails after a mock change, **never guess** at another mock tweak — drop a debugger / Xdebug breakpoint at the seam, observe the real call shape, then mock minimally. Two retries without a root-cause hypothesis = STOP and rethink.
130
+
131
+ ## Do NOT
132
+
133
+ - Do NOT add `*-mock` test ids to production templates.
134
+ - Do NOT extend a production class to expose internals "just for testing".
135
+ - Do NOT mock a method whose side effects the test depends on without reading the implementation.
136
+ - Do NOT invent mock data shapes from memory — record from the real source.
137
+ - Do NOT mark a story complete until at least one test was watched failing first.
138
+
139
+ ## Auto-trigger keywords
140
+
141
+ - testing anti-patterns
142
+ - mock behavior
143
+ - test-only method
144
+ - partial mock
145
+ - mock without understanding
146
+
147
+ ## Provenance
148
+
149
+ - Adopted from: `Microck/ordinary-claude-skills@8f5c83174f7aa683b4ddc7433150471983b93131:skills_all/testing-anti-patterns/SKILL.md` (MIT, © 2025 Microck).
150
+ - Cross-linked: [`pest-testing`](../pest-testing/SKILL.md), [`test-driven-development`](../test-driven-development/SKILL.md), [`judge-test-coverage`](../judge-test-coverage/SKILL.md).
151
+ - Provenance registry: `agents/contexts/skills-provenance.yml` (entry: `testing-anti-patterns`).
152
+ - Iron-Law floor: `verify-before-complete`, `skill-quality`.
@@ -1,25 +1,24 @@
1
1
  # {{project_name}}
2
2
 
3
3
  <!--
4
- AGENTS.md entry point for AI coding agents. Installed by
5
- `event4u/agent-config`. Fill placeholders (or run `/copilot-agents-init`)
6
- and delete this comment. Keep thin; bulk prose belongs in the linked guide.
4
+ Fill placeholders or run `/agents init`, then delete this
5
+ comment. Iron Law capability bullets, not path lists; paths rot.
6
+ Tool stubs (`CLAUDE.md`, `GEMINI.md`, `.cursorrules`) link here.
7
+ Anatomy + recipes: `.augment/contexts/contracts/agents-md-anatomy.md`.
7
8
  -->
8
9
 
9
- {{project_description}}
10
+ > {{project_description}}
10
11
 
11
12
  ## Layers
12
13
 
13
- | Layer | Location | Purpose |
14
+ | Layer | Location | Edits |
14
15
  |---|---|---|
15
- | **Shared package** | `.augment/`, `.agent-src/` | Installed skills / rules / commands — do not hand-edit |
16
- | **Project overrides** | `agents/overrides/` | Customizations of shared resources |
17
- | **Project docs** | `agents/` | Architecture, features, roadmaps, sessions, contexts |
18
- | **Agent settings** | `.agent-settings.yml` | Project-specific config consumed by skills |
16
+ | Installed package | `.augment/`, `.agent-src/` | hands-off managed by `event4u/agent-config` |
17
+ | Project layer | `agents/`, `agents/overrides/`, `.agent-settings.yml` | your customizations and config |
19
18
 
20
19
  ## Pointers
21
20
 
22
- - **Filling out this AGENTS.md** — tech-stack / dev-setup / testing / quality / project-structure templates plus `/work` + `/implement-ticket` entry flow and multi-agent matrix: [`.augment/contexts/contracts/consumer-agents-md-guide.md`](.augment/contexts/contracts/consumer-agents-md-guide.md).
21
+ - **Filling out this AGENTS.md** — section templates, capability bullets, multi-agent entry flow, monorepo per-package layout: [`.augment/contexts/contracts/consumer-agents-md-guide.md`](.augment/contexts/contracts/consumer-agents-md-guide.md).
23
22
  - **Behavior rules (always active)** — Iron Laws and routed rules that fire automatically while you work in this project: [`.augment/rules/`](.augment/rules/).
24
23
  - **Skills (on-demand expertise)** — domain skills surfaced by description; invoked when their trigger fires: [`.augment/skills/`](.augment/skills/).
25
24
  - **Commands (workflows)** — slash-commands the agent runs end-to-end (`/work`, `/implement-ticket`, `/commit`, `/create-pr`, …): [`.augment/commands/`](.augment/commands/).
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Shared agent configuration \u2014 skills for AI coding tools (Claude Code, Augment, Cursor, Cline, Windsurf, Gemini CLI).",
9
- "version": "1.28.0"
9
+ "version": "1.31.0"
10
10
  },
11
11
  "plugins": [
12
12
  {
@@ -22,9 +22,9 @@
22
22
  "./.claude/skills/agent-status",
23
23
  "./.claude/skills/agents",
24
24
  "./.claude/skills/agents-audit",
25
- "./.claude/skills/agents-cleanup",
25
+ "./.claude/skills/agents-init",
26
26
  "./.claude/skills/agents-md-thin-root",
27
- "./.claude/skills/agents-prepare",
27
+ "./.claude/skills/agents-optimize",
28
28
  "./.claude/skills/ai-council",
29
29
  "./.claude/skills/analysis-autonomous-mode",
30
30
  "./.claude/skills/analysis-skill-router",
@@ -33,6 +33,7 @@
33
33
  "./.claude/skills/api-endpoint",
34
34
  "./.claude/skills/api-testing",
35
35
  "./.claude/skills/artisan-commands",
36
+ "./.claude/skills/async-python-patterns",
36
37
  "./.claude/skills/authz-review",
37
38
  "./.claude/skills/aws-infrastructure",
38
39
  "./.claude/skills/blade-ui",
@@ -63,10 +64,7 @@
63
64
  "./.claude/skills/context-document",
64
65
  "./.claude/skills/context-refactor",
65
66
  "./.claude/skills/conventional-commits-writing",
66
- "./.claude/skills/copilot-agents",
67
- "./.claude/skills/copilot-agents-init",
68
67
  "./.claude/skills/copilot-agents-optimization",
69
- "./.claude/skills/copilot-agents-optimize",
70
68
  "./.claude/skills/copilot-config",
71
69
  "./.claude/skills/cost-report",
72
70
  "./.claude/skills/council",
@@ -81,6 +79,7 @@
81
79
  "./.claude/skills/database",
82
80
  "./.claude/skills/dcf-modeling",
83
81
  "./.claude/skills/deep-reading-analyst",
82
+ "./.claude/skills/defense-in-depth",
84
83
  "./.claude/skills/dependency-upgrade",
85
84
  "./.claude/skills/description-assist",
86
85
  "./.claude/skills/design-review",
@@ -91,6 +90,7 @@
91
90
  "./.claude/skills/e2e-heal",
92
91
  "./.claude/skills/e2e-plan",
93
92
  "./.claude/skills/eloquent",
93
+ "./.claude/skills/error-handling-patterns",
94
94
  "./.claude/skills/estimate-ticket",
95
95
  "./.claude/skills/existing-ui-audit",
96
96
  "./.claude/skills/fe-design",
@@ -146,6 +146,7 @@
146
146
  "./.claude/skills/logging-monitoring",
147
147
  "./.claude/skills/markitdown",
148
148
  "./.claude/skills/mcp",
149
+ "./.claude/skills/mcp-builder",
149
150
  "./.claude/skills/md-language-check",
150
151
  "./.claude/skills/memory",
151
152
  "./.claude/skills/memory-add",
@@ -165,7 +166,7 @@
165
166
  "./.claude/skills/onboard",
166
167
  "./.claude/skills/openapi",
167
168
  "./.claude/skills/optimize",
168
- "./.claude/skills/optimize-agents",
169
+ "./.claude/skills/optimize-agents-dir",
169
170
  "./.claude/skills/optimize-augmentignore",
170
171
  "./.claude/skills/optimize-prompt",
171
172
  "./.claude/skills/optimize-rtk",
@@ -197,6 +198,7 @@
197
198
  "./.claude/skills/project-analyzer",
198
199
  "./.claude/skills/project-docs",
199
200
  "./.claude/skills/project-health",
201
+ "./.claude/skills/prompt-engineering-patterns",
200
202
  "./.claude/skills/prompt-optimizer",
201
203
  "./.claude/skills/quality-fix",
202
204
  "./.claude/skills/quality-tools",
@@ -208,6 +210,7 @@
208
210
  "./.claude/skills/receiving-code-review",
209
211
  "./.claude/skills/refine-prompt",
210
212
  "./.claude/skills/refine-ticket",
213
+ "./.claude/skills/repomix-packer",
211
214
  "./.claude/skills/requesting-code-review",
212
215
  "./.claude/skills/research",
213
216
  "./.claude/skills/review-changes",
@@ -225,6 +228,7 @@
225
228
  "./.claude/skills/rule-compliance-audit",
226
229
  "./.claude/skills/rule-writing",
227
230
  "./.claude/skills/script-writing",
231
+ "./.claude/skills/secrets-management",
228
232
  "./.claude/skills/security",
229
233
  "./.claude/skills/security-audit",
230
234
  "./.claude/skills/sentry-integration",
@@ -244,6 +248,7 @@
244
248
  "./.claude/skills/terragrunt",
245
249
  "./.claude/skills/test-driven-development",
246
250
  "./.claude/skills/test-performance",
251
+ "./.claude/skills/testing-anti-patterns",
247
252
  "./.claude/skills/tests",
248
253
  "./.claude/skills/tests-create",
249
254
  "./.claude/skills/tests-execute",
package/AGENTS.md CHANGED
@@ -19,8 +19,7 @@ task ci # full pipeline — green before PR
19
19
  - **Package self-orientation** — identity, four-wing cognition map, repo layout, tech stack, key-rules table, telemetry, command-suggester: [`docs/contracts/package-self-orientation.md`](docs/contracts/package-self-orientation.md).
20
20
  - **Kernel + Router** — 9 always-loaded Iron-Law rules, tier-1 / tier-2 routing, cost profiles, per-rule char caps enforced by `task lint-rule-budget`: [`kernel-membership`](docs/contracts/kernel-membership.md) + [`rule-router`](docs/contracts/rule-router.md).
21
21
  - **Multi-tool projection** — Augment, Claude Code, Cursor, Cline, Windsurf, Gemini CLI, Claude.ai bundle pipeline that ships from `.agent-src/` to consumer surfaces: [`docs/architecture.md`](docs/architecture.md#cloud-bundle-pipeline).
22
- - **Iron-Law rules when editing this repo** — portability, source-of-truth, skill-quality: [`augment-portability`](.agent-src/rules/augment-portability.md), [`augment-source-of-truth`](.agent-src/rules/augment-source-of-truth.md), [`skill-quality`](.agent-src/rules/skill-quality.md).
23
- - **Thin-Root contract** governing **this** file (cap, pointer ratio, emergency-triage block) — read before editing AGENTS.md: [`agents-md-thin-root`](.agent-src/skills/agents-md-thin-root/SKILL.md).
22
+ - **Editing this repo** — Iron-Law rules (portability, source-of-truth, skill-quality) and the Thin-Root contract (caps · pointer-ratio · triage block) governing AGENTS.md: [`augment-portability`](.agent-src/rules/augment-portability.md), [`augment-source-of-truth`](.agent-src/rules/augment-source-of-truth.md), [`skill-quality`](.agent-src/rules/skill-quality.md), [`agents-md-thin-root`](.agent-src/skills/agents-md-thin-root/SKILL.md).
24
23
  - **Consumer story + architecture deep-dive** — what the package does for installers and how it ships: [`README.md`](README.md), [`docs/architecture.md`](docs/architecture.md).
25
24
 
26
25
  ## Emergency triage — read this when nothing else is reachable