@softspark/ai-toolkit 2.10.1 → 2.12.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 (79) hide show
  1. package/AGENTS.md +21 -21
  2. package/CHANGELOG.md +38 -0
  3. package/README.md +8 -7
  4. package/app/.claude-plugin/plugin.json +1 -1
  5. package/app/agents/meta-architect.md +44 -0
  6. package/app/rules/common/coding-style.md +8 -1
  7. package/app/rules/dart/frameworks.md +9 -1
  8. package/app/rules/php/frameworks.md +10 -1
  9. package/app/skills/agent-creator/SKILL.md +22 -6
  10. package/app/skills/analyze/SKILL.md +21 -1
  11. package/app/skills/api-patterns/SKILL.md +27 -0
  12. package/app/skills/app-builder/SKILL.md +24 -0
  13. package/app/skills/architecture-audit/SKILL.md +24 -0
  14. package/app/skills/architecture-decision/SKILL.md +24 -0
  15. package/app/skills/biz-scan/SKILL.md +24 -0
  16. package/app/skills/brand-voice/SKILL.md +36 -0
  17. package/app/skills/briefing/SKILL.md +41 -1
  18. package/app/skills/build/SKILL.md +24 -1
  19. package/app/skills/chaos/SKILL.md +22 -1
  20. package/app/skills/ci/SKILL.md +22 -1
  21. package/app/skills/ci-cd-patterns/SKILL.md +25 -0
  22. package/app/skills/command-creator/SKILL.md +31 -2
  23. package/app/skills/content-moderation-patterns/SKILL.md +25 -0
  24. package/app/skills/database-patterns/SKILL.md +25 -0
  25. package/app/skills/debug/SKILL.md +23 -1
  26. package/app/skills/design-engineering/SKILL.md +25 -0
  27. package/app/skills/docker-devops/SKILL.md +26 -0
  28. package/app/skills/ecommerce-patterns/SKILL.md +26 -0
  29. package/app/skills/evaluate/SKILL.md +22 -1
  30. package/app/skills/evolve/SKILL.md +25 -0
  31. package/app/skills/explain/SKILL.md +26 -1
  32. package/app/skills/explore/SKILL.md +25 -0
  33. package/app/skills/fix/SKILL.md +26 -1
  34. package/app/skills/git-mastery/SKILL.md +26 -0
  35. package/app/skills/grill-me/SKILL.md +22 -7
  36. package/app/skills/health/SKILL.md +22 -1
  37. package/app/skills/hipaa-validate/SKILL.md +25 -8
  38. package/app/skills/hook-creator/SKILL.md +23 -6
  39. package/app/skills/index/SKILL.md +22 -1
  40. package/app/skills/instinct-review/SKILL.md +25 -1
  41. package/app/skills/introspect/SKILL.md +26 -1
  42. package/app/skills/lint/SKILL.md +27 -1
  43. package/app/skills/mcp-builder/SKILL.md +27 -0
  44. package/app/skills/mem-search/SKILL.md +40 -0
  45. package/app/skills/migrate/SKILL.md +27 -1
  46. package/app/skills/migration-patterns/SKILL.md +26 -0
  47. package/app/skills/night-watch/SKILL.md +22 -1
  48. package/app/skills/observability-patterns/SKILL.md +26 -0
  49. package/app/skills/onboard/SKILL.md +22 -1
  50. package/app/skills/panic/SKILL.md +21 -1
  51. package/app/skills/performance-profiling/SKILL.md +34 -0
  52. package/app/skills/persona/SKILL.md +21 -4
  53. package/app/skills/plan/SKILL.md +26 -0
  54. package/app/skills/plan-writing/SKILL.md +26 -0
  55. package/app/skills/plugin-creator/SKILL.md +23 -6
  56. package/app/skills/pr/SKILL.md +24 -1
  57. package/app/skills/prd-to-issues/SKILL.md +22 -6
  58. package/app/skills/prd-to-plan/SKILL.md +22 -4
  59. package/app/skills/predict/SKILL.md +25 -0
  60. package/app/skills/qa-session/SKILL.md +23 -7
  61. package/app/skills/rag-patterns/SKILL.md +26 -0
  62. package/app/skills/refactor/SKILL.md +26 -0
  63. package/app/skills/refactor-plan/SKILL.md +23 -6
  64. package/app/skills/rollback/SKILL.md +27 -1
  65. package/app/skills/security-patterns/SKILL.md +27 -0
  66. package/app/skills/skill-audit/SKILL.md +22 -5
  67. package/app/skills/skill-creator/SKILL.md +50 -9
  68. package/app/skills/swift-patterns/SKILL.md +27 -107
  69. package/app/skills/swift-patterns/reference/frameworks.md +111 -0
  70. package/app/skills/test/SKILL.md +23 -1
  71. package/app/skills/testing-patterns/SKILL.md +26 -0
  72. package/app/skills/triage-issue/SKILL.md +22 -4
  73. package/app/skills/ubiquitous-language/SKILL.md +23 -8
  74. package/kb/procedures/release-preparation-sop.md +11 -5
  75. package/kb/procedures/release-verification-sop.md +24 -6
  76. package/llms-full.txt +56 -32
  77. package/manifest.json +1 -1
  78. package/package.json +1 -1
  79. package/scripts/evaluate_skills.py +84 -0
@@ -90,3 +90,39 @@ Auto-loaded when writing documentation, content, or user-facing text. Enforces c
90
90
  - [ ] Active voice used by default?
91
91
  - [ ] No weasel words remaining?
92
92
  - [ ] Technical claims backed by evidence or examples?
93
+
94
+ ## Example
95
+
96
+ Bad (filler, marketing, generic):
97
+
98
+ ```
99
+ In today's ever-evolving landscape of AI, our cutting-edge toolkit empowers
100
+ developers to seamlessly leverage state-of-the-art skills. Whether you're a
101
+ beginner or an expert, this comprehensive guide will help you unlock the full
102
+ potential of your workflow.
103
+ ```
104
+
105
+ Good (direct, specific, active):
106
+
107
+ ```
108
+ ai-toolkit installs 99 skills and 44 agents via `npm install -g @softspark/ai-toolkit`.
109
+ After install, run `ai-toolkit doctor` to verify symlinks and hooks. Typical
110
+ install takes under 30 seconds on a local disk.
111
+ ```
112
+
113
+ ## Rules
114
+
115
+ - **MUST** remove every phrase from the anti-trope list before publishing — the list is a hard filter, not a suggestion
116
+ - **MUST** lead with the action or outcome in the opening sentence, never with context or framing
117
+ - **NEVER** open with "In today's...", "Let's dive into...", "Whether you're...", or any variant
118
+ - **NEVER** use em dashes or en dashes in prose — they signal LLM output. Use commas, periods, or parentheses instead
119
+ - **CRITICAL**: one idea per sentence. If you write "and" linking two distinct ideas, split the sentence
120
+ - **MANDATORY**: technical claims include a concrete number, name, or example — never assert quality without evidence
121
+
122
+ ## When NOT to Load
123
+
124
+ - For code or technical specs with no user-facing prose — the voice rules do not apply
125
+ - For structured logs, CSV, or machine-readable output — formatting matters, voice does not
126
+ - For creative writing, poetry, or marketing copy where playfulness is a feature
127
+ - For **non-English** content — the anti-trope list is English-specific and would flag valid Polish/Spanish/etc. phrases
128
+ - In code comments inside functions — comments target developers; the rules above are for user-facing prose
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: briefing
3
- description: "Generate executive daily briefing across all agents"
3
+ description: "Generate an executive daily briefing that aggregates reports from all agents into a short, decision-focused summary. Use when the user asks for a status update across the whole system — not for one-agent activity reports."
4
4
  effort: medium
5
5
  disable-model-invocation: true
6
6
  agent: chief-of-staff
@@ -25,3 +25,43 @@ Triggers the Chief of Staff to generate an executive summary.
25
25
  2. **Synthesize**: Group by category (Ops, Strategy, Actions).
26
26
  3. **Filter**: Remove low-priority success logs.
27
27
  4. **Present**: Render the Daily Brief.
28
+
29
+ ## Example
30
+
31
+ ```
32
+ ## Daily Brief — 2026-04-23
33
+
34
+ ### Ops
35
+ - night-watch: 3 dep updates shipped, 1 rolled back (breaking change in `x-pkg@2.0`)
36
+ - health: all green except `mailpit` (degraded, non-critical)
37
+
38
+ ### Strategy
39
+ - predict: new PR #42 overlaps with in-flight refactor in `/src/auth`
40
+
41
+ ### Actions needed
42
+ - Review rollback from night-watch (ETA: 5 min)
43
+ - Decide on `x-pkg` pin strategy (open question on GitHub #41)
44
+ ```
45
+
46
+ ## Rules
47
+
48
+ - **MUST** stay under 200 words unless the user explicitly asks for more detail
49
+ - **MUST** lead with decision-relevant facts, not chronology — "what should I act on" before "what happened"
50
+ - **NEVER** invent agent activity — report only what the logs show; absence of logs means "no data", not "nothing happened"
51
+ - **CRITICAL**: separate Ops (what ran) from Strategy (what was decided) from Actions (what needs a human) — mixing them defeats the brief
52
+ - **MANDATORY**: when no material activity exists for a category, omit the category heading instead of writing "none"
53
+
54
+ ## Gotchas
55
+
56
+ - `kb/learnings/` often mixes drafts with completed entries. Filter by frontmatter `status: final` or by filename convention before aggregating.
57
+ - `maintenance/` branch logs from `/night-watch` use a different format (Shift Report markdown) than agent run logs. Do not concatenate blindly — parse each source separately and normalize.
58
+ - "Recent runs" without an explicit time bound defaults to **everything** on some log backends. Always pass `--since` or a date filter, or you will read a week into yesterday's memory.
59
+ - Successful runs outnumber interesting runs by an order of magnitude. Aggressively filter green/noop entries — they are the signal's noise floor.
60
+
61
+ ## When NOT to Use
62
+
63
+ - For a specific production incident — use `/workflow incident-response`
64
+ - For one-agent activity detail — read that agent's logs directly (`kb/learnings/<agent>/`)
65
+ - For planning future work — use `/plan` or `/prd-to-plan`
66
+ - For a technical system-up/down status — use `/health`
67
+ - When no agents have produced logs in the window — say so and stop; do not pad
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: build
3
- description: "Build the project with auto-detected toolchain"
3
+ description: "Build the project with auto-detected toolchain (npm, poetry, cargo, go, flutter, Docker). Use when the user asks to compile, bundle, or produce artifacts — not to run tests or deploy."
4
4
  effort: low
5
5
  disable-model-invocation: true
6
6
  argument-hint: "[target]"
@@ -95,3 +95,26 @@ After build configuration changes, update documentation:
95
95
  - [ ] Build successful
96
96
  - [ ] **README build instructions updated** (if changed)
97
97
  - [ ] **CI/CD config documented**
98
+
99
+ ## Rules
100
+
101
+ - **MUST** detect the build system automatically (`detect-build.py`) before invoking any command
102
+ - **NEVER** run a `clean` build when incremental works — clean only on explicit user request
103
+ - **CRITICAL**: surface the first build error literally, including the stack trace and file:line. Paraphrasing loses the diagnostic.
104
+ - **MANDATORY**: on success, report the artifact paths (compiled binaries, bundled output, built images) — callers downstream need them
105
+
106
+ ## Gotchas
107
+
108
+ - `npm run build` does not refresh `node_modules`. If `package-lock.json` is out of sync, the build runs against stale dependencies and "succeeds" with wrong versions. In CI always precede with `npm ci`.
109
+ - `cargo build --release` takes 5-10× longer than debug. Never use `--release` in a dev loop; reserve it for CI artifacts and benchmarks.
110
+ - `docker compose build` keys layer cache per service. A change to a shared context file (e.g., root `COPY . .`) invalidates every service's cache. Structure Dockerfiles to copy dependency manifests first, source last.
111
+ - `flutter build apk` without `--split-per-abi` produces a fat APK ~3× larger than needed. Production builds should always split unless explicitly bundling.
112
+ - `go build ./...` succeeds with a warning when a package has no Go files (e.g., pure-doc subdir). Downstream tools that expect every listed package to compile a binary fail silently — check `go build -v` for the list of built packages.
113
+
114
+ ## When NOT to Use
115
+
116
+ - For running tests — use `/test`
117
+ - For deployment or artifact push — use `/deploy`
118
+ - For scaffolding a new build system — use `/app-builder` or `/ci`
119
+ - For CI pipeline generation — use `/ci`
120
+ - When the project has no build step (interpreted code, pure docs) — this skill has nothing to do
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: chaos
3
- description: "Inject controlled faults for resilience testing"
3
+ description: "Inject controlled faults for resilience testing on non-production targets. Use when the user explicitly asks for a chaos experiment, latency injection, or dependency kill — never implicit."
4
4
  effort: medium
