@tanstack/intent 0.0.1

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 (37) hide show
  1. package/README.md +66 -0
  2. package/dist/cli.d.mts +1 -0
  3. package/dist/cli.mjs +327 -0
  4. package/dist/feedback-DKreHfB1.mjs +300 -0
  5. package/dist/feedback-FIUBOL0g.mjs +3 -0
  6. package/dist/index.d.mts +61 -0
  7. package/dist/index.mjs +8 -0
  8. package/dist/init-DEzzXm9j.mjs +3 -0
  9. package/dist/init-DNxmjQfU.mjs +70 -0
  10. package/dist/intent-library.d.mts +1 -0
  11. package/dist/intent-library.mjs +123 -0
  12. package/dist/library-scanner-BrznE00j.mjs +111 -0
  13. package/dist/library-scanner.d.mts +16 -0
  14. package/dist/library-scanner.mjs +4 -0
  15. package/dist/scanner-BuWPDJ4P.mjs +4 -0
  16. package/dist/scanner-CpsJAHXT.mjs +147 -0
  17. package/dist/setup-CNGz26qL.mjs +116 -0
  18. package/dist/setup-N5dttGp_.d.mts +10 -0
  19. package/dist/setup.d.mts +2 -0
  20. package/dist/setup.mjs +3 -0
  21. package/dist/staleness-CnomT9Hm.mjs +72 -0
  22. package/dist/staleness-DyhsrqQ5.mjs +4 -0
  23. package/dist/types-kbQfN_is.d.mts +70 -0
  24. package/dist/utils-DjkEPBxu.mjs +39 -0
  25. package/meta/domain-discovery/SKILL.md +681 -0
  26. package/meta/generate-skill/SKILL.md +419 -0
  27. package/meta/skill-staleness-check/SKILL.md +282 -0
  28. package/meta/templates/oz/domain-discovery.md +53 -0
  29. package/meta/templates/oz/feedback-collection.md +69 -0
  30. package/meta/templates/oz/skill-update.md +47 -0
  31. package/meta/templates/oz/tree-generation.md +48 -0
  32. package/meta/templates/workflows/generate-skills-oz.yml +86 -0
  33. package/meta/templates/workflows/notify-playbooks.yml +52 -0
  34. package/meta/templates/workflows/update-skills-oz.yml +98 -0
  35. package/meta/templates/workflows/validate-skills.yml +52 -0
  36. package/meta/tree-generator/SKILL.md +859 -0
  37. package/package.json +38 -0
