@tanstack/intent 0.0.5 → 0.0.7

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.
@@ -57,7 +57,26 @@ reading exhaustively yet.
57
57
  guidance, read it. This is high-signal for what the maintainer
58
58
  considers important
59
59
 
60
- ### 1b — Note initial impressions
60
+ ### 1b — Read peer dependency constraints
61
+
62
+ Check `package.json` for `peerDependencies` and `peerDependenciesMeta`.
63
+ For each major peer dependency (React, Vue, Svelte, Next.js, etc.):
64
+
65
+ 1. Note the version range required
66
+ 2. Read the peer's docs for integration constraints that affect this
67
+ library: SSR/hydration rules, component lifecycle boundaries,
68
+ browser-only APIs, singleton patterns, connection limits
69
+ 3. Log framework-specific failure modes — these are the highest-impact
70
+ failure modes and cannot be discovered from the library's own source
71
+
72
+ Examples of peer-dependency-driven failure modes:
73
+
74
+ - SSR: calling browser-only APIs during server render
75
+ - React: breaking hook rules in library wrapper components
76
+ - Connection limits: opening multiple WebSocket connections per tab
77
+ - Singleton patterns: creating multiple client instances in dev mode
78
+
79
+ ### 1c — Note initial impressions
61
80
 
62
81
  Log (but do not group yet):
63
82
 
@@ -191,7 +210,11 @@ Move concept inventory items into groups. Two items belong together when:
191
210
  - They share a lifecycle, configuration scope, or architectural tradeoff
192
211
  - Getting one wrong tends to produce bugs in the other
193
212
 
194
- Target 4–7 domains. These are conceptual groupings, not the final skills.
213
+ Let library complexity drive the domain count a focused library may need
214
+ only 2–3 domains, while a large framework may need 7+. Validate by asking:
215
+ "Would a developer working on a single feature need to load skills from
216
+ multiple domains? If so, merge those domains." These are conceptual
217
+ groupings, not the final skills.
195
218
 
196
219
  Do not create a group for:
197
220
 
@@ -202,6 +225,14 @@ Do not create a group for:
202
225
 
203
226
  Name each domain as work being performed, not what the library provides.
204
227
 
228
+ **Validation step:** After grouping, check each domain by asking:
229
+ "Would a developer working on a single feature need to load skills from
230
+ multiple domains?" If yes, merge those domains. Group by developer tasks
231
+ (what they're trying to accomplish), not by architecture (how the library
232
+ is organized internally). For example, prefer "writing data" over
233
+ "producer lifecycle" — the former matches a developer's intent, the latter
234
+ matches the codebase structure.
235
+
205
236
  ### 3b — Map domains × tasks → skills
206
237
 
207
238
  Merge your conceptual domains with the maintainer's task list from
@@ -268,6 +299,14 @@ For each skill, extract failure modes that pass all three tests:
268
299
 
269
300
  Target 3 failure modes per skill minimum. Complex skills target 5–6.
270
301
 
302
+ **Code patterns.** Every failure mode should include `wrong_pattern` and
303
+ `correct_pattern` fields with short code snippets (3–10 lines each).
304
+ The wrong pattern is what an agent would generate; the correct pattern
305
+ is the fix. These feed directly into SKILL.md Common Mistakes sections
306
+ as wrong/correct code pairs. If the failure mode is purely conceptual
307
+ (e.g. an architectural choice) rather than a code pattern, omit both
308
+ fields and explain in `mechanism` instead.
309
+
271
310
  **Cross-skill failure modes.** Some failure modes belong to multiple
272
311
  skills. A developer doing SSR work and a developer doing state management
273
312
  both need to know about "stale state during hydration" — they load
@@ -298,7 +337,30 @@ only considers one side.
298
337
  Target 2–4 tensions. If you find none, the skills may be too isolated —
299
338
  revisit whether you're missing cross-connections.
300
339
 
