@event4u/agent-config 1.28.0 → 1.29.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.
@@ -0,0 +1,145 @@
1
+ ---
2
+ name: prompt-engineering-patterns
3
+ description: "Use when designing production-LLM prompts — few-shot, chain-of-thought, system prompts, templates, self-verification — distinct from prompt-optimizer and refine-prompt."
4
+ source: package
5
+ status: active
6
+ ---
7
+
8
+ # prompt-engineering-patterns
9
+
10
+ Production patterns for LLM prompts: few-shot, chain-of-thought, system-prompt design, templating, self-verification. **Distinct surface** from sibling skills:
11
+
12
+ - [`prompt-optimizer`](../prompt-optimizer/SKILL.md) — polishes a single end-user prompt for ChatGPT / Claude / Gemini.
13
+ - [`refine-prompt`](../refine-prompt/SKILL.md) — refines a free-form work prompt into engine-ready acceptance criteria.
14
+ - **This skill** — designs prompts that ship inside an application that calls an LLM at runtime.
15
+
16
+ ## When to use
17
+
18
+ - Designing the system prompt for a new LLM-powered feature.
19
+ - Building a few-shot template with dynamic example selection.
20
+ - Adding chain-of-thought reasoning to a low-accuracy prompt.
21
+ - Reviewing a prompt diff in production code.
22
+ - Diagnosing inconsistent LLM outputs that look like prompt drift.
23
+
24
+ Do NOT use when:
25
+
26
+ - Polishing a one-off prompt for a chat session — route to `prompt-optimizer`.
27
+ - Turning a Jira ticket into engine input — route to `refine-prompt`.
28
+ - Tuning a model's weights — this skill is prompt-only, not fine-tuning.
29
+
30
+ ## Decision framework
31
+
32
+ ### Step 1 — Pick the prompt level (progressive disclosure)
33
+
34
+ ```
35
+ Start at Level 1; only escalate when measurement says you must.
36
+
37
+ Level 1 Direct instruction "Summarize this article."
38
+ Level 2 + constraints (length, format, focus) "...in 3 bullets, key findings only."
39
+ Level 3 + reasoning scaffold "Read first, identify findings, then summarize."
40
+ Level 4 + few-shot examples "Like these examples: ..."
41
+ Level 5 + self-verification step "...then check answer against criteria; revise if fails."
42
+ ```
43
+
44
+ Escalating without evidence is over-engineering. Each level adds tokens, latency, and a maintenance surface.
45
+
46
+ ### Step 2 — Structure the prompt
47
+
48
+ Fixed instruction hierarchy — every production prompt fills these slots in order:
49
+
50
+ ```
51
+ [System context] role, expertise, constraints, safety
52
+ [Task instruction] what to do, in one sentence
53
+ [Examples] few-shot demonstrations (optional)
54
+ [Input data] the user-supplied content
55
+ [Output format] schema, length, citation rules
56
+ ```
57
+
58
+ Stable slots (system, task, format) belong in cached prompt prefixes; volatile slots (examples, input) belong in the per-call portion.
59
+
60
+ ### Step 3 — Pick the few-shot strategy
61
+
62
+ ```
63
+ Examples are uniform and small (< 20) → embed all of them; deterministic.
64
+ Examples are large or diverse → semantic-similarity retrieval per call.
65
+ Edge cases dominate → diversity-sampled examples (cluster + pick one per cluster).
66
+ Token budget tight → fewer, higher-quality examples beats many mediocre.
67
+ Examples drift with the data → regenerate from a labeled corpus on a schedule, not hand-edited.
68
+ ```
69
+
70
+ Bad examples are worse than no examples — the model imitates structure.
71
+
72
+ ### Step 4 — Add chain-of-thought ONLY when measured
73
+
74
+ CoT improves accuracy on multi-step reasoning, hurts on classification and lookup. Decision rule:
75
+
76
+ ```
77
+ Task is multi-step / arithmetic / multi-hop → add CoT (zero-shot "let's think step by step", or few-shot CoT).
78
+ Task is single-step extraction / classify → CoT adds tokens without lift; skip.
79
+ You haven't measured → measure first, decide second.
80
+ Self-consistency needed (high-stakes answers) → sample N reasoning paths, majority vote.
81
+ ```
82
+
83
+ ### Step 5 — Build error recovery into the prompt
84
+
85
+ Production prompts handle their own failure cases:
86
+
87
+ - Specify the explicit "I don't know" output (don't let the model invent).
88
+ - Require a confidence indicator when downstream code needs to gate.
89
+ - Define the format for "missing information" so callers can branch.
90
+ - For self-verification: specify the criteria, then the revision rule.
91
+
92
+ ### Step 6 — Treat prompts as code
93
+
94
+ - Version every prompt (file + git, not a wiki page).
95
+ - Test on a frozen evaluation set before shipping changes.
96
+ - Track P50 / P95 latency, token usage, accuracy, success rate per version.
97
+ - A/B test prompt variants behind a flag; never edit a live prompt without a rollback path.
98
+
99
+ ## Procedure: Apply to a new LLM feature
100
+
101
+ 1. **Inspect** the existing prompt (if any) and the eval set; verify a success metric exists (accuracy / consistency / latency / token cost) — refuse to design without it.
102
+ 2. Draft Level-1 prompt (Step 1) and measure on the eval set.
103
+ 3. Escalate one level at a time (Step 1) until metric is met or budget runs out.
104
+ 4. Lock the structure (Step 2), choose few-shot strategy (Step 3), decide CoT (Step 4).
105
+ 5. Add error-recovery clauses (Step 5).
106
+ 6. Commit prompt + eval results + chosen version (Step 6); cite this skill.
107
+
108
+ ## Output format
109
+
110
+ 1. Prompt-spec table: slot · content · stable-vs-volatile · cached-vs-per-call.
111
+ 2. Eval results table: prompt-version · metric · delta-vs-previous.
112
+ 3. Failure-mode list: trigger · prompt clause that handles it.
113
+
114
+ ## Gotcha
115
+
116
+ - Few-shot examples leak the model's style — examples that include hedging produce hedging.
117
+ - "Let's think step by step" works zero-shot on capable models, fails on smaller models without exemplar reasoning traces.
118
+ - Self-consistency (N samples + vote) multiplies cost by N — only on high-stakes paths.
119
+ - Cached prompt prefixes only cache when byte-identical — a single reformat busts the cache.
120
+ - Prompts that drift across model versions silently regress accuracy when the provider rolls a model update; pin model version OR re-run eval per release.
121
+
122
+ ## Do NOT
123
+
124
+ - Do NOT escalate to Level 4 / 5 before measuring at lower levels.
125
+ - Do NOT mix few-shot examples from different tasks; the model averages them.
126
+ - Do NOT add CoT to single-step classification — it hurts.
127
+ - Do NOT hand-edit production prompts without versioning + eval.
128
+ - Do NOT echo secrets or PII into the prompt — they end up in provider logs.
129
+
130
+ ## Auto-trigger keywords
131
+
132
+ - prompt engineering
133
+ - few-shot learning
134
+ - chain-of-thought
135
+ - system prompt design
136
+ - prompt template
137
+ - LLM prompt versioning
138
+ - prompt evaluation
139
+
140
+ ## Provenance
141
+
142
+ - Adopted from: `Microck/ordinary-claude-skills@8f5c83174f7aa683b4ddc7433150471983b93131:skills_all/prompt-engineering-patterns/SKILL.md` (MIT, © 2025 Microck) — restructured into a decision-framework shape; vendor `prompt_optimizer` Python snippets dropped (project-specific to Microck).
143
+ - Cross-linked: [`prompt-optimizer`](../prompt-optimizer/SKILL.md), [`refine-prompt`](../refine-prompt/SKILL.md), [`mcp-builder`](../mcp-builder/SKILL.md), [`async-python-patterns`](../async-python-patterns/SKILL.md).
144
+ - Provenance registry: `agents/contexts/skills-provenance.yml` (entry: `prompt-engineering-patterns`).
145
+ - Iron-Law floor: `verify-before-complete`, `skill-quality`, `non-destructive-by-default`.
@@ -0,0 +1,135 @@
1
+ ---
2
+ name: repomix
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
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
+ ### Step 0: 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
+ ### Step 1: 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
+ ### Step 2: 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
+ ### Step 3: 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
+ ### Step 4: 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
+ ### Step 5: 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`.
@@ -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`.
@@ -0,0 +1,145 @@
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
+ ### Anti-Pattern 1 — Asserting on mock elements
38
+
39
+ 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.
40
+
41
+ Gate:
42
+
43
+ ```
44
+ BEFORE asserting on any mocked element / id / class:
45
+ Ask: "Am I asserting that the mock exists, or that the component behaves correctly?"
46
+
47
+ IF asserting that the mock exists:
48
+ STOP — delete the assertion or unmock the dependency.
49
+ Replace with a behavior assertion (role, output, side effect).
50
+ ```
51
+
52
+ ### Anti-Pattern 2 — Test-only methods in production classes
53
+
54
+ Symptom: `Session::destroy()` only ever called from `tearDown`. Production class polluted with code dangerous in production.
55
+
56
+ Gate:
57
+
58
+ ```
59
+ BEFORE adding any method to a production class:
60
+ Ask: "Is this only used by tests?"
61
+ IF yes:
62
+ STOP — move it to a test utility / trait / helper.
63
+ Ask: "Does this class own this resource's lifecycle?"
64
+ IF no:
65
+ STOP — wrong class for this method.
66
+ ```
67
+
68
+ Replacement: a `tests/Support/cleanupSession.php` helper or a trait used only by test classes.
69
+
70
+ ### Anti-Pattern 3 — Mocking without understanding
71
+
72
+ 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.
73
+
74
+ Gate:
75
+
76
+ ```
77
+ BEFORE mocking any method:
78
+ STOP — do not mock yet.
79
+ 1. List the side effects the real method produces.
80
+ 2. List which of those side effects the test actually depends on.
81
+ 3. If the test depends on any of them, mock at a *lower* level (the slow / external bit), preserving the necessary behavior.
82
+ IF unsure:
83
+ Run the test with the real implementation FIRST. Observe what fails.
84
+ THEN mock minimally, just below the failing seam.
85
+
86
+ Red flags:
87
+ - "I'll mock this just to be safe."
88
+ - "This might be slow, better mock it."
89
+ - You cannot draw the dependency chain.
90
+ ```
91
+
92
+ ### Anti-Pattern 4 — Partial / incomplete mocks
93
+
94
+ Symptom: Mock returns only the fields the immediate test reads. Downstream code accesses an absent field and the test passes; integration breaks.
95
+
96
+ 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.
97
+
98
+ ```
99
+ BEFORE creating a mock response object:
100
+ 1. Examine the real response (docs, recorded fixture, type definition).
101
+ 2. Include EVERY documented field — even ones the test does not read.
102
+ 3. If the shape is unknown, capture a real response into `tests/fixtures/` instead of inventing one.
103
+ ```
104
+
105
+ ### Anti-Pattern 5 — Tests as an afterthought
106
+
107
+ Symptom: "Implementation complete, ready for testing." Implementation went in without tests. TDD was skipped, anti-patterns 1–4 are now likely.
108
+
109
+ 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).
110
+
111
+ ## Output format
112
+
113
+ 1. The mocking decision recorded as a one-line comment in the test file (`// mock at <seam>: <reason>`).
114
+ 2. The replacement test (or refactor) once an anti-pattern is identified.
115
+ 3. If a test-only method moved out of production, the diff must show both the deletion and the test-utility addition.
116
+
117
+ ## Gotcha
118
+
119
+ - Vague-test asserts (`assertTrue($result)`) hide mock-behavior assertions — flag any test where the assertion does not name an observable behavior.
120
+ - 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.
121
+ - 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.
122
+ - Long mock setups (> 50% of the test) are a signal that integration tests would be simpler — consider it before piling on more mocks.
123
+
124
+ ## Do NOT
125
+
126
+ - Do NOT add `*-mock` test ids to production templates.
127
+ - Do NOT extend a production class to expose internals "just for testing".
128
+ - Do NOT mock a method whose side effects the test depends on without reading the implementation.
129
+ - Do NOT invent mock data shapes from memory — record from the real source.
130
+ - Do NOT mark a story complete until at least one test was watched failing first.
131
+
132
+ ## Auto-trigger keywords
133
+
134
+ - testing anti-patterns
135
+ - mock behavior
136
+ - test-only method
137
+ - partial mock
138
+ - mock without understanding
139
+
140
+ ## Provenance
141
+
142
+ - Adopted from: `Microck/ordinary-claude-skills@8f5c83174f7aa683b4ddc7433150471983b93131:skills_all/testing-anti-patterns/SKILL.md` (MIT, © 2025 Microck).
143
+ - Cross-linked: [`pest-testing`](../pest-testing/SKILL.md), [`test-driven-development`](../test-driven-development/SKILL.md), [`judge-test-coverage`](../judge-test-coverage/SKILL.md).
144
+ - Provenance registry: `agents/contexts/skills-provenance.yml` (entry: `testing-anti-patterns`).
145
+ - Iron-Law floor: `verify-before-complete`, `skill-quality`.
@@ -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.29.0"
10
10
  },
