|
| 1 | +# Skills Architecture |
| 2 | + |
| 3 | +This document maps all skills, their purpose, activation triggers, and relationships. |
| 4 | + |
| 5 | +## Skills Overview |
| 6 | + |
| 7 | +### Core Verification & Review (always available) |
| 8 | + |
| 9 | +**`verification-loop`** — Unified verification engine covering 7 phases: environment check, type check, lint, tests, code review, security scan, pre-push checks. Invoked by `/verify`, `/quality-gate`, and code-review commands. Core skill powering the entire QA workflow. |
| 10 | + |
| 11 | +**`refactoring-patterns`** — Measurement-driven refactoring (profile → refactor → measure). Activates when user says "refactor", "clean up", "simplify", or when code has high complexity. Ensures changes improve metrics, not just code appearance. |
| 12 | + |
| 13 | +**`update-docs`** — Detects stale documentation after code changes by matching diff against in-repo docs. Finds and updates prose that contradicts new code. Auto-activates when implementing features/fixes that rename, remove, or add APIs. |
| 14 | + |
| 15 | +**`security-check`** — Scans for credential leaks, secrets in code, insecure patterns, LLM API key exposure, PII leakage to external services, and `.env/.gitignore` misconfigurations. Runs automatically before commits and when editing credential-related code. |
| 16 | + |
| 17 | +### Python Development (language-specific) |
| 18 | + |
| 19 | +**`python-patterns`** — Unified conventions for team Python development: |
| 20 | +- **Credentials:** dotenv loading, fail-fast on missing secrets, `.env.example` patterns |
| 21 | +- **API clients:** timeouts (30s), transient retry logic, response validation, LLM response parsing |
| 22 | +- **Testing:** TDD workflow, mock external APIs, set `random_state=42`, 80%+ coverage |
| 23 | +- **Pipelines:** standard stage structure, JSON metadata, validation-before-processing, fail-fast, checkpointing |
| 24 | + |
| 25 | +Replaces separate `python-conventions` and `data-pipeline-patterns` skills (merged for clarity). |
| 26 | + |
| 27 | +### Design & Workflow |
| 28 | + |
| 29 | +**`brainstorming`** — Design exploration before implementation. Activates when user asks "design", "how should i build", "what's the approach", "plan this out". Proposes 2-3 approaches with trade-offs, gets approval before coding. |
| 30 | + |
| 31 | +**`cost-speed-meter`** — Tracks command execution times (tests, builds, lint) across sessions. Shows trends, detects regressions, suggests fast-path alternatives (unit tests vs integration). Measures if optimizations actually worked. |
| 32 | + |
| 33 | +## Skill Activation Model |
| 34 | + |
| 35 | +| Skill | Activation Type | Trigger | |
| 36 | +|-------|-----------------|---------| |
| 37 | +| `verification-loop` | Command-invoked | `/verify`, `/quality-gate`, code-review commands | |
| 38 | +| `refactoring-patterns` | Declarative | User says "refactor", "simplify", "clean up", or high complexity detected | |
| 39 | +| `update-docs` | Declarative | Code changes APIs/configs/CLI flags; user asks "update docs" | |
| 40 | +| `security-check` | Declarative | Editing credential/secret handling code; before commits | |
| 41 | +| `python-patterns` | Declarative | Editing Python code files (any `.py` file in context) | |
| 42 | +| `brainstorming` | Declarative | User explicitly asks for design, planning, or approach exploration | |
| 43 | +| `cost-speed-meter` | Automatic | Tracks all bash command execution; invoked via `/metrics` or `/metrics-report` | |
| 44 | + |
| 45 | +## Command Dependencies |
| 46 | + |
| 47 | +Commands that rely on specific skills: |
| 48 | + |
| 49 | +| Command | Requires | Notes | |
| 50 | +|---------|----------|-------| |
| 51 | +| `/verify` | `verification-loop` | Runs phases 1-4: environment, types, lint, tests | |
| 52 | +| `/quality-gate` | `verification-loop` | Runs phases 1-4 + phase 6: plus pre-push security | |
| 53 | +| `/refactor-safe` | `verification-loop`, `refactoring-patterns` | Verify code works before refactoring, then measure | |
| 54 | +| `/test-coverage` | `verification-loop` | Part of verification loop; finds untested code | |
| 55 | +| `/update-docs` | `update-docs` | Standalone; detects stale docs from code changes | |
| 56 | +| `/diff-explain` | None | Standalone; explains diffs by intent | |
| 57 | +| `/explain-code` | None | Standalone; layered explanation by complexity | |
| 58 | +| `/prompt-test` | None | Standalone; tests LLM prompts against samples | |
| 59 | +| `/ai-engineer-review` | None | Standalone; architectural review | |
| 60 | +| `/changelog` | None | Standalone; generates changelog from commits | |
| 61 | +| `/dep-check` | None | Standalone; audits dependencies | |
| 62 | +| `/env-check` | None | Standalone; validates local dev environment | |
| 63 | + |
| 64 | +## Removed Skills |
| 65 | + |
| 66 | +**`redhat-writing`** — Deleted. This was user-specific (Red Hat brand voice/style). Does not belong in a generic meta-repo that others clone. Users who need it should add their own CLAUDE.md instructions locally. |
| 67 | + |
| 68 | +**`python-conventions` (merged)** — Consolidated into `python-patterns` with `data-pipeline-patterns`. Both covered Python team conventions; one unified skill is clearer. |
| 69 | + |
| 70 | +**`data-pipeline-patterns` (merged)** — Consolidated into `python-patterns`. Pipeline structure is a specific application of Python conventions, not separate. |
| 71 | + |
| 72 | +## Token Budget |
| 73 | + |
| 74 | +Always-loaded skills (loaded once per session): |
| 75 | +- `verification-loop` — ~3KB (core engine) |
| 76 | +- `refactoring-patterns` — ~2KB |
| 77 | +- `security-check` — ~2KB |
| 78 | +- `python-patterns` — ~4KB (credentials, APIs, testing, pipelines) |
| 79 | +- `brainstorming` — ~2KB |
| 80 | +- `cost-speed-meter` — ~4KB |
| 81 | + |
| 82 | +**Total always-loaded: ~17KB** — under 5% of typical conversation context. |
| 83 | + |
| 84 | +On-demand skills (load only when invoked): |
| 85 | +- `update-docs` — ~8KB (detailed multi-step process) |
| 86 | + |
| 87 | +## Design Rationale |
| 88 | + |
| 89 | +1. **Merged python-conventions + data-pipeline-patterns** — Both were "team conventions for Python code." Keeping them separate created confusion about scope. One unified `python-patterns` skill is clearer and avoids redundancy. |
| 90 | + |
| 91 | +2. **Explicit activation in ai-workspace.toml** — Skills can now be tracked as dependencies. Commands that require a skill have it documented. Future refactoring is safer. |
| 92 | + |
| 93 | +3. **Removed redhat-writing from repo** — Generic meta-repo should not include user-specific or organization-specific content. Red Hat employees can add this locally to `~/.claude/CLAUDE.md`. |
| 94 | + |
| 95 | +4. **Clarified brainstorming and cost-speed-meter** — Both had vague triggers ("when to activate"). Rewritten with explicit user-facing conditions (what the user asks for, not implicit context). |
| 96 | + |
| 97 | +5. **Consolidated core verification** — Multiple commands (`/verify`, `/quality-gate`, `/refactor-safe`) all use `verification-loop`. Having them as separate commands is fine; they invoke the same skill with different phase subsets. |
0 commit comments