Skip to content
Latchkey

Check Skills workflow (trpc/trpc)

The Check Skills workflow from trpc/trpc, explained and optimized by Latchkey.

C

CI health: C - fair

Point runs-on at Latchkey and get caching, job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: trpc/trpc.github/workflows/check-skills.ymlLicense MITView source

What it does

This is the Check Skills workflow from the trpc/trpc repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
# check-skills.yml - Drop this into your library repo's .github/workflows/
#
# Checks for stale intent skills after a release and opens a review PR
# if any skills need attention. The PR body includes a prompt you can
# paste into Claude Code, Cursor, or any coding agent to update them.
#
# Triggers: new release published, or manual workflow_dispatch.
#
# Template variables (replaced by `intent setup`):
#   @trpc/trpc - e.g. @tanstack/query or my-workspace workspace

name: Check Skills

on:
  release:
    types: [published]
  workflow_dispatch: {}

permissions:
  contents: write
  pull-requests: write

jobs:
  check:
    name: Check for stale skills
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6
        with:
          fetch-depth: 0

      - name: Setup Node
        uses: actions/setup-node@v6
        with:
          node-version: 20

      - name: Install intent
        run: npm install -g @tanstack/intent

      - name: Check staleness
        id: stale
        run: |
          OUTPUT=$(intent stale --json 2>&1) || true
          echo "$OUTPUT"

          # Check if any skills need review
          NEEDS_REVIEW=$(echo "$OUTPUT" | node -e "
            const input = require('fs').readFileSync('/dev/stdin','utf8');
            try {
              const reports = JSON.parse(input);
              const stale = reports.flatMap(r =>
                r.skills.filter(s => s.needsReview).map(s => ({ library: r.library, skill: s.name, reasons: s.reasons }))
              );
              if (stale.length > 0) {
                console.log(JSON.stringify(stale));
              }
            } catch {}
          ")

          if [ -z "$NEEDS_REVIEW" ]; then
            echo "has_stale=false" >> "$GITHUB_OUTPUT"
          else
            echo "has_stale=true" >> "$GITHUB_OUTPUT"
            # Escape for multiline GH output
            EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
            echo "stale_json<<$EOF" >> "$GITHUB_OUTPUT"
            echo "$NEEDS_REVIEW" >> "$GITHUB_OUTPUT"
            echo "$EOF" >> "$GITHUB_OUTPUT"
          fi

      - name: Build summary
        if: steps.stale.outputs.has_stale == 'true'
        id: summary
        run: |
          node -e "
            const stale = JSON.parse(process.env.STALE_JSON);
            const lines = stale.map(s =>
              '- **' + s.skill + '** (' + s.library + '): ' + s.reasons.join(', ')
            );
            const summary = lines.join('\n');

            const prompt = [
              'Review and update the following stale intent skills for @trpc/trpc:',
              '',
              ...stale.map(s => '- ' + s.skill + ': ' + s.reasons.join(', ')),
              '',
              'For each stale skill:',
              '1. Read the current SKILL.md file',
              '2. Check what changed in the library since the skill was last updated',
              '3. Update the skill content to reflect current APIs and behavior',
              '4. Run \`npx @tanstack/intent validate\` to verify the updated skill',
            ].join('\n');

            // Write outputs
            const fs = require('fs');
            const env = fs.readFileSync(process.env.GITHUB_OUTPUT, 'utf8');
            const eof = require('crypto').randomBytes(15).toString('base64');
            fs.appendFileSync(process.env.GITHUB_OUTPUT,
              'summary<<' + eof + '\n' + summary + '\n' + eof + '\n' +
              'prompt<<' + eof + '\n' + prompt + '\n' + eof + '\n'
            );
          "
        env:
          STALE_JSON: ${{ steps.stale.outputs.stale_json }}

      - name: Open review PR
        if: steps.stale.outputs.has_stale == 'true'
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          VERSION="${{ github.event.release.tag_name || 'manual' }}"
          BRANCH="skills/review-${VERSION}"

          git config user.name "github-actions[bot]"
          git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
          git checkout -b "$BRANCH"
          git commit --allow-empty -m "chore: review stale skills for ${VERSION}"
          git push origin "$BRANCH"

          gh pr create \
            --title "Review stale skills (${VERSION})" \
            --body "$(cat <<'PREOF'
          ## Stale Skills Detected

          The following skills may need updates after the latest release:

          ${{ steps.summary.outputs.summary }}

          ---

          ### Update Prompt

          Paste this into your coding agent (Claude Code, Cursor, etc.):

          ~~~
          ${{ steps.summary.outputs.prompt }}
          ~~~

          PREOF
          )" \
            --head "$BRANCH" \
            --base main

The same workflow, on Latchkey

Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.