301
- ### 3f — Identify gaps
340
+ ### 3f — Map cross-references
341
+
342
+ Beyond tensions (conflicts) and shared failure modes, identify skills
343
+ that illuminate each other without conflicting. A cross-reference means:
344
+ "an agent loading skill A would produce better code if it knew about
345
+ skill B." These become "See also" pointers in the generated SKILL.md
346
+ files.
347
+
348
+ For each pair, note:
349
+
350
+ - Which skill references which (can be bidirectional)
351
+ - Why awareness of the other skill improves output
352
+
353
+ Examples:
354
+
355
+ - A quickstart skill references the security checklist ("after setup, audit")
356
+ - A state management skill references an SSR skill ("state hydration
357
+ requires understanding SSR lifecycle")
358
+ - A data writing skill references a data reading skill ("writes affect
359
+ how queries invalidate")
360
+
361
+ Output these in the `cross_references` section of domain_map.yaml.
362
+
363
+ ### 3g — Identify gaps
302
364
 
303
365
  For each skill, explicitly list what you could NOT determine from docs
304
366
  and source alone. These become interview questions in Phase 4.
@@ -312,7 +374,7 @@ Common gaps:
312
374
  - "GitHub issues show confusion about X but docs don't address it"
313
375
  - "I found two patterns for doing X — unclear which is current/preferred"
314
376
 
315
- ### 3g — Discover composition targets
377
+ ### 3h — Discover composition targets
316
378
 
317
379
  Scan `package.json` for peer dependencies, optional dependencies, and
318
380
  `peerDependenciesMeta`. Scan example directories and integration tests
@@ -324,7 +386,7 @@ for import patterns. For each frequently co-used library, log:
324
386
 
325
387
  These become targeted composition questions in Phase 4e.
326
388
 
327
- ### 3h — Produce the draft
389
+ ### 3i — Produce the draft
328
390
 
329
391
  Write the full `domain_map.yaml` (format in Output Artifacts below) with
330
392
  a `status: draft` field. Flag every gap in the `gaps` section.
@@ -366,7 +428,7 @@ Follow up on any corrections. Then:
366
428
 
367
429
  ### 4b — Gap-targeted questions (3–8 questions)
368
430
 
369
- For each gap flagged in Phase 3f, ask a specific question. These are not
431
+ For each gap flagged in Phase 3g, ask a specific question. These are not
370
432
  generic — they reference what you found:
371
433
 
372
434
  **Instead of:** "What do developers get wrong?"
@@ -433,7 +495,7 @@ These surface knowledge that doesn't appear in any docs:
433
495
 
434
496
  ### 4e — Composition questions (if library interacts with others)
435
497
 
436
- Use what you discovered in Phase 3g. For each integration target
498
+ Use what you discovered in Phase 3h. For each integration target
437
499
  identified from peer dependencies and example code, ask targeted
438
500
  questions:
439
501
 
@@ -465,6 +527,11 @@ Update `status: draft` to `status: reviewed`.
465
527
  If the maintainer uses a custom skills root, replace `skills/` in the paths
466
528
  below with their chosen directory.
467
529
 
530
+ **Monorepo layout:** For monorepos, domain map artifacts go at the REPO ROOT
531
+ (e.g. `_artifacts/domain_map.yaml`) since they describe the whole library.
532
+ Skills are generated per-package later by the tree-generator and generate-skill
533
+ steps.
534
+
468
535
  ### 1. skills/\_artifacts/domain_map.yaml
469
536
 
470
537
  ```yaml
@@ -510,6 +577,10 @@ skills:
510
577
  failure_modes:
511
578
  - mistake: '[5-10 word phrase]'
512
579
  mechanism: '[one sentence]'
580
+ wrong_pattern: | # the code an agent would incorrectly generate
581
+ [short code snippet showing the mistake]
582
+ correct_pattern: | # the code that should be generated instead
583
+ [short code snippet showing the fix]
513
584
  source: '[doc page, source file, issue link, or maintainer interview]'
514
585
  priority: '[CRITICAL | HIGH | MEDIUM]'
515
586
  status: '[active | fixed-but-legacy-risk | removed]'
@@ -525,6 +596,11 @@ tensions:
525
596
  description: '[what conflicts — one sentence]'
526
597
  implication: '[what an agent gets wrong when it only considers one side]'
527
598
 
599
+ cross_references:
600
+ - from: '[skill-slug]'
601
+ to: '[skill-slug]'
602
+ reason: '[why loading one skill benefits from awareness of the other]'
603
+
528
604
  gaps:
529
605
  - skill: '[skill slug]'
530
606
  question: '[what still needs input]'
@@ -570,6 +646,12 @@ not promotional.]
570
646
  | -------------- | ------------------- | ----------------------- |
571
647
  | [short phrase] | [slug-a] ↔ [slug-b] | [what agents get wrong] |
572
648
 
649
+ ## Cross-References
650
+
651
+ | From | To | Reason |
652
+ | ------ | ------ | ----------------------------------------- |
653
+ | [slug] | [slug] | [why awareness of one improves the other] |
654
+
573
655
  ## Subsystems & Reference Candidates
574
656
 
575
657
  | Skill | Subsystems | Reference candidates |
@@ -624,6 +706,7 @@ not promotional.]
624
706
  | Subsystems flagged | Skills with 3+ adapters/backends list them as subsystems |
625
707
  | Dense surfaces flagged | Topics with >10 patterns noted as reference_candidates |
626
708
  | Lifecycle skills considered | Suggest journey skills when docs have the material |
709
+ | Cross-references mapped | Skills that illuminate each other get "See also" pointers |
627
710
 
628
711
  ---
629
712
 
@@ -4,12 +4,11 @@ description: >
4
4
  Collect structured feedback about skill usage after completing a coding task.
5
5
  Activate at the end of any session where one or more SKILL.md files were
6
6
  loaded. Captures agent signals (gaps, errors, corrections, human interventions)
7
- and brief human input, then submits via the intent feedback CLI.
7
+ and brief human input, then submits directly via gh CLI or provides manual
8
+ submission instructions.
8
9
  metadata:
9
- version: '1.0'
10
+ version: '2.0'
10
11
  category: meta-tooling
11
- output_artifacts:
12
- - intent-feedback.json
13
12
  ---
14
13
 
15
14
  # Skill Feedback Collection
@@ -83,74 +82,86 @@ If the human gives an explicit rating, use that instead.
83
82
 
84
83
  ---
85
84
 
86
- ## Phase 3 — Build the Payload
87
-
88
- Construct one JSON payload per skill used. The schema must match exactly:
89
-
90
- ```json
91
- {
92
- "skill": "<skill name from SKILL.md frontmatter>",
93
- "package": "<npm package name that contains the skill>",
94
- "skillVersion": "<metadata.version from SKILL.md frontmatter, or library_version>",
95
- "task": "<one-sentence summary of what the human asked you to do>",
96
- "whatWorked": "<patterns/instructions from the skill that were accurate and helpful>",
97
- "whatFailed": "<errors from 1b — what the skill got wrong>",
98
- "missing": "<gaps from 1a — what the skill should have covered>",
99
- "selfCorrections": "<fixes you applied from 1b + interventions from 1c>",
100
- "userRating": "good | mixed | bad",
101
- "userComments": "<optional — direct quotes or paraphrased human input from Phase 2>"
102
- }
103
- ```
85
+ ## Phase 3 — Build the Feedback
104
86
 
105
- ### Field derivation guide
87
+ Write one Markdown feedback file per skill used. Only include skills that were
88
+ actually used during the session — skip any that were loaded but never
89
+ referenced.
90
+
91
+ ### Template
92
+
93
+ ```markdown
94
+ # Skill Feedback: [skill name from SKILL.md frontmatter]
95
+
96
+ **Package:** [npm package name that contains the skill]
97
+ **Skill version:** [metadata.version or library_version from frontmatter]
98
+ **Rating:** [good | mixed | bad]
99
+
100
+ ## Task
101
+
102
+ [one-sentence summary of what the human asked you to do]
103
+
104
+ ## What Worked
105
+
106
+ [patterns/instructions from the skill that were accurate and helpful]
107
+
108
+ ## What Failed
109
+
110
+ [from 1b — skill instructions that produced errors]
111
+
112
+ ## Missing
106
113
 
107
- | Field | Source |
108
- | ----------------- | ------------------------------------------------------------------ |
109
- | `skill` | Frontmatter `name` field of the SKILL.md you loaded |
110
- | `package` | The npm package the skill lives in (e.g. `@tanstack/query-intent`) |
111
- | `skillVersion` | Frontmatter `metadata.version` or `library_version` |
112
- | `task` | Summarize the human's original request in one sentence |
113
- | `whatWorked` | List skill sections/patterns that were correct and useful |
114
- | `whatFailed` | From 1b — skill instructions that produced errors |
115
- | `missing` | From 1a gaps where the skill was silent |
116
- | `selfCorrections` | From 1b fixes + 1c human interventions, combined |
117
- | `userRating` | From Phase 2 sentiment analysis or explicit rating |
118
- | `userComments` | From Phase 2 answers, keep brief |
119
-
120
- ### Example
121
-
122
- ```json
123
- {
124
- "skill": "tanstack-query/core",
125
- "package": "@anthropic/tanstack-query-intent",
126
- "skillVersion": "1.0",
127
- "task": "Add optimistic updates to a mutation with rollback on error",
128
- "whatWorked": "Setup pattern was correct. onMutate/onError/onSettled lifecycle was accurate.",
129
- "whatFailed": "Cache key format used array syntax that doesn't match v5 — had to switch to queryOptions pattern.",
130
- "missing": "No guidance on TypeScript generics for mutation variables. Had to read source.",
131
- "selfCorrections": "Fixed cache key format. Human corrected the rollback type to include undefined.",
132
- "userRating": "mixed",
133
- "userComments": "The optimistic update pattern was helpful but the cache key thing wasted 10 minutes."
134
- }
114
+ [from 1a — gaps where the skill should have covered]
115
+
116
+ ## Self-Corrections
117
+
118
+ [from 1b fixes + 1c human interventions, combined]
119
+
120
+ ## User Comments
121
+
122
+ [optional direct quotes or paraphrased human input from Phase 2]
135
123
  ```
136
124
 
137
- If multiple skills were loaded, produce one payload per skill. Only include
138
- skills that were actually used during the session — skip any that were loaded
139
- but never referenced.
125
+ ### Field derivation guide
126
+
127
+ | Field | Source |
128
+ | ---------------- | ------------------------------------------------------------------ |
129
+ | Skill name | Frontmatter `name` field of the SKILL.md you loaded |
130
+ | Package | The npm package the skill lives in (e.g. `@tanstack/query-intent`) |
131
+ | Skill version | Frontmatter `metadata.version` or `library_version` |
132
+ | Task | Summarize the human's original request in one sentence |
133
+ | What Worked | List skill sections/patterns that were correct and useful |
134
+ | What Failed | From 1b — skill instructions that produced errors |
135
+ | Missing | From 1a — gaps where the skill was silent |
136
+ | Self-Corrections | From 1b fixes + 1c human interventions, combined |
137
+ | Rating | From Phase 2 sentiment analysis or explicit rating |
138
+ | User Comments | From Phase 2 answers, keep brief |
140
139
 
141
140
  ---
142
141
 
143
142
  ## Phase 4 — Submit
144
143
 
145
- 1. Save the payload to `intent-feedback.json` in the project root.
146
- If multiple skills, save as a JSON array.
144
+ Determine the target repo from the skill's package. The repo is typically
145
+ derivable from the `repository` field in the package's `package.json`, or
146
+ from the `sources` field in the SKILL.md frontmatter.
147
+
148
+ ### If `gh` CLI is available
149
+
150
+ Submit directly as a GitHub issue:
151
+
152
+ ```bash
153
+ gh issue create --repo [owner/repo] --title "Skill Feedback: [skill-name] ([rating])" --label "feedback:[skill-name]" --body-file intent-feedback.md
154
+ ```
155
+
156
+ If the label doesn't exist, omit the `--label` flag — don't let a missing
157
+ label block submission.
147
158
 
148
- 2. Submit:
159
+ If submission succeeds, delete the feedback file.
149
160
 
150
- ```bash
151
- npx intent feedback --submit --file intent-feedback.json
152
- ```
161
+ ### If `gh` CLI is not available
153
162
 
154
- 3. If the submission succeeds, delete `intent-feedback.json`.
163
+ Tell the human:
155
164
 
156
- 4. If it fails, tell the human and leave the file for manual retry.
165
+ > "I've written skill feedback to `intent-feedback.md`. To submit it,
166
+ > open an issue at https://github.com/[owner/repo]/issues and paste the
167
+ > contents."
@@ -47,6 +47,10 @@ You will receive:
47
47
  If the maintainer uses a custom skills root, replace `skills/` in any paths
48
48
  below with their chosen directory.
49
49
 
50
+ **Monorepo:** When the skill tree entry has a `package` field, write the
51
+ SKILL.md into that package's skills directory (e.g.
52
+ `packages/client/skills/core/SKILL.md`), not a shared root.
53
+
50
54
  1. **Skill name** — format `library-group/skill-name` (e.g. `tanstack-query/core`,
51
55
  `tanstack-router/loaders`, `db/core/live-queries`)
52
56
  2. **Skill description** — what the skill covers and when an agent should load it
@@ -77,6 +81,11 @@ skill-tree-generator for the full spec of each type.
77
81
 
78
82
  ## Step 2 — Extract content from sources
79
83
 
84
+ **Line budget:** Each SKILL.md must stay under 500 lines. Before writing,
85
+ estimate the content size. If a skill has 5+ failure modes, 3+ primary
86
+ patterns, and subsystem details, proactively plan reference files during
87
+ extraction — don't wait until the skill exceeds the limit.
88
+
80
89
  Read through the source documentation. Extract only what a coding agent
81
90
  cannot already know:
82
91
 
@@ -67,7 +67,7 @@ discovery. This produces lower-fidelity output than the full
67
67
  skill-domain-discovery skill — prefer running that when time permits.
68
68
 
69
69
  1. Build a concept inventory (every export, config key, constraint, warning)
70
- 2. Group into 4–7 capability domains using work-oriented names
70
+ 2. Group into capability domains using work-oriented names (let library complexity drive the count — 2–3 for focused libraries, more for large frameworks)
71
71
  3. Enumerate 10–20 task-focused skills from the intersection of domains
72
72
  and developer tasks
73
73
  4. Extract 3+ failure modes per skill (plausible, silent, grounded)
@@ -106,6 +106,7 @@ skills:
106
106
  type: 'core | sub-skill | framework | lifecycle | composition | security'
107
107
  domain: '[domain slug]'
108
108
  path: 'skills/[path]/SKILL.md'
109
+ package: '[package directory, e.g. packages/client]' # monorepo only — which package this skill belongs to
109
110
  description: '[1–2 sentence agent-facing routing key]'
110
111
  requires:
111
112
  - '[other skill slugs]' # omit if none
@@ -118,6 +119,11 @@ skills:
118
119
  - 'references/[file].md' # omit if none
119
120
  ```
120
121
 
122
+ **Monorepo layout:** For monorepos, each skill's `path` is relative to its
123
+ package directory (e.g. `packages/client/skills/core/SKILL.md`). Set the
124
+ `package` field so generate-skill knows where to write the file. The domain
125
+ map artifacts stay at the repo root.
126
+
121
127
  ### Step 1 — Plan the file tree
122
128
 
123
129
  From the domain map, each entry in the `skills` list becomes a SKILL.md
@@ -514,10 +520,18 @@ See also: [lib]-core/[other-domain]/SKILL.md § Common Mistakes
514
520
  The cross-reference ensures agents that load one skill are pointed
515
521
  toward the related skill where the other side of the tension lives.
516
522
 
523
+ Also check the domain map's `cross_references` section for non-tension
524
+ relationships between skills. For each cross-reference, add a "See also"
525
+ line at the end of the relevant skill's body:
526
+
527
+ ```markdown
528
+ See also: [other-skill]/SKILL.md — [reason]
529
+ ```
530
+
517
531
  ### Step 6 — Write composition skills (if applicable)
518
532
 
519
533
  Use the `compositions` entries from `domain_map.yaml` (populated during
520
- skill-domain-discovery Phase 2h) to identify which composition skills
534
+ skill-domain-discovery Phase 3h) to identify which composition skills
521
535
  to produce.
522
536
 
523
537
  Composition skills cover how two or more libraries work together. These
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/intent",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "Ship compositional knowledge for AI coding agents alongside your npm packages",
5
5
  "license": "MIT",
6
6
  "type": "module",