|
| 1 | +# Lessons from Building Claude Code: How We Use Skills |
| 2 | + |
| 3 | +> Source: Thariq (@trq212), Anthropic — 2026-03-17 |
| 4 | +> https://x.com/trq212/status/2033949937936085378 |
| 5 | +> Extracted: 2026-03-17. Only insights NOT already in skills-guide-anthropic.md. |
| 6 | +
|
| 7 | +## 1. Nine Skill Categories (Audit Checklist) |
| 8 | + |
| 9 | +Use this taxonomy to identify gaps in your skill library: |
| 10 | + |
| 11 | +| # | Category | Purpose | Examples | |
| 12 | +|---|----------|---------|----------| |
| 13 | +| 1 | **Library & API Reference** | How to correctly use a library/CLI/SDK | billing-lib, internal-cli, frontend-design | |
| 14 | +| 2 | **Product Verification** | Test/verify that code works (playwright, tmux) | signup-flow-driver, checkout-verifier | |
| 15 | +| 3 | **Data Fetching & Analysis** | Connect to data/monitoring stacks | funnel-query, cohort-compare, grafana | |
| 16 | +| 4 | **Business Process & Team Automation** | Automate repetitive workflows | standup-post, create-ticket, weekly-recap | |
| 17 | +| 5 | **Code Scaffolding & Templates** | Generate framework boilerplate | new-workflow, new-migration, create-app | |
| 18 | +| 6 | **Code Quality & Review** | Enforce code quality, review code | adversarial-review, code-style, testing-practices | |
| 19 | +| 7 | **CI/CD & Deployment** | Fetch, push, deploy code | babysit-pr, deploy-service, cherry-pick-prod | |
| 20 | +| 8 | **Runbooks** | Symptom -> investigation -> structured report | service-debugging, oncall-runner, log-correlator | |
| 21 | +| 9 | **Infrastructure Operations** | Routine maintenance with guardrails | orphan-cleanup, dependency-management, cost-investigation | |
| 22 | + |
| 23 | +**Key insight**: The best skills fit cleanly into ONE category. Confusing skills straddle several. |
| 24 | + |
| 25 | +## 2. Gotchas Section = Highest-Signal Content |
| 26 | + |
| 27 | +The most valuable part of any skill is a **Gotchas** section built from real failure points. |
| 28 | + |
| 29 | +- Start with common mistakes Claude makes using the skill |
| 30 | +- Update iteratively as new edge cases appear |
| 31 | +- This is more valuable than detailed instructions |
| 32 | + |
| 33 | +```markdown |
| 34 | +## Gotchas |
| 35 | +- Always use `--no-cache` flag when running migrations (stale cache causes silent failures) |
| 36 | +- The `user_id` column in `events` table is NOT the same as `users.id` — join via `canonical_user_id` |
| 37 | +- Never call `billing.charge()` without checking `subscription.active` first |
| 38 | +``` |
| 39 | + |
| 40 | +## 3. Don't State the Obvious |
| 41 | + |
| 42 | +Focus on information that pushes Claude **out of its normal way of thinking**. |
| 43 | +Claude already knows a lot about coding — add value with org-specific knowledge, |
| 44 | +non-obvious patterns, and things that differ from standard approaches. |
| 45 | + |
| 46 | +Example: the `frontend-design` skill was built by iterating on improving Claude's |
| 47 | +design taste, avoiding generic patterns (Inter font, purple gradients). |
| 48 | + |
| 49 | +## 4. Setup Pattern with config.json |
| 50 | + |
| 51 | +For skills needing user-specific setup (e.g., which Slack channel to post to): |
| 52 | + |
| 53 | +1. Store setup info in a `config.json` in the skill directory |
| 54 | +2. On first run, if config is missing, ask the user for the information |
| 55 | +3. Save for future runs |
| 56 | + |
| 57 | +Use `AskUserQuestion` tool for structured, multiple-choice setup questions. |
| 58 | + |
| 59 | +## 5. Persistent Data with ${CLAUDE_PLUGIN_DATA} |
| 60 | + |
| 61 | +Skills can maintain memory by storing data within them: |
| 62 | +- Append-only text logs, JSON files, or even SQLite databases |
| 63 | +- Example: `standup-post` keeps a `standups.log` — next run, Claude reads its own history |
| 64 | + |
| 65 | +**Important**: Data in the skill directory may be deleted on upgrade. |
| 66 | +Use `${CLAUDE_PLUGIN_DATA}` for stable per-plugin storage. |
| 67 | + |
| 68 | +## 6. Store Scripts & Helper Libraries |
| 69 | + |
| 70 | +Give Claude pre-built scripts and libraries to **compose** rather than reconstruct: |
| 71 | + |
| 72 | +``` |
| 73 | +skills/data-analysis/ |
| 74 | + SKILL.md |
| 75 | + lib/ |
| 76 | + fetch_events.py # helper to query event source |
| 77 | + format_report.py # standard report formatter |
| 78 | + references/ |
| 79 | + schema.md # table schemas and relationships |
| 80 | +``` |
| 81 | + |
| 82 | +Claude spends its turns on **composition and decision-making** instead of |
| 83 | +reconstructing boilerplate. It generates scripts on the fly that import and |
| 84 | +compose these helpers. |
| 85 | + |
| 86 | +## 7. On-Demand Hooks (Skill-Scoped) |
| 87 | + |
| 88 | +Skills can register hooks that activate **only when the skill is called** |
| 89 | +and last for the session duration. Use for opinionated hooks that would be |
| 90 | +annoying if always active: |
| 91 | + |
| 92 | +- `/careful` — blocks `rm -rf`, `DROP TABLE`, force-push, `kubectl delete` |
| 93 | + via PreToolUse matcher on Bash. Only when touching prod. |
| 94 | +- `/freeze` — blocks Edit/Write outside a specific directory. |
| 95 | + Useful when debugging to prevent accidental "fixes" to unrelated code. |
| 96 | + |
| 97 | +## 8. Composing Skills |
| 98 | + |
| 99 | +Skills can reference other skills by name. If the referenced skill is installed, |
| 100 | +the model will invoke it automatically. No native dependency management yet — |
| 101 | +just mention the skill name in your instructions. |
| 102 | + |
| 103 | +## 9. Measuring Skill Usage |
| 104 | + |
| 105 | +Use a **PreToolUse hook** to log which skills are invoked: |
| 106 | +- Track popularity and identify under-triggering skills |
| 107 | +- Compare actual usage vs expectations |
| 108 | +- Helps curate and improve the skill library |
| 109 | + |
| 110 | +## 10. Avoid Railroading Claude |
| 111 | + |
| 112 | +Be careful of over-specifying instructions in reusable skills: |
| 113 | +- Give Claude the information it needs |
| 114 | +- But give it flexibility to adapt to the situation |
| 115 | +- Too-specific instructions break when context varies |
| 116 | + |
| 117 | +## 11. Distribution Strategy |
| 118 | + |
| 119 | +| Scale | Approach | |
| 120 | +|-------|----------| |
| 121 | +| Small team, few repos | Check skills into repo under `.claude/skills/` | |
| 122 | +| Growing org | Internal plugin marketplace | |
| 123 | + |
| 124 | +**Marketplace flow**: sandbox folder on GitHub -> share on Slack -> gains traction -> PR to marketplace. |
| 125 | + |
| 126 | +**Warning**: It's easy to create bad or redundant skills. Have a curation method before release. |
0 commit comments