5
5
  disable-model-invocation: true
6
6
  argument-hint: "[target]"
@@ -30,3 +30,24 @@ Triggers a controlled resilience experiment.
30
30
  4. **Observe**: Monitor logs/metrics for 60s.
31
31
  5. **Recover**: Restore system health.
32
32
  6. **Report**: Did we survive?
33
+
34
+ ## Rules
35
+
36
+ - **MUST** verify target environment is non-production before injecting
37
+ - **NEVER** run against a system without a healthy baseline
38
+ - **CRITICAL**: abort immediately if recovery does not complete within the observation window
39
+ - **MANDATORY**: log every injected fault with timestamp and scope
40
+
41
+ ## Gotchas
42
+
43
+ - `NODE_ENV=production` on a developer's machine is common — checking that env var alone is not enough proof of non-prod. Combine with kubeconfig context, cloud account ID, or a project-specific env file check before injecting.
44
+ - `docker stats` reports cached values; the first sample immediately after injection is often pre-fault. Wait at least 5 seconds before reading metrics.
45
+ - Kubernetes liveness probes may self-heal the faulted pod inside the 60s observation window — the report shows green while the workload is still flapping. Check pod restart counters, not just health endpoints.
46
+ - Latency injected with `tc` (Linux traffic control) persists across container restarts on the host and across SIGTERM. Always pair the inject step with an explicit `tc qdisc del dev <iface> root` cleanup in the recover step — the `fork` context will not undo it for you.
47
+
48
+ ## When NOT to Use
49
+
50
+ - In production without an explicit, written runbook — use `/workflow incident-response` for real incidents
51
+ - When the system has no observability (no metrics, no logs) — fix observability first
52
+ - For load testing — use dedicated load-test tooling, not chaos injection
53
+ - During an active incident — stabilize first with `/panic`, then investigate
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ci
3
- description: "Detect and run CI pipeline with status reporting"
3
+ description: "Detect, generate, or troubleshoot CI/CD pipeline configuration for the current project type (GitHub Actions, GitLab CI). Use when the user asks to set up, update, or debug a build pipeline — not for running tests locally."
4
4
  effort: medium
5
5
  disable-model-invocation: true
6
6
  argument-hint: "[platform]"
@@ -75,3 +75,24 @@ Returns JSON with:
75
75
 
76
76
  ## Reference Skill
77
77
  Use `ci-cd-patterns` skill for pipeline templates and best practices.
78
+
79
+ ## Rules
80
+
81
+ - **MUST** detect existing CI platform before generating a new config — do not overwrite silently
82
+ - **NEVER** commit generated CI configs that embed hardcoded secrets or tokens
83
+ - **CRITICAL**: preserve existing job names and triggers unless the user explicitly asks for a restructure
84
+ - **MANDATORY**: every generated pipeline must include lint + test stages at minimum
85
+
86
+ ## Gotchas
87
+
88
+ - GitHub Actions YAML parses `on:` as a reserved word only when unquoted. Writing `"on":` (quoted) produces a valid-looking file whose workflow **never triggers**. YAML anchors in this field also silently break.
89
+ - GitLab CI's `rules:` and `only:/except:` are mutually exclusive at the job level. Mixing them fails parse on pipeline run but not at `git push` time — test with `gitlab-ci-lint` before committing.
90
+ - `secrets.*` in GitHub Actions is undefined in workflows triggered from **forked** PRs (security boundary). Jobs that need secrets must gate on `github.event.pull_request.head.repo.full_name == github.repository` or use `pull_request_target` carefully.
91
+ - `actions/checkout@v4` defaults to `fetch-depth: 1` (shallow). Commands that need history (`git log`, `git describe`, conventional-commit tools) fail with misleading errors — set `fetch-depth: 0` for those jobs.
92
+
93
+ ## When NOT to Use
94
+
95
+ - For running tests locally — use `/test`
96
+ - For general CI/CD patterns and theory — use `/ci-cd-patterns` (knowledge skill)
97
+ - For deployment orchestration only — use `/deploy`
98
+ - When the project has no VCS-hosted CI platform — generate locally-runnable scripts instead
@@ -308,3 +308,28 @@ env:
308
308
  - Manual deployments to production
309
309
  - No rollback strategy
310
310
  - Skipping linting/type-checking in CI