11
11
  "plugins": [
12
12
  {
@@ -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",
@@ -81,6 +82,7 @@
81
82
  "./.claude/skills/database",
82
83
  "./.claude/skills/dcf-modeling",
83
84
  "./.claude/skills/deep-reading-analyst",
85
+ "./.claude/skills/defense-in-depth",
84
86
  "./.claude/skills/dependency-upgrade",
85
87
  "./.claude/skills/description-assist",
86
88
  "./.claude/skills/design-review",
@@ -91,6 +93,7 @@
91
93
  "./.claude/skills/e2e-heal",
92
94
  "./.claude/skills/e2e-plan",
93
95
  "./.claude/skills/eloquent",
96
+ "./.claude/skills/error-handling-patterns",
94
97
  "./.claude/skills/estimate-ticket",
95
98
  "./.claude/skills/existing-ui-audit",
96
99
  "./.claude/skills/fe-design",
@@ -146,6 +149,7 @@
146
149
  "./.claude/skills/logging-monitoring",
147
150
  "./.claude/skills/markitdown",
148
151
  "./.claude/skills/mcp",
152
+ "./.claude/skills/mcp-builder",
149
153
  "./.claude/skills/md-language-check",
150
154
  "./.claude/skills/memory",
151
155
  "./.claude/skills/memory-add",
@@ -197,6 +201,7 @@
197
201
  "./.claude/skills/project-analyzer",
198
202
  "./.claude/skills/project-docs",
199
203
  "./.claude/skills/project-health",
204
+ "./.claude/skills/prompt-engineering-patterns",
200
205
  "./.claude/skills/prompt-optimizer",
201
206
  "./.claude/skills/quality-fix",
202
207
  "./.claude/skills/quality-tools",
@@ -208,6 +213,7 @@
208
213
  "./.claude/skills/receiving-code-review",
209
214
  "./.claude/skills/refine-prompt",
210
215
  "./.claude/skills/refine-ticket",
216
+ "./.claude/skills/repomix",
211
217
  "./.claude/skills/requesting-code-review",
212
218
  "./.claude/skills/research",
213
219
  "./.claude/skills/review-changes",
@@ -225,6 +231,7 @@
225
231
  "./.claude/skills/rule-compliance-audit",
226
232
  "./.claude/skills/rule-writing",
227
233
  "./.claude/skills/script-writing",
234
+ "./.claude/skills/secrets-management",
228
235
  "./.claude/skills/security",
229
236
  "./.claude/skills/security-audit",
230
237
  "./.claude/skills/sentry-integration",
@@ -244,6 +251,7 @@
244
251
  "./.claude/skills/terragrunt",
245
252
  "./.claude/skills/test-driven-development",
246
253
  "./.claude/skills/test-performance",
254
+ "./.claude/skills/testing-anti-patterns",
247
255
  "./.claude/skills/tests",
248
256
  "./.claude/skills/tests-create",
249
257
  "./.claude/skills/tests-execute",