Open History to see the last commit
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/cli — e.g. @tanstack/query
11
12name: Check Skills
13
14on:
15 release:
16 types: [published]
17 workflow_dispatch: {}
18
19permissions: {}
20
21jobs:
22 check:
23 name: Check for stale skills
24 runs-on: ubuntu-latest
25 permissions:
26 contents: write
27 pull-requests: write
28 steps:
29 - name: Checkout
30 uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
31 with:
32 fetch-depth: 0
33 persist-credentials: true # review job pushes a generated branch
34
35 - name: Setup Node
36 uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
37 with:
38 node-version: 20
39
40 - name: Install intent
41 run: npm install -g @tanstack/intent
42
43 - name: Check staleness
44 id: stale
45 run: |
46 OUTPUT=$(npx @tanstack/intent stale --json 2>&1) || true
47 echo "$OUTPUT"
48
49 # Check if any skills need review
50 NEEDS_REVIEW=$(echo "$OUTPUT" | node -e "
51 const input = require('fs').readFileSync('/dev/stdin','utf8');
52 try {
53 const reports = JSON.parse(input);
54 const stale = reports.flatMap(r =>
55 r.skills.filter(s => s.needsReview).map(s => ({ library: r.library, skill: s.name, reasons: s.reasons }))
56 );
57 if (stale.length > 0) {
58 console.log(JSON.stringify(stale));
59 }
60 } catch {}
61 ")
62
63 if [ -z "$NEEDS_REVIEW" ]; then
64 echo "has_stale=false" >> "$GITHUB_OUTPUT"
65 else
66 echo "has_stale=true" >> "$GITHUB_OUTPUT"
67 # Escape for multiline GH output
68 EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
69 echo "stale_json<<$EOF" >> "$GITHUB_OUTPUT"
70 echo "$NEEDS_REVIEW" >> "$GITHUB_OUTPUT"
71 echo "$EOF" >> "$GITHUB_OUTPUT"
72 fi
73
74 - name: Build summary
75 if: steps.stale.outputs.has_stale == 'true'
76 id: summary
77 run: |
78 node -e "
79 const stale = JSON.parse(process.env.STALE_JSON);
80 const lines = stale.map(s =>
81 '- **' + s.skill + '** (' + s.library + '): ' + s.reasons.join(', ')
82 );
83 const summary = lines.join('\n');
84
85 const prompt = [
86 'Review and update the following stale intent skills for @tanstack/cli:',
87 '',
88 ...stale.map(s => '- ' + s.skill + ': ' + s.reasons.join(', ')),
89 '',
90 'For each stale skill:',
91 '1. Read the current SKILL.md file',
92 '2. Check what changed in the library since the skill was last updated',
93 '3. Update the skill content to reflect current APIs and behavior',
94 '4. Run \`npx @tanstack/intent validate\` to verify the updated skill',
95 ].join('\n');
96
97 // Write outputs
98 const fs = require('fs');
99 const env = fs.readFileSync(process.env.GITHUB_OUTPUT, 'utf8');
100 const eof = require('crypto').randomBytes(15).toString('base64');
101 fs.appendFileSync(process.env.GITHUB_OUTPUT,
102 'summary<<' + eof + '\n' + summary + '\n' + eof + '\n' +
103 'prompt<<' + eof + '\n' + prompt + '\n' + eof + '\n'
104 );
105 "
106 env:
107 STALE_JSON: ${{ steps.stale.outputs.stale_json }}
108
109 - name: Open review PR
110 if: steps.stale.outputs.has_stale == 'true'
111 env:
112 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113 PROMPT: ${{ steps.summary.outputs.prompt }}
114 RELEASE_VERSION: ${{ github.event.release.tag_name || 'manual' }}
115 SUMMARY: ${{ steps.summary.outputs.summary }}
116 run: |
117 VERSION="$RELEASE_VERSION"
118 BRANCH="skills/review-${VERSION}"
119
120 git config user.name "github-actions[bot]"
121 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
122 git checkout -b "$BRANCH"
123 git commit --allow-empty -m "chore: review stale skills for ${VERSION}"
124 git push origin "$BRANCH"
125
126 {
127 printf '%s\n\n' '## Stale Skills Detected'
128 printf '%s\n\n' 'The following skills may need updates after the latest release:'
129 printf '%s\n\n' "$SUMMARY"
130 printf '%s\n\n' '---'
131 printf '%s\n\n' '### Update Prompt'
132 printf '%s\n\n' 'Paste this into your coding agent (Claude Code, Cursor, etc.):'
133 printf '%s\n' '~~~'
134 printf '%s\n' "$PROMPT"
135 printf '%s\n' '~~~'
136 } > pr-body.md
137
138 gh pr create \
139 --title "Review stale skills (${VERSION})" \
140 --body-file pr-body.md \
141 --head "$BRANCH" \
142 --base main