@@ -0,0 +1,419 @@
1
+ ---
2
+ name: skill-generate
3
+ description: >
4
+ Generate a complete SKILL.md file for a library from source documentation
5
+ and skill tree artifacts. Activate when bootstrapping skills for a new
6
+ library, regenerating a stale skill after source changes, or producing a
7
+ skill from a skill_tree.yaml entry. Takes a skill name, description, and
8
+ source docs as inputs; outputs a validated SKILL.md that conforms to the
9
+ tree-generator spec.
10
+ metadata:
11
+ version: '1.0'
12
+ category: meta-tooling
13
+ input_artifacts:
14
+ - skills/_artifacts/skill_tree.yaml
15
+ - skills/_artifacts/domain_map.yaml
16
+ - skills/_artifacts/skill_spec.md
17
+ - source documentation
18
+ output_artifacts:
19
+ - SKILL.md
20
+ skills:
21
+ - skill-tree-generator
22
+ - skill-domain-discovery
23
+ ---
24
+
25
+ # Skill Generation
26
+
27
+ You are generating a SKILL.md file for the `@tanstack/intent` agent skills
28
+ repo. Skills in this repo are written for coding agents (Claude Code, Cursor,
29
+ Copilot, Warp Oz, Codex), not for human readers. Your output will be loaded
30
+ into an agent's context window and used to guide code generation.
31
+
32
+ There are two modes. Detect which applies.
33
+
34
+ **Mode A — Generate from domain map:** A `domain_map.yaml` and `skill_spec.md`
35
+ exist. Generate the skill specified by name from these artifacts plus the
36
+ source documentation they reference.
37
+
38
+ **Mode B — Generate from raw docs:** No domain map exists. Generate directly
39
+ from source documentation provided as input.
40
+
41
+ ---
42
+
43
+ ## Inputs
44
+
45
+ You will receive:
46
+
47
+ If the maintainer uses a custom skills root, replace `skills/` in any paths
48
+ below with their chosen directory.
49
+
50
+ 1. **Skill name** — format `library-group/skill-name` (e.g. `tanstack-query/core`,
51
+ `tanstack-router/loaders`, `db/core/live-queries`)
52
+ 2. **Skill description** — what the skill covers and when an agent should load it
53
+ 3. **Source documentation** — the docs, guides, API references, and/or source
54
+ files to distill from
55
+ 4. **Domain map entry** (Mode A only) — the skill's entry from `domain_map.yaml`
56
+ including failure modes, subsystems, compositions, and source references
57
+
58
+ ---
59
+
60
+ ## Step 1 — Determine skill type
61
+
62
+ Read the inputs and classify the skill type:
63
+
64
+ | Type | When to use |
65
+ | ------------- | ---------------------------------------------------------- |
66
+ | `core` | Framework-agnostic concepts, configuration, patterns |
67
+ | `sub-skill` | A focused sub-topic within a core or framework skill |
68
+ | `framework` | Framework-specific bindings, hooks, components |
69
+ | `lifecycle` | Cross-cutting developer journey (getting started, go-live) |
70
+ | `composition` | Integration between two or more libraries |
71
+ | `security` | Audit checklist or security validation |
72
+
73
+ The skill type determines the frontmatter and body structure. See
74
+ skill-tree-generator for the full spec of each type.
75
+
76
+ ---
77
+
78
+ ## Step 2 — Extract content from sources
79
+
80
+ Read through the source documentation. Extract only what a coding agent
81
+ cannot already know:
82
+
83
+ ### What to extract
84
+
85
+ - **API shapes** — function signatures, hook parameters, option objects,
86
+ return types. Use the actual TypeScript types from source.
87
+ - **Setup patterns** — minimum viable initialization code
88
+ - **Primary patterns** — the 2–4 most important usage patterns
89
+ - **Configuration** — defaults that matter, options that change behavior
90
+ - **Failure modes** — patterns that look correct but break. Prioritize:
91
+ - Migration-boundary mistakes (old API that agents trained on older data produce)
92
+ - Silent failures (no crash, wrong behavior)
93
+ - Framework-specific gotchas (hydration, hook rules, provider ordering)
94
+ - **Constraints and invariants** — ordering requirements, lifecycle rules,
95
+ things enforced by runtime assertions
96
+
97
+ ### What NOT to extract
98
+
99
+ - TypeScript basics, React hooks concepts, general web dev knowledge
100
+ - Marketing copy, motivational prose, "why this library is great"
101
+ - Exhaustive API tables (move these to `references/` if needed)
102
+ - Content that duplicates another skill (reference it instead)
103
+
104
+ ---
105
+
106
+ ## Step 3 — Write the frontmatter
107
+
108
+ ### Core skill frontmatter
109
+
110
+ ```yaml
111
+ ---
112
+ name: [library]/[skill-name]
113
+ description: >
114
+ [1–3 sentences. What this skill covers and exactly when an agent should
115
+ load it. Written for the agent — include the keywords an agent would
116
+ encounter when it needs this skill. Dense routing key.]
117
+ type: core
118
+ library: [library]
119
+ library_version: "[version this targets]"
120
+ sources:
121
+ - "[Owner/repo]:docs/[path].md"
122
+ - "[Owner/repo]:src/[path].ts"
123
+ ---
124
+ ```
125
+
126
+ ### Sub-skill frontmatter
127
+
128
+ ```yaml
129
+ ---
130
+ name: [library]/[parent]/[skill-name]
131
+ description: >
132
+ [1–3 sentences. What this sub-topic covers and when to load it.]
133
+ type: sub-skill
134
+ library: [library]
135
+ library_version: "[version]"
136
+ sources:
137
+ - "[Owner/repo]:docs/[path].md"
138
+ ---
139
+ ```
140
+
141
+ ### Framework skill frontmatter
142
+
143
+ ```yaml
144
+ ---
145
+ name: [library]/[framework]
146
+ description: >
147
+ [1–3 sentences. Framework-specific bindings. Name the hooks, components,
148
+ providers.]
149
+ type: framework
150
+ library: [library]
151
+ framework: [react | vue | solid | svelte | angular]
152
+ library_version: "[version]"
153
+ requires:
154
+ - [library]/core
155
+ sources:
156
+ - "[Owner/repo]:docs/framework/[framework]/[path].md"
157
+ ---
158
+ ```
159
+
160
+ ### Frontmatter rules
161
+
162
+ - `description` must be written so the agent loads this skill at the right
163
+ time — not too broad (triggers on everything) and not too narrow (never
164
+ triggers). Pack with function names, option names, concept keywords.
165
+ - `sources` uses the format `Owner/repo:relative-path`. Glob patterns are
166
+ supported (e.g. `TanStack/query:docs/framework/react/guides/*.md`).
167
+ - `library_version` is the version of the source library this skill targets.
168
+ - `requires` lists skills that must be loaded before this one.
169
+
170
+ ---
171
+
172
+ ## Step 4 — Write the body
173
+
174
+ ### Standard body (core, sub-skill, framework)
175
+
176
+ Follow this section order exactly:
177
+
178
+ **1. Dependency note** (framework and sub-skills only)
179
+
180
+ ```markdown
181
+ This skill builds on [parent-skill]. Read it first for foundational concepts.
182
+ ```
183
+
184
+ **2. Setup**
185
+
186
+ A complete, copy-pasteable code block showing minimum viable usage.
187
+
188
+ - Real package imports with exact names (`@tanstack/react-query`, not `react-query`)
189
+ - No `// ...` or `[your code here]` — complete and runnable
190
+ - No unnecessary boilerplate — include exactly the context needed
191
+ - For framework skills: framework-specific setup (provider, hook wiring)
192
+ - For core skills: framework-agnostic setup (no hooks, no components)
193
+
194
+ **3. Core Patterns** (or "Hooks and Components" for framework skills)
195
+
196
+ 2–4 patterns. For each:
197
+
198
+ - One-line heading: what it accomplishes
199
+ - Complete code block
200
+ - One sentence of explanation only if not self-explanatory
201
+
202
+ **4. Common Mistakes**
203
+
204
+ Minimum 3 entries. Complex skills target 5–6. Format:
205
+
206
+ ````markdown
207
+ ### [PRIORITY] [What goes wrong — 5–8 word phrase]
208
+
209
+ Wrong:
210
+
211
+ ```[lang]
212
+ // code that looks correct but isn't
213
+ ```
214
+ ````
215
+
216
+ Correct:
217
+
218
+ ```[lang]
219
+ // code that works
220
+ ```
221
+
222
+ [One sentence: the specific mechanism by which the wrong version fails.]
223
+
224
+ Source: [doc page or source file:line]
225
+
226
+ ````
227
+
228
+ Priority levels:
229
+ - **CRITICAL** — Breaks in production. Security risk or data loss.
230
+ - **HIGH** — Incorrect behavior under common conditions.
231
+ - **MEDIUM** — Incorrect under specific conditions or edge cases.
232
+
233
+ Every mistake must be:
234
+ - **Plausible** — an agent would generate it
235
+ - **Silent** — no immediate crash
236
+ - **Grounded** — traceable to a doc page, source file, or issue
237
+
238
+ If the domain map includes failure modes with a `skills` list naming
239
+ multiple skills, include those failure modes in every SKILL file listed.
240
+
241
+ **5. References** (only when needed)
242
+
243
+ ```markdown
244
+ ## References
245
+
246
+ - [Full option reference](references/options.md)
247
+ ````
248
+
249
+ Create reference files when the skill would exceed 500 lines, when the
250
+ domain covers 3+ independent adapters/backends, or when a topic has >10
251
+ distinct API patterns.
252
+
253
+ ### Checklist body (security, go-live, audit)
254
+
255
+ Use when the primary action is "check these things" not "learn patterns":
256
+
257
+ ````markdown
258
+ # [Library Name] — [Security | Go-Live] Checklist
259
+
260
+ Run through each section before [deploying | releasing].
261
+
262
+ ## [Category] Checks
263
+
264
+ ### Check: [what to verify]
265
+
266
+ Expected:
267
+
268
+ ```[lang]
269
+ // correct configuration
270
+ ```
271
+ ````
272
+
273
+ Fail condition: [what indicates this check failed]
274
+ Fix: [one-line remediation]
275
+
276
+ ## Common Security Mistakes
277
+
278
+ [Wrong/correct pairs, same format as standard Common Mistakes]
279
+
280
+ ## Pre-Deploy Summary
281
+
282
+ - [ ] [Verification 1]
283
+ - [ ] [Verification 2]
284
+
285
+ ```
286
+
287
+ ---
288
+
289
+ ## Step 5 — Validate
290
+
291
+ Run every check before outputting. Fix any failures.
292
+
293
+ | Check | Rule |
294
+ |-------|------|
295
+ | Under 500 lines | Move excess to references/ |
296
+ | Real imports in every code block | Exact package name, correct adapter |
297
+ | No external concept explanations | No "TypeScript is...", no "React hooks are..." |
298
+ | No marketing prose | No "powerful", "elegant", "best-in-class" |
299
+ | Every code block is complete | Works without modification when pasted |
300
+ | Common Mistakes are silent | Not obvious compile errors |
301
+ | Common Mistakes are library-specific | Not generic TS/React mistakes |
302
+ | Common Mistakes are sourced | Traceable to doc or source |
303
+ | `name` matches expected directory path | `db/core/live-queries` → `db/core/live-queries/SKILL.md` |
304
+ | `sources` filled for sub-skills | At least one Owner/repo:path |
305
+ | Framework skills have `requires` | Lists core dependency |
306
+ | Framework skills open with dependency note | First prose line references core |
307
+ | Description is a dense routing key | Not a human summary — agent-facing |
308
+
309
+ ---
310
+
311
+ ## Step 6 — Output
312
+
313
+ Output the complete SKILL.md file content. If reference files are needed,
314
+ output those as well with their relative paths.
315
+
316
+ If generating multiple skills in a batch (e.g. all skills for a library),
317
+ output in this order:
318
+
319
+ 1. Core overview SKILL.md
320
+ 2. Core sub-skills in domain order
321
+ 3. Framework overview SKILL.md for each framework
322
+ 4. Framework sub-skills
323
+ 5. Composition skills
324
+ 6. Security/checklist skills
325
+ 7. Reference files
326
+
327
+ ---
328
+
329
+ ## Regeneration mode
330
+
331
+ When regenerating a stale skill (triggered by skill-staleness-check):
332
+
333
+ 1. Read the existing SKILL.md and the source diff that triggered staleness
334
+ 2. Determine which sections are affected by the change
335
+ 3. Update only affected sections — preserve all other content
336
+ 4. If a breaking change occurred, add the old pattern as a new Common
337
+ Mistake entry (wrong/correct pair)
338
+ 5. Bump `library_version` in frontmatter
339
+ 6. Validate the complete file against Step 5 checks
340
+
341
+ Do not rewrite the entire skill for a minor source change. Surgical
342
+ updates preserve review effort and reduce diff noise.
343
+
344
+ ---
345
+
346
+ ## Constraints
347
+
348
+ | Rule | Detail |
349
+ |------|--------|
350
+ | React adapter only (Phase 1) | No Vue, Solid, Svelte, Angular examples unless generating a framework skill for that adapter |
351
+ | All imports use real package names | `@tanstack/react-query`, not `react-query` |
352
+ | No placeholder code | No `// ...`, `[your value]`, or `...rest` |
353
+ | Agent-first writing | Only write what the agent cannot already know |
354
+ | Examples are minimal | No unnecessary boilerplate or wrapper components |
355
+ | Failure modes are high-value | Focus on plausible-but-broken, not obvious errors |
356
+
357
+ ---
358
+
359
+ ## Cross-model compatibility
360
+
361
+ Output is consumed by all major AI coding agents. To ensure consistency:
362
+
363
+ - Markdown with YAML frontmatter — universally parsed
364
+ - No XML tags in generated skill content
365
+ - Code blocks use triple backticks with language annotation
366
+ - Section boundaries use ## headers
367
+ - Descriptions are keyword-packed for routing
368
+ - Examples show concrete values, never placeholders
369
+ - Positive instructions ("Use X") over negative ("Don't use Y")
370
+ - Critical info at start or end of sections (not buried in middle)
371
+ - Each SKILL.md is self-contained except for declared `requires`
372
+
373
+ ---
374
+
375
+ ## Meta-skill feedback (alpha default)
376
+
377
+ After generating the first iteration of skills, complete a single Markdown
378
+ feedback draft for all three meta skills used in scaffolding. If a draft
379
+ exists from previous steps, keep it and fill the **Generate Skill** section.
380
+ If no draft exists, create it using this exact template.
381
+
382
+ ```
383
+
384
+ # Intent Meta Skill Feedback
385
+
386
+ ## Domain Discovery
387
+
388
+ - What worked well:
389
+ - What was confusing or missing:
390
+ - Suggestions for improvement:
391
+ - Overall rating: good | mixed | bad
392
+
393
+ ## Tree Generator
394
+
395
+ - What worked well:
396
+ - What was confusing or missing:
397
+ - Suggestions for improvement:
398
+ - Overall rating: good | mixed | bad
399
+
400
+ ## Generate Skill
401
+
402
+ - What worked well:
403
+ - What was confusing or missing:
404
+ - Suggestions for improvement:
405
+ - Overall rating: good | mixed | bad
406
+
407
+ ## Context (optional)
408
+
409
+ - Library:
410
+ - Repo:
411
+ - Docs:
412
+ - Notes:
413
+
414
+ ```
415
+
416
+ Ask the maintainer if they want to edit the feedback. Then ask if you should
417
+ send it as a GitHub issue to TanStack/intent. Use the issue title:
418
+ `[meta-feedback] intent meta skill`. Only submit if they confirm.
419
+ ```
@@ -0,0 +1,282 @@
1
+ ---
2
+ name: skill-staleness-check
3
+ description: >
4
+ Evaluate intent skills for staleness when source files change in upstream
5
+ TanStack package repos. Driven by Oz automation on webhook trigger. Matches
6
+ changed files against metadata.sources, evaluates whether diffs affect
7
+ documented behavior, rewrites stale skills using skill-generate, checks
8
+ cross-skill references, and opens PRs. Silent when nothing needs updating.
9
+ metadata:
10
+ version: '1.0'
11
+ category: meta-tooling
12
+ input_artifacts:
13
+ - webhook payload (package name, commit SHA, changed files)
14
+ output_artifacts:
15
+ - updated SKILL.md files
16
+ - pull requests
17
+ skills:
18
+ - skill-generate
19
+ - skill-tree-generator
20
+ ---
21
+
22
+ # Skill Staleness Check
23
+
24
+ You are an Oz automation agent. Your job is to evaluate whether intent
25
+ skills are stale after upstream source changes, and if so, update them and
26
+ open PRs. You act autonomously end-to-end. PRs contain already-updated
27
+ skill content, not suggestions.
28
+
29
+ If nothing needs updating, exit silently. No PR, no notification.
30
+
31
+ ---
32
+
33
+ ## Inputs
34
+
35
+ Webhook payload from an upstream package repo merge to main:
36
+
37
+ ```json
38
+ {
39
+ "package": "@tanstack/query",
40
+ "sha": "abc123",
41
+ "changed_files": ["docs/framework/react/guides/queries.md", "src/query.ts"]
42
+ }
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Step 1 — Match changed files to skills
48
+
49
+ Read all SKILL.md files under `packages/intent/skills/`. For each skill,
50
+ extract `sources` from the frontmatter.
51
+
52
+ Match `changed_files` from the webhook against `sources` entries across all
53
+ skills. Source references use the format `Owner/repo:relative-path` and
54
+ support glob patterns.
55
+
56
+ A skill is a **candidate** if any of its `sources` entries match a changed
57
+ file.
58
+
59
+ If no skills match, exit silently.
60
+
61
+ ### Using sync-skills.mjs
62
+
63
+ The repo includes `scripts/sync-skills.mjs` for programmatic staleness
64
+ detection. For a given library:
65
+
66
+ ```bash
67
+ node scripts/sync-skills.mjs <library>
68
+ ```
69
+
70
+ This checks:
71
+
72
+ - Source file SHA drift (compares stored SHAs in `sync-state.json` against
73
+ current remote SHAs via GitHub API)
74
+ - Library version drift (frontmatter `library_version` vs current published
75
+ version)
76
+ - Tree-generator changes (whether the meta skill has been updated since
77
+ last sync)
78
+
79
+ Use `--report` to write a structured `staleness_report.yaml`:
80
+
81
+ ```bash
82
+ node scripts/sync-skills.mjs <library> --report
83
+ ```
84
+
85
+ The report classifies skills as needing regeneration (source changed) or
86
+ version bump only.
87
+
88
+ ---
89
+
90
+ ## Step 2 — Evaluate each candidate
91
+
92
+ For each matched skill:
93
+
94
+ 1. Read the current SKILL.md content
95
+ 2. Fetch the file diff from the triggering commit in the source repo
96
+ 3. Classify the change:
97
+
98
+ | Classification | Criteria | Action |
99
+ | --------------------- | --------------------------------------------------------------------------------------------- | ------------------------------------------- |
100
+ | **No impact** | Diff is typo fix, comment change, test-only, or internal refactor with no API/behavior change | Skip — no update needed |
101
+ | **Version bump only** | Diff changes version numbers, dependency ranges, or metadata but no documented behavior | Bump `library_version` in frontmatter |
102
+ | **Content update** | Diff changes API shape, behavior, defaults, types, or patterns that the skill documents | Rewrite affected sections |
103
+ | **Breaking change** | Diff removes, renames, or fundamentally changes an API the skill documents | Rewrite + add old pattern as Common Mistake |
104
+
105
+ ### Two-pass classification
106
+
107
+ **Pass 1 — Quick scan:** Read the diff summary (files changed, insertions,
108
+ deletions). Identify which skill sections could be affected.
109
+
110
+ **Pass 2 — Detail evaluation:** For each potentially affected section, read
111
+ the full diff hunks and compare against the skill content. Determine if the
112
+ change actually affects what the skill documents.
113
+
114
+ This prevents over-updating. A 200-line diff to a source file may only
115
+ affect one line of one skill, or none at all.
116
+
117
+ ---
118
+
119
+ ## Step 3 — Update stale skills
120
+
121
+ For skills classified as needing content updates:
122
+
123
+ 1. Load the skill-generate meta skill
124
+ 2. Provide it with:
125
+ - The existing SKILL.md content
126
+ - The source diff
127
+ - The current source documentation (fetch the updated file)
128
+ 3. Use regeneration mode (surgical update, not full rewrite)
129
+ 4. Validate the updated skill against all checks
130
+
131
+ For version bump only:
132
+
133
+ ```bash
134
+ node scripts/sync-skills.mjs <library> --bump-version <new-version>
135
+ ```
136
+
137
+ This updates `library_version` in all frontmatter for the library and
138
+ records the new version in `sync-state.json`.
139
+
140
+ ---
141
+
142
+ ## Step 4 — Check cross-skill references
143
+
144
+ After updating skills in Step 3, check for cross-skill staleness:
145
+
146
+ 1. For each skill that was updated, read its `name`
147
+ 2. Scan all other skills for `requires` entries or `sources` that reference
148
+ the updated skill
149
+ 3. For each skill that references an updated skill, evaluate whether the
150
+ update makes the referencing skill stale or inconsistent
151
+ 4. If stale → update using the same process as Step 3
152
+ 5. If not → skip
153
+
154
+ This cascade is bounded to **one level**. Skills that reference a
155
+ second-order dependency are not automatically re-checked.
156
+
157
+ ---
158
+
159
+ ## Step 5 — Mark skills as synced
160
+
161
+ After updating, mark the affected skills as synced so future staleness
162
+ checks have a clean baseline:
163
+
164
+ ```bash
165
+ # Mark specific skills
166
+ node scripts/sync-skills.mjs <library> --mark-synced <skill1> <skill2>
167
+
168
+ # Mark all skills for a library
169
+ node scripts/sync-skills.mjs <library> --mark-synced --all
170
+ ```
171
+
172
+ This updates `sync-state.json` with current source file SHAs, the
173
+ tree-generator SHA, and the sync timestamp.
174
+
175
+ ---
176
+
177
+ ## Step 6 — Open PRs
178
+
179
+ For each skill (or group of skills) that was updated:
180
+
181
+ 1. Create branch: `skill-update/<skill-name>-<short-sha>`
182
+ 2. Commit updated SKILL.md file(s)
183
+ 3. Open PR with structured body
184
+
185
+ ### PR format
186
+
187
+ **Title:** `skill: update <skill-name> (<package>@<short-sha>)`
188
+
189
+ **Body:**
190
+
191
+ ```markdown
192
+ ### Triggered by
193
+
194
+ Changes to: <list of source files that matched>
195
+
196
+ ### What changed in the source
197
+
198
+ <summary of the diff — 2–3 sentences max>
199
+
200
+ ### What changed in the skill
201
+
202
+ <summary of skill edits — which sections were updated and why>
203
+
204
+ ### Cross-skill impact
205
+
206
+ <list any downstream skills checked; note if PRs were opened for them>
207
+
208
+ ### Review checklist
209
+
210
+ - [ ] Skill content is accurate
211
+ - [ ] Code examples are complete and copy-pasteable
212
+ - [ ] No other skills need corresponding updates
213
+ - [ ] Under 500 lines
214
+ ```
215
+
216
+ ### Grouping PRs
217
+
218
+ - If multiple skills for the same library are affected by the same commit,
219
+ group them in a single PR
220
+ - If a cross-skill update is needed (Step 4), open a separate PR for the
221
+ downstream skill to keep review scopes clean
222
+ - Never mix skills from different libraries in the same PR
223
+
224
+ ---
225
+
226
+ ## No-op behavior
227
+
228
+ Exit silently (no PR, no notification, no issue) when ANY of these are true:
229
+
230
+ - No changed files match any skill's `sources`
231
+ - All matched diffs are classified as "no impact" in Step 2
232
+ - The sync-skills.mjs report shows all skills are current
233
+
234
+ ---
235
+
236
+ ## Operational notes
237
+
238
+ ### GitHub API usage
239
+
240
+ The `sync-skills.mjs` script uses the `gh` CLI for GitHub API access. It
241
+ requires:
242
+
243
+ - `gh` CLI installed and authenticated
244
+ - Read access to upstream TanStack package repos (query, router, db, form,
245
+ table)
246
+ - Write access to the intent repo for creating branches and PRs
247
+
248
+ ### Rate limiting
249
+
250
+ When checking multiple libraries or many source files, the script makes
251
+ one API call per source file per skill. For large batches, the GitHub API
252
+ rate limit (5000 requests/hour for authenticated users) may apply. The
253
+ script does not currently batch or cache API responses — if this becomes
254
+ an issue, add caching at the `getRemoteFileSha` level.
255
+
256
+ ### Manual triggering
257
+
258
+ Maintainers can run staleness detection manually:
259
+
260
+ ```bash
261
+ # Check a specific library
262
+ node scripts/sync-skills.mjs db
263
+
264
+ # Check and write a report
265
+ node scripts/sync-skills.mjs db --report
266
+
267
+ # After reviewing and regenerating, mark as synced
268
+ node scripts/sync-skills.mjs db --mark-synced --all
269
+ ```
270
+
271
+ ---
272
+
273
+ ## Constraints
274
+
275
+ | Rule | Detail |
276
+ | ----------------------------------------------- | --------------------------------------------------- |
277
+ | Silent when nothing changes | No noise — exit cleanly if no updates needed |
278
+ | Surgical updates over full rewrites | Only change sections affected by the diff |
279
+ | One cascade level | Cross-skill checks go one level deep, not recursive |
280
+ | PRs scoped to one library | Never mix libraries in a single PR |
281
+ | Version bumps are separate from content updates | A version-only bump doesn't require regeneration |
282
+ | Commit messages include co-author | `Co-Authored-By: Oz <oz-agent@warp.dev>` |