$npx -y skills add TanStack/intent --skill generate-skillGenerate a complete SKILL.md file for a library from source documentation and skill tree artifacts. Activate when bootstrapping skills for a new library, regenerating a stale skill after source changes, or producing a skill from a skill_tree.yaml entry. Takes a skill name, descri
| 1 | # Skill Generation |
| 2 | |
| 3 | You are generating a SKILL.md file for the `@tanstack/intent` agent skills |
| 4 | repo. Skills in this repo are written for coding agents (Claude Code, Cursor, |
| 5 | Copilot, Warp Oz, Codex), not for human readers. Your output will be loaded |
| 6 | into an agent's context window and used to guide code generation. |
| 7 | |
| 8 | There are two modes. Detect which applies. |
| 9 | |
| 10 | **Mode A — Generate from domain map:** A `domain_map.yaml` and `skill_spec.md` |
| 11 | exist. Generate the skill specified by name from these artifacts plus the |
| 12 | source documentation they reference. |
| 13 | |
| 14 | **Mode B — Generate from raw docs:** No domain map exists. Generate directly |
| 15 | from source documentation provided as input. |
| 16 | |
| 17 | --- |
| 18 | |
| 19 | ## Inputs |
| 20 | |
| 21 | You will receive: |
| 22 | |
| 23 | If the maintainer uses a custom skills root, replace `skills/` in any paths |
| 24 | below with their chosen directory. |
| 25 | |
| 26 | **Monorepo:** When the skill tree entry has a `package` field, write the |
| 27 | SKILL.md into that package's skills directory (e.g. |
| 28 | `packages/client/skills/core/SKILL.md`), not a shared root. |
| 29 | |
| 30 | 1. **Skill path** — format `library-group/skill-name` (e.g. `tanstack-query/core`, |
| 31 | `tanstack-router/loaders`, `db/core/live-queries`). This is the skill's |
| 32 | directory path, and it is where the `SKILL.md` lives. Only its **last |
| 33 | segment** becomes the frontmatter `name` (a spec-legal leaf): the full path |
| 34 | is never written into `name`, and `name` must contain no slashes. |
| 35 | 2. **Skill description** — what the skill covers and when an agent should load it |
| 36 | 3. **Source documentation** — the docs, guides, API references, and/or source |
| 37 | files to distill from |
| 38 | 4. **Domain map entry** (Mode A only) — the skill's entry from `domain_map.yaml` |
| 39 | including failure modes, subsystems, compositions, and source references |
| 40 | |
| 41 | --- |
| 42 | |
| 43 | ## Step 1 — Determine skill type |
| 44 | |
| 45 | Read the inputs and classify the skill type: |
| 46 | |
| 47 | | Type | When to use | |
| 48 | | ------------- | ---------------------------------------------------------- | |
| 49 | | `core` | Framework-agnostic concepts, configuration, patterns | |
| 50 | | `sub-skill` | A focused sub-topic within a core or framework skill | |
| 51 | | `framework` | Framework-specific bindings, hooks, components | |
| 52 | | `lifecycle` | Cross-cutting developer journey (getting started, go-live) | |
| 53 | | `composition` | Integration between two or more libraries | |
| 54 | | `security` | Audit checklist or security validation | |
| 55 | |
| 56 | The skill type determines the frontmatter and body structure. See |
| 57 | skill-tree-generator for the full spec of each type. |
| 58 | |
| 59 | --- |
| 60 | |
| 61 | ### Subagent guidance for batch generation |
| 62 | |
| 63 | When generating multiple skills, spawn a separate subagent for each skill |
| 64 | (or per-package group). Each subagent receives the domain_map.yaml, |
| 65 | skill_tree.yaml, and the source docs relevant to its skill. This prevents |
| 66 | context bleed between skills and allows parallel generation. |
| 67 | |
| 68 | --- |
| 69 | |
| 70 | ## Step 2 — Extract content from sources |
| 71 | |
| 72 | **Line budget:** Each SKILL.md must stay under 500 lines. Before writing, |
| 73 | estimate the content size. If a skill has 5+ failure modes, 3+ primary |
| 74 | patterns, and subsystem details, proactively plan reference files during |
| 75 | extraction — don't wait until the skill exceeds the limit. |
| 76 | |
| 77 | Read through the source documentation. Extract only what a coding agent |
| 78 | cannot already know: |
| 79 | |
| 80 | ### What to extract |
| 81 | |
| 82 | - **API shapes** — function signatures, hook parameters, option objects, |
| 83 | return types. Use the actual TypeScript types from source. |
| 84 | - **Setup patterns** — minimum viable initialization code |
| 85 | - **Primary patterns** — the 2–4 most important usage patterns |
| 86 | - **Configuration** — defaults that matter, options that change behavior |
| 87 | - **Failure modes** — patterns that look correct but break. Prioritize: |
| 88 | - Migration-boundary mistakes (old API that agents trained on older data produce) |
| 89 | - Silent failures (no crash, wrong behavior) |
| 90 | - Framework-specific gotchas (hydration, hook rules, provider ordering) |
| 91 | - **Constraints and invariants** — ordering requirements, lifecycle rules, |
| 92 | things enforced by runtime assertions |
| 93 | - **Issue/discussion-sourced patterns** — real developer mistakes and |
| 94 | confusion surfaced from GitHub issues and discussions (see below) |
| 95 | |
| 96 | ### 2b — Scan GitHub issues and discussions |
| 97 | |
| 98 | Bef |