# check-skills.yml - Drop this into your library repo's .github/workflows/
#
# Checks for stale intent skills after a release and opens a review PR
# if any skills need attention. The PR body includes a prompt you can
# paste into Claude Code, Cursor, or any coding agent to update them.
#
# Triggers: new release published, or manual workflow_dispatch.
#
# Template variables (replaced by `intent setup`):
#   @trpc/trpc - e.g. @tanstack/query or my-workspace workspace
 
name: Check Skills
 
on:
  release:
    types: [published]
  workflow_dispatch: {}
 
permissions:
  contents: write
  pull-requests: write
 
jobs:
  check:
    timeout-minutes: 30
    name: Check for stale skills
    runs-on: latchkey-small
    steps:
      - name: Checkout
        uses: actions/checkout@v6
        with:
          fetch-depth: 0
 
      - name: Setup Node
        uses: actions/setup-node@v6
        with:
          cache: 'npm'
          node-version: 20
 
      - name: Install intent
        run: npm install -g @tanstack/intent
 
      - name: Check staleness
        id: stale
        run: |
          OUTPUT=$(intent stale --json 2>&1) || true
          echo "$OUTPUT"
 
          # Check if any skills need review
          NEEDS_REVIEW=$(echo "$OUTPUT" | node -e "
            const input = require('fs').readFileSync('/dev/stdin','utf8');
            try {
              const reports = JSON.parse(input);
              const stale = reports.flatMap(r =>
                r.skills.filter(s => s.needsReview).map(s => ({ library: r.library, skill: s.name, reasons: s.reasons }))
              );
              if (stale.length > 0) {
                console.log(JSON.stringify(stale));
              }
            } catch {}
          ")
 
          if [ -z "$NEEDS_REVIEW" ]; then
            echo "has_stale=false" >> "$GITHUB_OUTPUT"
          else
            echo "has_stale=true" >> "$GITHUB_OUTPUT"
            # Escape for multiline GH output
            EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
            echo "stale_json<<$EOF" >> "$GITHUB_OUTPUT"
            echo "$NEEDS_REVIEW" >> "$GITHUB_OUTPUT"
            echo "$EOF" >> "$GITHUB_OUTPUT"
          fi
 
      - name: Build summary
        if: steps.stale.outputs.has_stale == 'true'
        id: summary
        run: |
          node -e "
            const stale = JSON.parse(process.env.STALE_JSON);
            const lines = stale.map(s =>
              '- **' + s.skill + '** (' + s.library + '): ' + s.reasons.join(', ')
            );
            const summary = lines.join('\n');
 
            const prompt = [
              'Review and update the following stale intent skills for @trpc/trpc:',
              '',
              ...stale.map(s => '- ' + s.skill + ': ' + s.reasons.join(', ')),
              '',
              'For each stale skill:',
              '1. Read the current SKILL.md file',
              '2. Check what changed in the library since the skill was last updated',
              '3. Update the skill content to reflect current APIs and behavior',
              '4. Run \`npx @tanstack/intent validate\` to verify the updated skill',
            ].join('\n');
 
            // Write outputs
            const fs = require('fs');
            const env = fs.readFileSync(process.env.GITHUB_OUTPUT, 'utf8');
            const eof = require('crypto').randomBytes(15).toString('base64');
            fs.appendFileSync(process.env.GITHUB_OUTPUT,
              'summary<<' + eof + '\n' + summary + '\n' + eof + '\n' +
              'prompt<<' + eof + '\n' + prompt + '\n' + eof + '\n'
            );
          "
        env:
          STALE_JSON: ${{ steps.stale.outputs.stale_json }}
 
      - name: Open review PR
        if: steps.stale.outputs.has_stale == 'true'
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          VERSION="${{ github.event.release.tag_name || 'manual' }}"
          BRANCH="skills/review-${VERSION}"
 
          git config user.name "github-actions[bot]"
          git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
          git checkout -b "$BRANCH"
          git commit --allow-empty -m "chore: review stale skills for ${VERSION}"
          git push origin "$BRANCH"
 
          gh pr create \
            --title "Review stale skills (${VERSION})" \
            --body "$(cat <<'PREOF'
          ## Stale Skills Detected
 
          The following skills may need updates after the latest release:
 
          ${{ steps.summary.outputs.summary }}
 
          ---
 
          ### Update Prompt
 
          Paste this into your coding agent (Claude Code, Cursor, etc.):
 
          ~~~
          ${{ steps.summary.outputs.prompt }}
          ~~~
 
          PREOF
          )" \
            --head "$BRANCH" \
            --base main
 

What changed

What Latchkey heals here

This workflow has steps that commonly fail on transient issues (network, registries, flaky browsers). On Latchkey managed runners they are detected, retried, and self-healed instead of failing your build:

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow