Skip to content

Commit 644bcb3

Browse files
feat: add @tanstack/intent agent skills (#377)
* feat: add @tanstack/intent agent skills for all packages Scaffold agent-readable SKILL.md files via @tanstack/intent for AI coding agents (Claude Code, Cursor, Copilot, etc.) to generate better code when working with TanStack Devtools. Skills added (9 total across 4 packages): - devtools: app-setup, plugin-panel, production, marketplace - event-bus-client: event-client, instrumentation, bidirectional - devtools-vite: vite-plugin - devtools-utils: framework-adapters (React, Vue, Solid, Preact) Also includes: - CI workflows for skill validation, staleness checks, and intent notifications - Domain map, skill spec, and skill tree artifacts - Intent CLI bin shim and package.json wiring - README note for AI agent users * ci: apply automated fixes * ci: apply automated fixes (attempt 2/3) * chore: add changeset for intent skills * ci: apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 654dca5 commit 644bcb3

File tree

26 files changed

+6721
-46
lines changed

26 files changed

+6721
-46
lines changed

.changeset/add-intent-skills.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@tanstack/devtools': patch
3+
'@tanstack/devtools-event-client': patch
4+
'@tanstack/devtools-vite': patch
5+
'@tanstack/devtools-utils': patch
6+
---
7+
8+
Add @tanstack/intent agent skills for AI coding agents

.github/workflows/check-skills.yml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# check-skills.yml — Drop this into your library repo's .github/workflows/
2+
#
3+
# Checks for stale intent skills after a release and opens a review PR
4+
# if any skills need attention. The PR body includes a prompt you can
5+
# paste into Claude Code, Cursor, or any coding agent to update them.
6+
#
7+
# Triggers: new release published, or manual workflow_dispatch.
8+
#
9+
# Template variables (replaced by `intent setup`):
10+
# @tanstack/devtools — e.g. @tanstack/query
11+
12+
name: Check Skills
13+
14+
on:
15+
release:
16+
types: [published]
17+
workflow_dispatch: {}
18+
19+
permissions:
20+
contents: write
21+
pull-requests: write
22+
23+
jobs:
24+
check:
25+
name: Check for stale skills
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Setup Node
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: 20
37+
38+
- name: Install intent
39+
run: npm install -g @tanstack/intent
40+
41+
- name: Check staleness
42+
id: stale
43+
run: |
44+
OUTPUT=$(npx @tanstack/intent stale --json 2>&1) || true
45+
echo "$OUTPUT"
46+
47+
# Check if any skills need review
48+
NEEDS_REVIEW=$(echo "$OUTPUT" | node -e "
49+
const input = require('fs').readFileSync('/dev/stdin','utf8');
50+
try {
51+
const reports = JSON.parse(input);
52+
const stale = reports.flatMap(r =>
53+
r.skills.filter(s => s.needsReview).map(s => ({ library: r.library, skill: s.name, reasons: s.reasons }))
54+
);
55+
if (stale.length > 0) {
56+
console.log(JSON.stringify(stale));
57+
}
58+
} catch {}
59+
")
60+
61+
if [ -z "$NEEDS_REVIEW" ]; then
62+
echo "has_stale=false" >> "$GITHUB_OUTPUT"
63+
else
64+
echo "has_stale=true" >> "$GITHUB_OUTPUT"
65+
# Escape for multiline GH output
66+
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
67+
echo "stale_json<<$EOF" >> "$GITHUB_OUTPUT"
68+
echo "$NEEDS_REVIEW" >> "$GITHUB_OUTPUT"
69+
echo "$EOF" >> "$GITHUB_OUTPUT"
70+
fi
71+
72+
- name: Build summary
73+
if: steps.stale.outputs.has_stale == 'true'
74+
id: summary
75+
run: |
76+
node -e "
77+
const stale = JSON.parse(process.env.STALE_JSON);
78+
const lines = stale.map(s =>
79+
'- **' + s.skill + '** (' + s.library + '): ' + s.reasons.join(', ')
80+
);
81+
const summary = lines.join('\n');
82+
83+
const prompt = [
84+
'Review and update the following stale intent skills for @tanstack/devtools:',
85+
'',
86+
...stale.map(s => '- ' + s.skill + ': ' + s.reasons.join(', ')),
87+
'',
88+
'For each stale skill:',
89+
'1. Read the current SKILL.md file',
90+
'2. Check what changed in the library since the skill was last updated',
91+
'3. Update the skill content to reflect current APIs and behavior',
92+
'4. Run \`npx @tanstack/intent validate\` to verify the updated skill',
93+
].join('\n');
94+
95+
// Write outputs
96+
const fs = require('fs');
97+
const env = fs.readFileSync(process.env.GITHUB_OUTPUT, 'utf8');
98+
const eof = require('crypto').randomBytes(15).toString('base64');
99+
fs.appendFileSync(process.env.GITHUB_OUTPUT,
100+
'summary<<' + eof + '\n' + summary + '\n' + eof + '\n' +
101+
'prompt<<' + eof + '\n' + prompt + '\n' + eof + '\n'
102+
);
103+
"
104+
env:
105+
STALE_JSON: ${{ steps.stale.outputs.stale_json }}
106+
107+
- name: Open review PR
108+
if: steps.stale.outputs.has_stale == 'true'
109+
env:
110+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111+
run: |
112+
VERSION="${{ github.event.release.tag_name || 'manual' }}"
113+
BRANCH="skills/review-${VERSION}"
114+
115+
git config user.name "github-actions[bot]"
116+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
117+
git checkout -b "$BRANCH"
118+
git commit --allow-empty -m "chore: review stale skills for ${VERSION}"
119+
git push origin "$BRANCH"
120+
121+
gh pr create \
122+
--title "Review stale skills (${VERSION})" \
123+
--body "$(cat <<'PREOF'
124+
## Stale Skills Detected
125+
126+
The following skills may need updates after the latest release:
127+
128+
${{ steps.summary.outputs.summary }}
129+
130+
---
131+
132+
### Update Prompt
133+
134+
Paste this into your coding agent (Claude Code, Cursor, etc.):
135+
136+
~~~
137+
${{ steps.summary.outputs.prompt }}
138+
~~~
139+
140+
PREOF
141+
)" \
142+
--head "$BRANCH" \
143+
--base main
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# notify-intent.yml — Drop this into your library repo's .github/workflows/
2+
#
3+
# Fires a repository_dispatch event to TanStack/intent whenever docs or
4+
# source files change on merge to main. This triggers the skill staleness
5+
# check workflow in the intent repo.
6+
#
7+
# Requirements:
8+
# - A fine-grained PAT with contents:write on TanStack/intent stored
9+
# as the INTENT_NOTIFY_TOKEN repository secret.
10+
#
11+
# Template variables (replaced by `intent setup`):
12+
# @tanstack/devtools
13+
# docs/**
14+
# packages/*/src/**
15+
16+
name: Notify Intent
17+
18+
on:
19+
push:
20+
branches: [main]
21+
paths:
22+
- 'docs/**'
23+
- 'packages/*/src/**'
24+
25+
jobs:
26+
notify:
27+
name: Notify TanStack Intent
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 2
34+
35+
- name: Collect changed files
36+
id: changes
37+
run: |
38+
FILES=$(git diff --name-only HEAD~1 HEAD | jq -R -s -c 'split("\n") | map(select(length > 0))')
39+
echo "files=$FILES" >> "$GITHUB_OUTPUT"
40+
41+
- name: Dispatch to intent repo
42+
uses: peter-evans/repository-dispatch@v3
43+
with:
44+
token: ${{ secrets.INTENT_NOTIFY_TOKEN }}
45+
repository: TanStack/intent
46+
event-type: skill-check
47+
client-payload: |
48+
{
49+
"package": "@tanstack/devtools",
50+
"sha": "${{ github.sha }}",
51+
"changed_files": ${{ steps.changes.outputs.files }}
52+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# validate-skills.yml — Drop this into your library repo's .github/workflows/
2+
#
3+
# Validates skill files on PRs that touch the skills/ directory.
4+
# Ensures frontmatter is correct, names match paths, and files stay under
5+
# the 500-line limit.
6+
7+
name: Validate Skills
8+
9+
on:
10+
pull_request:
11+
paths:
12+
- 'skills/**'
13+
- '**/skills/**'
14+
15+
jobs:
16+
validate:
17+
name: Validate skill files
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: 20
27+
28+
- name: Install intent CLI
29+
run: npm install -g @tanstack/intent
30+
31+
- name: Find and validate skills
32+
run: |
33+
# Find all directories containing SKILL.md files
34+
SKILLS_DIR=""
35+
if [ -d "skills" ]; then
36+
SKILLS_DIR="skills"
37+
elif [ -d "packages" ]; then
38+
# Monorepo — find skills/ under packages
39+
for dir in packages/*/skills; do
40+
if [ -d "$dir" ]; then
41+
echo "Validating $dir..."
42+
intent validate "$dir"
43+
fi
44+
done
45+
exit 0
46+
fi
47+
48+
if [ -n "$SKILLS_DIR" ]; then
49+
intent validate "$SKILLS_DIR"
50+
else
51+
echo "No skills/ directory found — skipping validation."
52+
fi

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ A debugging toolkit that provides a unified interface for inspecting, monitoring
4444

4545
### <a href="https://tanstack.com/devtools">Read the docs →</b></a>
4646

47+
## AI Agent Support
48+
49+
If you use an AI coding agent (Claude Code, Cursor, Copilot, etc.), install the TanStack Devtools skills for better code generation:
50+
51+
```sh
52+
npx @tanstack/intent@latest install
53+
```
54+
4755
## Get Involved
4856

4957
- We welcome issues and pull requests!

0 commit comments

Comments
 (0)