311
+
312
+ ## Rules
313
+
314
+ - **MUST** include lint, test, and build stages in every pipeline — deploy-only pipelines defer failure to production
315
+ - **MUST** cache dependencies by lockfile hash, not by branch name — branch keys grow unbounded and leak cache across unrelated work
316
+ - **NEVER** commit secrets to the pipeline config — use the platform's secret store and reference by name
317
+ - **NEVER** echo secrets to job logs; GitHub Actions masks known secrets only if they came from `secrets.*`, not from arbitrary env vars
318
+ - **CRITICAL**: every deployment path has a defined rollback — "we'll figure it out" is not a plan and will cost hours during an incident
319
+ - **MANDATORY**: PR builds run the same checks as `main` builds; drift between the two hides failures until merge
320
+
321
+ ## Gotchas
322
+
323
+ - GitHub Actions masks secret values sourced from `${{ secrets.X }}` only. Secrets routed through `env:` and then transformed (base64, JSON) lose the mask and appear in logs verbatim.
324
+ - Workflows triggered by `pull_request` from forks run **without** repository secrets by default (security). Jobs that need secrets either gate on `github.event.pull_request.head.repo.full_name == github.repository` or use `pull_request_target` with explicit code-review — the latter is easy to get wrong and allow token theft.
325
+ - `actions/cache` restore is best-effort — a cache miss is silent. Jobs that rely on the cache (e.g., skipping tests when nothing changed) must verify cache hits explicitly via the `cache-hit` output.
326
+ - GitLab CI's `rules:` and `only:/except:` are mutually exclusive at the job level. Mixing parses only at pipeline run, not at `git push`.
327
+ - Semantic-release assumes a linear history. Merge commits on `main` confuse the commit parser and produce no release — stick to squash merges if you rely on it.
328
+
329
+ ## When NOT to Load
330
+
331
+ - For **generating** a pipeline file for the current project — use `/ci` (this skill is knowledge, not code)
332
+ - For one-off deployment commands — use `/deploy`
333
+ - For language-specific build toolchain nuances — pair with `/typescript-patterns`, `/python` rules, etc.
334
+ - For observability or alerting around deploys — use `/observability-patterns`
335
+ - For security scanning (SAST, SCA) steps in pipelines — use `/security-patterns` and `/cve-scan`
@@ -49,12 +49,15 @@ model: sonnet
49
49
  - Prefer numbered phases for multi-step workflows
50
50
  - List required checks explicitly (`lint`, `tests`, `docs`, etc.)
51
51
  - Avoid hidden assumptions about project structure unless the command is project-specific
52
+ - **Description ≥50 chars** with a trigger hint (`Use when…`) — short descriptions cause adjacent commands to fight for the same query
53
+ - Include **hard rules** (MUST / NEVER / CRITICAL) so the agent cannot improvise around safety boundaries
54
+ - Include **"When NOT to use"** naming 2-3 adjacent commands, to prevent over-triggering
52
55
 
53
56
  ## Minimal Template
54
57
 
55
58
  ```markdown
56
59
  ---
57
- description: "{one-line description}"
60
+ description: "{Third-person description, min 50 chars, with trigger hint like 'Use when...'}"
58
61
  argument-hint: "[arguments]"
59
62
  allowed-tools: Read, Grep, Bash
60
63
  ---
@@ -70,12 +73,38 @@ Perform the requested task using this workflow:
70
73
  3. Execute the task using the smallest safe set of changes.
71
74
  4. Validate the result.
72
75
  5. Summarize outcome and follow-up actions.
76
+
77
+ ## Example
78
+
79
+ \`\`\`
80
+ /{command} example-argument
81
+ \`\`\`
82
+
83
+ ## Rules
84
+
85
+ - **MUST** {non-negotiable rule}
86
+ - **NEVER** {forbidden action}
87
+
88
+ ## Gotchas
89
+
90
+ - {environment-specific trap — only if the command has one; omit the section otherwise}
91
+
92
+ ## When NOT to Use
93
+
94
+ - For {adjacent use case} -- use `/{other-command}` instead
95
+ - If {precondition} is not met
73
96
  ```
74
97
 
98
+ Follow [Anthropic's Gotchas guidance](https://agentskills.io/skill-creation/best-practices.md#gotchas-sections): *"concrete corrections to mistakes the agent will make without being told otherwise"* — not general advice. Omit the section when no domain traps exist.
99
+
75
100
  ## Validation Checklist
76
101
 
77
102
  - [ ] Command file uses markdown and valid YAML frontmatter
78
- - [ ] Help text is concise and searchable
103
+ - [ ] Description ≥50 chars, third-person, with trigger hint
104
+ - [ ] At least one concrete code-fenced example
105
+ - [ ] `## Rules` with MUST / NEVER / CRITICAL (prescriptive)
106
+ - [ ] `## Gotchas` when the command has real environment-specific traps (optional)
107
+ - [ ] `## When NOT to Use` section naming 2-3 adjacent commands
79
108
  - [ ] Body is instruction-oriented, not user-facing prose
80
109
  - [ ] `$ARGUMENTS` is present when arguments are expected
81
110
  - [ ] Validation steps are explicit
@@ -139,3 +139,28 @@ Build a golden set of ~500 examples per category with ground truth. Track:
139
139
  - `prompt-caching-patterns` — cache the policy doc
140
140
  - `model-routing-patterns` — when to escalate from Haiku to Sonnet
141
141
  - Anthropic docs: https://docs.claude.com/en/docs/about-claude/use-case-guides/content-moderation
142
+
143
+ ## Rules
144
+
145
+ - **MUST** pre-filter the obvious cases (regex, deny-lists, length caps) before sending to an LLM — LLM moderation on a 500MB comment is unusable
146
+ - **MUST** return a structured JSON classification (category, confidence, reason), not a prose verdict — prose breaks audit trails
147
+ - **NEVER** ship a moderation pipeline without a human-in-the-loop escalation path for ambiguous cases
148
+ - **NEVER** hide the policy in the user message; the policy belongs in the cached system prompt so it is versioned and auditable
149
+ - **CRITICAL**: log every decision (input, category, confidence, model, policy version, timestamp) — moderation without an audit trail cannot be improved or appealed
150
+ - **MANDATORY**: calibrate confidence thresholds per category; harassment FP is cheap, clean-content FP is expensive
151
+
152
+ ## Gotchas
153
+
154
+ - False positives on clean content are **much more expensive** than false negatives on borderline content, in user-trust terms. Optimize for recall on hard-fail categories (CSAM, doxing) but precision on soft-fail categories (spam, rudeness).
155
+ - Haiku is sufficient for most moderation classification; using Opus inflates cost 10× with no measurable accuracy gain on this task. Reach for Opus only for edge cases that Haiku consistently misclassifies.
156
+ - Prompt caching on the policy doc only hits when the cache window is still warm (5 minutes). Bursty traffic with long quiet periods loses the cache every window — amortize by keeping a heartbeat call.
157
+ - Structured JSON output via tool-use is more reliable than free-form JSON in the response — parse errors happen ~1-3% of the time with free-form, near zero with tool-use schemas.
158
+ - The golden test set drifts. Policy changes, new attack patterns, and new product surfaces all invalidate old examples. Refresh quarterly or after any policy update.
159
+
160
+ ## When NOT to Load
161
+
162
+ - For **structured JSON output** design in general — use `/json-mode-patterns`
163
+ - For **security** input validation (SQLi, XSS) — use `/security-patterns`
164
+ - For caching the policy doc mechanics — use `/prompt-caching-patterns`
165
+ - For picking the model tier (Haiku vs Sonnet vs Opus) — use `/model-routing-patterns`
166
+ - For moderation of voice/audio content — this skill covers text; audio adds a transcription failure mode not covered here
@@ -306,3 +306,28 @@ client.create_payload_index(
306
306
  | "NoSQL is faster" | NoSQL trades consistency for speed — if you need joins, use a relational DB |
307
307
  | "We don't need migrations, we'll update the schema directly" | Direct schema changes are irreversible and untestable — migrations are the safety net |
308
308
  | "One big table is simpler" | Denormalization without measurement creates update anomalies — normalize first, denormalize with data |
309
+
310
+ ## Rules
311
+
312
+ - **MUST** profile queries with `EXPLAIN (ANALYZE, BUFFERS)` before adding an index — indexes chosen by intuition miss the real hot path half the time
313
+ - **MUST** design the schema around the dominant access pattern, not the logical entity graph — storage follows queries, not the other way round
314
+ - **NEVER** write to production with raw SQL when a migration file fits — ad-hoc changes break rollback and audit
315
+ - **NEVER** add a `SELECT *` in a loop — N+1 is the most common performance regression in code review
316
+ - **CRITICAL**: every foreign key has an index on the referencing column. Postgres does not create one automatically, and `ON DELETE CASCADE` without the index causes full-table scans on delete.
317
+ - **MANDATORY**: numeric IDs use `bigint` (or `bigserial`) in new tables unless there is a stated reason to cap at 2^31. Integer overflow on a growing table is a late, painful surprise.
318
+
319
+ ## Gotchas
320
+
321
+ - `EXPLAIN` without `ANALYZE` shows the planner's estimate, not the actual execution. A query plan that "looks good" with `EXPLAIN` can still be slow in practice — always use `ANALYZE` for real diagnosis.
322
+ - ORM-generated queries often look efficient in one row but emit N+1 at scale. `prisma`, `sequelize`, `activerecord` all have "eager loading" switches that must be explicit — the default is lazy and bites under load.
323
+ - Postgres transactions hold **row locks** until commit or rollback. A long-running transaction that reads rows another writer needs blocks progress silently. Investigate `pg_stat_activity` for `state=idle in transaction` when writes stall.
324
+ - Index-only scans require both the query columns AND the filter to be in the index (or in the visibility map for heap tuples). Adding a single column to `WHERE` can demote an index-only scan to an index scan with a 10× slowdown.
325
+ - MySQL implicit collation on JOIN across tables with different `utf8mb4` collations forces a row-by-row collation conversion — a 100× slowdown that shows as a full scan in the plan. Align collations during schema design.
326
+
327
+ ## When NOT to Load
328
+
329
+ - For **schema evolution** (zero-downtime, expand-contract, backfill) — use `/migration-patterns`
330
+ - For running migrations as a task — use `/migrate`
331
+ - For query-plan profiling and the four golden signals — use `/performance-profiling`
332
+ - For vector/embedding-specific schema — this skill covers the mechanics; use `/rag-patterns` for retrieval design
333
+ - For observability of DB metrics (slow query log, connection pool saturation) — use `/observability-patterns`
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: debug
3
- description: "Debug errors and trace root causes systematically"
3
+ description: "Debug errors and trace root causes systematically using logs, health checks, and hypothesis-driven investigation. Use when a bug or error message is in hand — not for architectural questions or when there is no reproducible symptom."
4
4
  user-invocable: true
5
5
  effort: medium
6
6
  argument-hint: "[symptom]"
@@ -163,6 +163,28 @@ Report consensus when done.
163
163
  - [ ] Formed hypothesis
164
164
  - [ ] Tested fix
165
165
 
166
+ ## Rules
167
+
168
+ - **MUST** form a testable hypothesis before changing code
169
+ - **NEVER** apply fixes without first reproducing the symptom
170
+ - **CRITICAL**: trace from symptom to root cause — do not stop at the first plausible explanation
171
+ - **MANDATORY**: if the bug is intermittent, log enough state to reproduce it deterministically before fixing
172
+
173
+ ## Gotchas
174
+
175
+ - `docker compose logs` with no `--since` shows logs from **the current container lifecycle plus anything buffered**. After a restart you may read stale logs that look like the current error. Always filter: `docker compose logs --since 5m`.
176
+ - `tail -f` stops emitting after a log rotation unless you pass `-F` (GNU) or `--follow=name` — the file descriptor points at the renamed inode. On rotated logs, always use `-F`.
177
+ - `curl -f <url>` exits non-zero on 4xx/5xx but discards the response body — you lose the exact error. Debug with `curl -s -o /tmp/body -w 'HTTP %{http_code}\n'` and then inspect `/tmp/body`.
178
+ - Stack traces from uvicorn/gunicorn/WSGI show framework frames first; the first few frames are almost always irrelevant. Scroll past framework internals and find the first frame inside your own package.
179
+ - A 500 with "Internal Server Error" and no body usually means the error happened before the logger was initialized — check service start-up logs, not request logs.
180
+
181
+ ## When NOT to Use
182
+
183
+ - For triaging an unreported bug without a known symptom — use `/triage-issue` instead
184
+ - For writing a fix once the cause is already known — use `/fix`
185
+ - For performance-specific investigation — use `/performance-profiling` or `/analyze --type=complexity`
186
+ - For a live production incident — use `/workflow incident-response` (coordinated response)
187
+
166
188
  ## Related Skills
167
189
  - Bug fixed? → `/review` to verify the fix quality
168
190
  - Need a regression test? → `/tdd` to write it test-first
@@ -256,3 +256,28 @@ Deliberate actions stay slow (2s linear for hold-to-delete), system responses sn
256
256
  - Same duration for enter and exit — exits should be faster
257
257
  - Hover effects without `@media (hover: hover)` — breaks touch devices
258
258
  - Framer Motion shorthands under load — drops frames on main thread
259
+
260
+ ## Rules
261
+
262
+ - **MUST** specify exact properties in `transition` (`transition: transform 200ms ease-out`) — never `transition: all`
263
+ - **MUST** use `ease-out` (or a custom curve) on UI appearances; `ease-in` delays feedback at the moment the user's attention peaks
264
+ - **NEVER** animate `height`, `width`, `margin`, or `top/left` — animate `transform` and `opacity` only. Layout-triggering properties drop frames under load.
265
+ - **NEVER** add motion for decorative reasons alone — every animation must serve meaning (status change, spatial relationship, progress)
266
+ - **CRITICAL**: exit is faster than enter. A 2s linear enter (hold-to-delete) needs a 200ms ease-out exit. Symmetrical durations feel sluggish.
267
+ - **MANDATORY**: any animation longer than 300ms for UI feedback needs an explicit justification — the user perceives >300ms as "laggy", not "smooth"
268
+
269
+ ## Gotchas
270
+
271
+ - `transform: translateX(-50%)` on an element that will animate `opacity` triggers a paint on every frame because the browser cannot composite the layer. Add `will-change: transform, opacity` to hint the compositor — but only during the animation, not permanently (it consumes GPU memory).
272
+ - Framer Motion's `x={100}` prop is a shortcut for `transform: translateX(100px)`, but under load it falls back to the main thread. Use the longhand `style={{ transform: "translateX(100px)" }}` for guaranteed compositor path.
273
+ - `@media (prefers-reduced-motion: reduce)` is widely supported but often forgotten. Users with vestibular disorders or pointer-device sensitivity will notice; include a reduced-motion override for every non-trivial animation.
274
+ - Chrome's Performance tab samples animations, but the sampling rate is 1kHz — sub-millisecond jank is invisible. For micro-animations, prefer `performance.mark` and `measure` with explicit timestamps.
275
+ - CSS keyframe animations re-trigger on every class toggle. On rapidly-updating state (drag, hover), transitions are cheaper and smoother; keyframes are for one-shot entries/exits.
276
+
277
+ ## When NOT to Load
278
+
279
+ - For **accessibility** beyond motion (contrast, focus, ARIA) — use `/a11y-validate`
280
+ - For component-library architecture (Radix, Headless UI, ShadCN) — use `/frontend-specialist` agent
281
+ - For **information architecture** and user flows — use `/ux-designer` agent
282
+ - For generic CSS patterns without motion — this skill is motion-specific
283
+ - For **brand voice** / content tone — use `/brand-voice`
@@ -302,3 +302,29 @@ HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
302
302
  - [ ] Resource limits defined
303
303
  - [ ] Health checks configured
304
304
  - [ ] Logs to stdout/stderr
305
+
306
+ ## Rules
307
+
308
+ - **MUST** use multi-stage builds for any production image — shipping build tools in the final layer is wasteful and insecure
309
+ - **MUST** pin base images by digest (`@sha256:...`), not just by tag — tags are mutable and reproducibility collapses on every `latest` update
310
+ - **NEVER** run a container as `root` in production — `USER appuser` with a non-zero UID is the default, not an optimization
311
+ - **NEVER** `COPY . .` before the dependency manifest — layer cache becomes useless and every source change re-downloads packages
312
+ - **CRITICAL**: logs go to stdout/stderr. Containers writing to log files require volumes, lose on crash, and break 12-factor assumptions.
313
+ - **MANDATORY**: every Dockerfile has a `HEALTHCHECK`, every compose service has `restart: unless-stopped` (or `always` in production)
314
+
315
+ ## Gotchas
316
+
317
+ - `alpine` uses `musl` libc, not `glibc`. Python wheels compiled for glibc fail to install on alpine — use `python:3.12-slim` (glibc-based, small) instead of `python:3.12-alpine` unless you know every dependency ships a musl wheel.
318
+ - `docker compose build` caches layers per service. A change to a shared file (e.g., root `COPY . .` used by two services) invalidates both caches. Structure Dockerfiles to copy manifests first, source last.
319
+ - `HEALTHCHECK` in a Dockerfile is only respected by Docker and Compose, **not by Kubernetes**. K8s uses its own `livenessProbe` / `readinessProbe`. Maintaining both costs duplicate logic.
320
+ - `docker compose up -d` streams build output only to the terminal, not to a build log. CI that captures `docker compose up -d` silently misses build errors — use `docker compose build` as a separate step with log redirection.
321
+ - Container time is host time unless you mount `/etc/localtime` — a container running on a UTC host is UTC regardless of its `TZ` env var for anything reading `/etc/localtime`. For Python `datetime.now(timezone.utc)` is safer than `datetime.now()` inside containers.
322
+ - `volumes: ./data:/app/data` on macOS with VirtioFS mounts with inverted ownership (host UID vs container UID). Containers that chmod/chown the volume fail silently in dev, succeed in Linux CI.
323
+
324
+ ## When NOT to Load
325
+
326
+ - For **CI/CD pipeline** design that uses Docker — use `/ci-cd-patterns`
327
+ - For generating a project-specific Dockerfile — use `/app-builder`
328
+ - For Kubernetes-specific manifests beyond Docker — this skill covers compose + basics; use `/devops-implementer` agent for k8s depth
329
+ - For **observability** of containers (metrics, logs, traces) — use `/observability-patterns`
330
+ - For **secret management** at runtime — use `/security-patterns`
@@ -208,3 +208,29 @@ Product → Indexer → Search Index (Elasticsearch/OpenSearch)
208
208
  - [ ] Enable flat tables
209
209
  - [ ] Configure CDN
210
210
  - [ ] Index optimization
211
+
212
+ ## Rules
213
+
214
+ - **MUST** model order lifecycle as an explicit state machine (pending → authorized → captured → fulfilled → refunded) — ad-hoc booleans produce inconsistent states on retry
215
+ - **MUST** separate payment capture from inventory decrement — reserve stock on order placement, commit stock on payment success. Coupling them causes stuck-stock bugs during payment retries.
216
+ - **NEVER** store CVV, full PAN, or track data — ever. PCI scope expands to any system that sees them, even "temporarily in memory".
217
+ - **NEVER** use floating-point for money calculations. Use `decimal.Decimal`, `BigDecimal`, or integer minor units (cents). Float rounding produces $0.01 discrepancies that accumulate into angry customer emails.
218
+ - **CRITICAL**: every cart mutation is idempotent via an `Idempotency-Key` or natural key — users double-click checkout buttons, networks retry, and duplicate orders are expensive to reconcile.
219
+ - **MANDATORY**: tax and shipping calculations live in isolated services or modules. Inlining them into cart logic prevents caching and creates compliance drift.
220
+
221
+ ## Gotchas
222
+
223
+ - Promotion codes with stackable rules explode combinatorially — "20% off + free shipping + first-time buyer" can produce negative totals if the ordering of applications is not defined. Always normalize to a pipeline with a fixed evaluation order.
224
+ - Tax jurisdictions change **after** the order is placed (shipping address edits). A cart that recalculates on every update but not on address change silently under-collects tax.
225
+ - Inventory reservations must expire — otherwise abandoned carts hold stock forever. 15-30 minutes is typical; longer reservations need explicit business approval.
226
+ - Currency rounding rules differ by locale. Japanese Yen has 0 decimal places, Kuwaiti Dinar has 3. Defaulting to 2 decimals produces off-by-one-unit bugs in non-USD markets.
227
+ - Refunds are **not** negative orders. Payment processors treat them as separate resources with their own state machine and timing (Stripe refunds can take 5-10 business days to settle). Model accordingly.
228
+ - Magento's flat-table option speeds reads but silently stops auto-syncing if a reindex fails — stale product data in production. Monitor reindex job success, not just page latency.
229
+
230
+ ## When NOT to Load
231
+
232
+ - For **payment provider** protocol specifics (Stripe, Adyen, PayPal) — use the provider's SDK docs; this skill is pattern-level
233
+ - For generic API design — use `/api-patterns`
234
+ - For database schema of orders/inventory — use `/database-patterns`
235
+ - For promotions and segmentation at scale — use `/data-analyst` agent
236
+ - For PCI compliance audit — this skill flags the traps but is not a substitute for a QSA audit
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: evaluate
3
- description: "Evaluate skill quality and RAG retrieval accuracy"
3
+ description: "Evaluate RAG retrieval accuracy and LLM-as-a-judge quality metrics (faithfulness, relevancy, context precision) against a golden dataset. Use when the user asks to measure RAG quality or detect knowledge gaps — not for evaluating generic LLM outputs."
4
4
  effort: medium
5
5
  disable-model-invocation: true
6
6
  argument-hint: "[--threshold N]"
@@ -130,3 +130,24 @@ Knowledge Gaps Detected:
130
130
  - [ ] Relevancy >70%
131
131
  - [ ] Context Precision >60%
132
132
  - [ ] No critical knowledge gaps
133
+
134
+ ## Rules
135
+
136
+ - **MUST** use a golden dataset — never evaluate on synthetic queries only
137
+ - **NEVER** report a score without listing the failed queries alongside it
138
+ - **CRITICAL**: if the golden dataset is missing, stop and ask the user to provide one
139
+ - **MANDATORY**: thresholds come from project config, not hardcoded defaults, when available
140
+
141
+ ## Gotchas
142
+
143
+ - LLM-as-a-judge scores are **non-deterministic**; a single run fluctuates by ±10 points even with `temperature=0`. Always report the average and stddev over ≥3 runs, not a one-shot number.
144
+ - The default threshold trio (0.7 / 0.7 / 0.6) was calibrated on English KBs. Multilingual corpora (Polish + English in the same index) score systematically 5-15 points lower — recalibrate per language, or split the golden dataset by language.
145
+ - Golden datasets **drift**: when the KB is reindexed or documents are renamed, `expected_sources` may point at moved or deleted paths. A sudden drop in `context_precision` across unrelated queries usually means dataset rot, not RAG regression — validate the dataset paths first.
146
+ - Judges often reward verbose answers as "more faithful" because there is more text to ground. Tune the judge prompt to penalize padding, or cap answer length in the generator before evaluation.
147
+
148
+ ## When NOT to Use
149
+
150
+ - For auditing skill quality (the 5-criteria check) — that lives in `scripts/evaluate_skills.py`
151
+ - For general-purpose LLM output scoring without a KB — use `/review` or a tailored prompt
152
+ - For unit tests or code correctness — use `/test`
153
+ - For continuous evaluation without a golden dataset — build the dataset first
@@ -65,3 +65,28 @@ Create a summary documenting what evolved:
65
65
  - `app/agents/[name].md`: [what changed and why]
66
66
  - **Validation**: passed / failed
67
67
  ```
68
+
69
+ ## Rules
70
+
71
+ - **MUST** delegate file edits to the `meta-architect` agent — this command is the trigger, the agent owns the changes
72
+ - **MUST** have a concrete failure signal (recurring error, named incident, repeated correction) before evolving — do not mutate based on vibes
73
+ - **NEVER** evolve an agent based on a **single** failure instance — evolution is pattern-matching, not reaction
74
+ - **NEVER** touch `.claude/agents/*` files directly from this skill; `meta-architect` is the only agent with that authority
75
+ - **CRITICAL**: every evolution names the trigger, the change, and the expected measurable shift (e.g., "reduces false routing of `/debug` to `/fix`")
76
+ - **MANDATORY**: run `scripts/validate.py --strict` after every applied change; roll back if the score drops
77
+
78
+ ## Gotchas
79
+
80
+ - Small changes to an agent's description can silently re-route a dozen adjacent queries. After an evolution, run the skill router against a saved set of representative queries to confirm no drift.
81
+ - `kb/learnings/` entries without a `status: final` frontmatter field are often drafts — aggregating them treats speculative observations as validated patterns. Filter by status before mining.
82
+ - "Last-failure" often points at the **symptom**, not the root cause. A route-to-wrong-agent failure may actually be a description-field ambiguity; fix the description, not the router.
83
+ - Changes to agent frontmatter fields (`tools`, `model`) propagate to the installed global config only after `ai-toolkit update`. A locally-evolved agent still runs old behavior until the user reinstalls.
84
+ - Evolution in isolation invites regression. Keep a changelog (`kb/learnings/` entries or `CHANGELOG.md`) so future sessions can see what was tried and reverted.
85
+
86
+ ## When NOT to Use
87
+
88
+ - For a specific, known agent edit — call `meta-architect` directly
89
+ - For fixing a failing test — use `/fix` or `/debug`
90
+ - For auditing **current** skill/agent quality — use `scripts/evaluate_skills.py` and `scripts/audit_skills.py --ci`
91
+ - For creating a **new** agent — use `/agent-creator`
92
+ - When no recurring pattern exists (single data point) — wait and observe; do not over-fit to noise
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: explain
3
- description: "Explain code, architecture, or concepts with diagrams"
3
+ description: "Explain code, architecture, or concepts with Mermaid diagrams and sequence flows. Use when the user asks 'what does X do' or 'how does Y work' — not to critique code quality or implement changes."
4
4
  user-invocable: true
5
5
  effort: medium
6
6
  argument-hint: "[file or module path]"
@@ -52,3 +52,28 @@ Run the bundled script to extract imports and generate a Mermaid diagram:
52
52
  ```bash
53
53
  python3 ${CLAUDE_SKILL_DIR}/scripts/dependency-graph.py src/auth.py
54
54
  ```
55
+
56
+ ## Rules
57
+
58
+ - **MUST** start from what the user already knows — if it is unclear, ask one question before explaining
59
+ - **MUST** ground the explanation in the actual code (file:line references), not in generic framework theory
60
+ - **NEVER** use an analogy when a direct definition is clearer — analogies add a translation step for the reader
61
+ - **NEVER** produce a diagram that the text does not already justify — diagrams illustrate, they do not replace the explanation
62
+ - **CRITICAL**: when the code base is large, scope the explanation to one entry point plus its immediate collaborators. Explaining "the whole system" in one pass fails for any non-trivial project.
63
+ - **MANDATORY**: if the user asks for a short answer, give a one-paragraph summary without diagrams — not every request needs a Mermaid graph
64
+
65
+ ## Gotchas
66
+
67
+ - Mermaid renders differently across GitHub, VS Code preview, and static generators. Features added post-2023 (e.g., class diagram relations, `accTitle`) may render as raw text on older renderers. Stick to the basic subset unless you know the target.
68
+ - `dependency-graph.py` parses imports statically; dynamic imports (`__import__`, `importlib.import_module`, JavaScript `await import()`) are invisible. Note explicitly when the generated graph is likely incomplete.
69
+ - Sequence diagrams have no notion of async vs sync. Two parallel calls render as sequential; distinguish with a `par` block or a note.
70
+ - Architectural explanations that name "the service layer" or "the controller" leak framework jargon. If the project does not use those terms, use the project's own names — otherwise the reader is translating twice.
71
+ - Long Mermaid graphs wrap awkwardly on narrow screens. For >20 nodes, split into a high-level graph and drill-down graphs rather than one giant diagram.
72
+
73
+ ## When NOT to Use
74
+
75
+ - To critique or improve the code — use `/review` or `/refactor`
76
+ - To find a specific function across the codebase — use `/search` or `/explore`
77
+ - To write the documentation that the explanation turns into — use `/docs`
78
+ - For a full architecture audit or redesign — use `/architecture-audit`
79
+ - When the user asks "why is this broken" — use `/debug`, not `/explain`
@@ -110,3 +110,28 @@ This generates `codebase-map.html` with collapsible directories, file sizes, and
110
110
  smart_query("codebase analysis: {technology}")
111
111
  hybrid_search_kb("project structure {framework}")
112
112
  ```
113
+
114
+ ## Rules
115
+
116
+ - **MUST** use `Glob` and `Grep` before `Read` — scan for shape before opening files
117
+ - **MUST** deliver a map of the codebase (entry points, layers, module boundaries), not a file listing — a tree without interpretation is noise
118
+ - **NEVER** read every file sequentially; target reads via grep patterns and filename globs
119
+ - **NEVER** modify any file — this is a read-only skill
120
+ - **CRITICAL**: when the repo contains generated code (`node_modules`, `vendor/`, `dist/`, `build/`), exclude it from scans or the signal drowns in generated noise
121
+ - **MANDATORY**: summarize the stack once at the top (language, framework, package manager, test runner) before diving into structure
122
+
123
+ ## Gotchas
124
+
125
+ - `find .` and `ls -R` ignore `.gitignore` by default and include `node_modules`, `vendor/`, `.venv/`, `target/`. Use `git ls-files` or `fd` / `rg` for a git-aware listing, or explicitly prune.
126
+ - `package.json` says `"type": "module"` → ESM; absence → CommonJS. Mixing them without noticing produces "Cannot use import statement outside a module" errors later; call out the setting in the report.
127
+ - Frameworks with file-based routing (Next.js, Nuxt, SvelteKit) treat the `app/` or `pages/` tree as the router. A directory listing alone does not reveal routes — the framework convention does. Name the framework first, then the routes.
128
+ - `pyproject.toml` can declare multiple project layouts (src/, flat, namespace packages). "Where is the main code" is not obvious without reading `[tool.setuptools.packages]` or `[tool.poetry.packages]`.
129
+ - Large monorepos use workspaces (`pnpm-workspace.yaml`, `nx.json`, `turbo.json`) with apps and packages. Treating the root as the project conceals the actual component boundaries — surface the workspace topology first.
130
+
131
+ ## When NOT to Use
132
+
133
+ - To explain a specific module's design — use `/explain`
134
+ - To find a specific identifier or symbol — use `Grep` directly or `/search`
135
+ - To audit architecture for deepening candidates — use `/architecture-audit`
136
+ - To scaffold a new project — use `/app-builder`
137
+ - When the user already knows the codebase — skip the overview and jump to the concrete task