feat(ai-skills): a harness plugin that makes each skill a slash command #1756
feat/harness-core fromrefs/pull/1756/head·merged by AlemTuzlak View on GitHubWith this PR, a harness can use a folder of SKILL.md skills. The new skills({ dirs }) plugin in @tanstack/ai-skills/harness gives the harness model the list of skills, and it makes each skill a /<name> command. A skill that you add, change, or remove while the session runs changes the commands at once.
This PR targets the core harness PR #1755 (feat/harness-core), not main. It is split out of #1555.
🎯 Changes#
Source (packages/ai-skills):
src/harness.ts: theskills({ dirs, reserved, ...withSkillsOptions })plugin, ported from #1555./<name> [task]starts a turn: "Use the skill: ".- A skill whose name another command has, or a
reservedname, gets/skill:<name>./skillslists every skill, its folder, and its command. - The plugin watches the folders, and it syncs the commands again at the start of each turn.
- Over
maxCatalogTokens, the called skills and the earlier folders stay in the model's list.
./harnesssubpath export, avite.config.tsentry, and@tanstack/ai-harnessas an optional peer dependency (plus a dev dependency).middleware.tsexportsestimateTokens, so the plugin counts tokens the same way aswithSkills.
Changes from #1555 (from the code review):
- A skill command runs its turn through the command's own
session, so the turn runs as the user who ran the command. #1555 used the setup-time session. - With your own
renderCatalogorinstructionTemplate, the trim counts the catalog thatwithSkillsrenders. #1555 always counted the short catalog, so the trimmed list could still go over the cap and fail each turn. - Your options go first, then the plugin defaults. A pass-through
onLimitExceeded: undefinedno longer removes the trim. - A folder that throws at once (not only a rejected
list()) gives no skills. It no longer fails the scan of all folders. - One duplicate watcher-error test is removed.
Not changed (decisions):
- No
read_skill_resourcetool from the plugin.createResourceTooldoes not takerequireApproval, so adding it here would skip the approval thatwithSkills({ requireApproval })promises. Same as #1555. - No E2E spec. The plugin reads skill folders from the disk and watches them. The unit tests drive a real
createHarnessHostsession with a fake adapter, which covers the commands, the turn text, and theload_skillcall. - No edge support. The plugin reads and watches the folders with
node:fs, so it runs on Node.js only. The docs page says that it does not work on Cloudflare Workers.
Docs. New page docs/harness/skills.md ("Add skills", addedAt 2026-10-13), a link from the "Change commands while the session runs" section of docs/harness/plugins.md, and a docs/config.json entry. The page says that the plugin needs node:fs and does not work on Cloudflare Workers. Readers: agent builders on @tanstack/ai-harness. Tone: matches the existing pages. The sample uses gpt-6.1-sol.
Changeset. @tanstack/ai-skills minor. The ctx.commands API that the plugin uses is already in the core harness PR, so @tanstack/ai-harness has no changeset here.
✅ Checklist#
- I have followed the steps in the Contributing guide.
- I have tested code changes locally with
pnpm run test:pr, or these tests do not apply to this pull request. - I fully understand the code in this pull request, including any code generated with AI assistance.
- Docs: I updated
docs/for this change, or this change is not user-facing. - Changeset: I added a changeset (
pnpm changeset), or this PR does not change a published package.
🚀 Release Impact#
- This change affects published code, and I have generated a changeset.
- This change is docs/CI/dev-only (no release).
Testing#
Commands run. Only pnpm install (lockfile) and pnpm format. No local tests, per the maintainer's instruction. CI is the first signal.
Manual test.
- Make a folder
./.agents/skills/hello/with aSKILL.md(namehello, a description). - Add
skills({ dirs: ['./.agents/skills'] })topluginsof adefineHarness. - Open a session and run
/skills. It lists/hello. - Run
/hello say hi. The turn text is "Use the hello skill: say hi". - Add a second skill folder while the session runs. Its command shows after about 200 ms.
How this PR makes testing easy. packages/ai-skills/tests/harness.test.ts (16 cases) runs the plugin in a real harness host with temp folders and a fake adapter.
Risk / rollback#
Low. The plugin is a new opt-in subpath. Revert the PR to remove it.
Public API change#
Before: no harness plugin for skills.
After
import { skills } from '@tanstack/ai-skills/harness'
defineHarness({
name: 'acme/agent',
adapter,
plugins: () => [skills({ dirs: ['./.agents/skills'] })],
})
🤖 Generated with Claude Code
- 1
Important
Review skipped#
Auto reviews are disabled on base/target branches other than the default branch.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
-
- Configuration used: Repository: TanStack/ai/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
bdac8db7-9a1a-4dec-806e-e6447f0d78d2
You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- 🔍 Trigger review
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment `@coderabbitai help` to get the list of available commands.-
View your CI Pipeline Execution ↗ for commit e5dfe5ac26e7ab8cb1f1683b6c296d7546d1d69c
Command Status Duration Result nx affected --targets=test:sherif,test:knip,tes...✅ Succeeded 53s View ↗ nx run-many --targets=test:coverage --projects=...✅ Succeeded 2s View ↗ nx run-many --targets=build --exclude=examples/...✅ Succeeded 2s View ↗
☁️ Nx Cloud last updated this comment at
2026-10-14 11:34:32UTC@tanstack/ai
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai@1756@tanstack/ai-acp
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-acp@1756@tanstack/ai-angular
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-angular@1756@tanstack/ai-anthropic
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-anthropic@1756@tanstack/ai-bedrock
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-bedrock@1756@tanstack/ai-byteplus
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-byteplus@1756@tanstack/ai-claude-code
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-claude-code@1756@tanstack/ai-client
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-client@1756@tanstack/ai-cloudflare
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-cloudflare@1756@tanstack/ai-code-mode
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-code-mode@1756@tanstack/ai-code-mode-snippets
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-code-mode-snippets@1756@tanstack/ai-codex
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-codex@1756@tanstack/ai-cohere
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-cohere@1756@tanstack/ai-compaction
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-compaction@1756@tanstack/ai-devtools-core
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-devtools-core@1756@tanstack/ai-durable-stream
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-durable-stream@1756@tanstack/ai-elevenlabs
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-elevenlabs@1756@tanstack/ai-event-client
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-event-client@1756@tanstack/ai-fal
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-fal@1756@tanstack/ai-gemini
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-gemini@1756@tanstack/ai-grok
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-grok@1756@tanstack/ai-grok-build
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-grok-build@1756@tanstack/ai-groq
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-groq@1756@tanstack/ai-harness
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-harness@1756@tanstack/ai-isolate-cloudflare
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-cloudflare@1756@tanstack/ai-isolate-daytona
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-daytona@1756@tanstack/ai-isolate-e2b
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-e2b@1756@tanstack/ai-isolate-node
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-node@1756@tanstack/ai-isolate-quickjs
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-quickjs@1756@tanstack/ai-isolate-quickjs-bun
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-quickjs-bun@1756@tanstack/ai-llmgateway
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-llmgateway@1756@tanstack/ai-lovable
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-lovable@1756@tanstack/ai-mcp
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-mcp@1756@tanstack/ai-memory
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-memory@1756@tanstack/ai-mistral
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-mistral@1756@tanstack/ai-octane
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-octane@1756@tanstack/ai-ollama
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-ollama@1756@tanstack/ai-ollaya
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-ollaya@1756@tanstack/ai-openai
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-openai@1756@tanstack/ai-opencode
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-opencode@1756@tanstack/ai-openrouter
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-openrouter@1756@tanstack/ai-perplexity
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-perplexity@1756@tanstack/ai-persistence
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-persistence@1756@tanstack/ai-preact
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-preact@1756@tanstack/ai-react
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-react@1756@tanstack/ai-react-ui
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-react-ui@1756@tanstack/ai-reactor
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-reactor@1756@tanstack/ai-remix
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-remix@1756@tanstack/ai-sandbox
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox@1756@tanstack/ai-sandbox-blaxel
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-blaxel@1756@tanstack/ai-sandbox-boxd
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-boxd@1756@tanstack/ai-sandbox-cloudflare
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-cloudflare@1756@tanstack/ai-sandbox-daytona
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-daytona@1756@tanstack/ai-sandbox-docker
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-docker@1756@tanstack/ai-sandbox-e2b
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-e2b@1756@tanstack/ai-sandbox-local-process
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-local-process@1756@tanstack/ai-sandbox-railway
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-railway@1756@tanstack/ai-sandbox-sprites
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-sprites@1756@tanstack/ai-sandbox-upstash-box
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-upstash-box@1756@tanstack/ai-sandbox-vercel
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-vercel@1756@tanstack/ai-skills
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-skills@1756@tanstack/ai-solid
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-solid@1756@tanstack/ai-solid-ui
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-solid-ui@1756@tanstack/ai-svelte
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-svelte@1756@tanstack/ai-typesafe
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-typesafe@1756@tanstack/ai-utils
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-utils@1756@tanstack/ai-vercel-gateway
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vercel-gateway@1756@tanstack/ai-vertex
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vertex@1756@tanstack/ai-vue
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vue@1756@tanstack/ai-vue-ui
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vue-ui@1756@tanstack/ai-worldlabs
npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-worldlabs@1756@tanstack/openai-base
npm i https://pkg.pr.new/TanStack/ai/@tanstack/openai-base@1756@tanstack/preact-ai-devtools
npm i https://pkg.pr.new/TanStack/ai/@tanstack/preact-ai-devtools@1756@tanstack/react-ai-devtools
npm i https://pkg.pr.new/TanStack/ai/@tanstack/react-ai-devtools@1756@tanstack/solid-ai-devtools
npm i https://pkg.pr.new/TanStack/ai/@tanstack/solid-ai-devtools@1756@tanstack/svelte-ai-devtools
npm i https://pkg.pr.new/TanStack/ai/@tanstack/svelte-ai-devtools@1756commit:
e5dfe5aCoverage#
✅ Coverage held across 69 compared package(s).
Each package is measured twice in this job — on this PR and on its merge-base with
main— and compared. A metric fails only when it is at or above 60% on the merge-base and under 60% on this PR. Other drops are listed but do not fail. Packages your PR doesn't affect are not measured and not listed.package statements branches functions lines ai 91.50% (0.00) 85.17% (0.00) 92.19% (0.00) 93.07% (0.00) ok ai-acp 78.41% (0.00) 66.79% (0.00) 70.27% (0.00) 80.13% (0.00) ok ai-angular 73.37% (0.00) 60.66% (0.00) 62.14% (0.00) 75.13% (0.00) ok ai-anthropic 91.60% (0.00) 86.24% (0.00) 95.57% (0.00) 91.99% (0.00) ok ai-bedrock 90.10% (0.00) 82.82% (0.00) 94.20% (0.00) 91.32% (0.00) ok ai-byteplus 97.06% (0.00) 91.66% (0.00) 98.27% (0.00) 98.49% (0.00) ok ai-claude-code 88.93% (0.00) 76.88% (0.00) 86.88% (0.00) 90.40% (0.00) ok ai-client 86.47% (0.00) 79.23% (0.00) 84.62% (0.00) 88.41% (0.00) ok ai-cloudflare 85.55% (0.00) 76.44% (0.00) 85.48% (0.00) 86.79% (0.00) ok ai-code-mode 91.71% (0.00) 83.12% (0.00) 86.27% (0.00) 92.63% (0.00) ok ai-code-mode-snippets 87.13% (0.00) 75.67% (0.00) 91.11% (0.00) 88.39% (0.00) ok ai-codex 94.55% (0.00) 85.10% (0.00) 89.28% (0.00) 95.56% (0.00) ok ai-cohere 88.97% (0.00) 88.37% (0.00) 85.71% (0.00) 91.80% (0.00) ok ai-compaction 97.38% (0.00) 92.75% (0.00) 100.00% (0.00) 98.88% (0.00) ok ai-devtools 83.13% (0.00) 72.77% (0.00) 87.07% (0.00) 85.22% (0.00) ok ai-durable-stream 86.70% (0.00) 82.25% (0.00) 92.30% (0.00) 88.72% (0.00) ok ai-elevenlabs 74.68% (0.00) 69.59% (0.00) 59.13% (0.00) 75.46% (0.00) ok ai-event-client 56.83% (0.00) 46.87% (0.00) 68.96% (0.00) 57.89% (0.00) ok ai-fal 91.10% (0.00) 82.63% (0.00) 92.40% (0.00) 91.60% (0.00) ok ai-gemini 68.09% (0.00) 67.44% (0.00) 64.36% (0.00) 68.79% (0.00) ok ai-grok 48.85% (0.00) 53.49% (0.00) 56.46% (0.00) 49.67% (0.00) ok ai-grok-build 79.19% (0.00) 63.56% (0.00) 77.39% (0.00) 81.02% (0.00) ok ai-groq 51.31% (0.00) 47.17% (0.00) 65.11% (0.00) 53.42% (0.00) ok ai-harness 91.10% (0.00) 86.31% (0.00) 91.17% (0.00) 92.64% (0.00) ok ai-isolate-cloudflare 94.11% (0.00) 70.66% (0.00) 100.00% (0.00) 93.96% (0.00) ok ai-isolate-daytona 90.25% (0.00) 80.59% (0.00) 100.00% (0.00) 90.15% (0.00) ok ai-isolate-e2b 92.11% (0.00) 81.48% (0.00) 97.36% (0.00) 95.05% (0.00) ok ai-isolate-node 84.00% (0.00) 43.39% (0.00) 100.00% (0.00) 83.78% (0.00) ok ai-isolate-quickjs 89.07% (0.00) 76.41% (0.00) 90.90% (0.00) 90.30% (0.00) ok ai-isolate-quickjs-bun 7.76% (0.00) 8.08% (0.00) 5.00% (0.00) 8.33% (0.00) ok ai-llmgateway 97.67% (0.00) 100.00% (0.00) 88.88% (0.00) 97.67% (0.00) ok ai-lovable 73.21% (0.00) 55.63% (0.00) 85.07% (0.00) 73.96% (0.00) ok ai-mcp 96.91% (0.00) 92.43% (0.00) 97.33% (0.00) 98.72% (0.00) ok ai-memory 73.87% (0.00) 52.70% (0.00) 79.74% (0.00) 76.04% (0.00) ok ai-mistral 84.99% (0.00) 79.97% (0.00) 92.59% (0.00) 85.64% (0.00) ok ai-octane 90.58% (0.00) 71.48% (0.00) 87.29% (0.00) 91.24% (0.00) ok ai-ollama 91.76% (0.00) 76.47% (0.00) 90.62% (0.00) 91.71% (0.00) ok ai-ollaya 86.84% (0.00) 89.28% (0.00) 85.71% (0.00) 91.66% (0.00) ok ai-openai 65.34% (0.00) 65.72% (0.00) 66.66% (0.00) 65.63% (0.00) ok ai-opencode 68.77% (0.00) 60.82% (0.00) 64.04% (0.00) 70.78% (0.00) ok ai-openrouter 86.71% (0.00) 71.88% (0.00) 90.52% (0.00) 88.65% (0.00) ok ai-perplexity 91.34% (0.00) 90.43% (0.00) 100.00% (0.00) 93.87% (0.00) ok ai-persistence 91.82% (0.00) 80.90% (0.00) 97.97% (0.00) 95.64% (0.00) ok ai-preact 87.80% (0.00) 75.87% (0.00) 88.73% (0.00) 89.66% (0.00) ok ai-react 73.13% (0.00) 52.16% (0.00) 75.54% (0.00) 73.08% (0.00) ok ai-reactor 94.91% (0.00) 83.33% (0.00) 93.33% (0.00) 96.55% (0.00) ok ai-remix 39.39% (0.00) 23.35% (0.00) 35.51% (0.00) 41.58% (0.00) ok ai-sandbox 77.45% (0.00) 82.80% (0.00) 74.47% (0.00) 77.97% (0.00) ok ai-sandbox-blaxel 87.64% (0.00) 77.18% (0.00) 82.26% (0.00) 89.71% (0.00) ok ai-sandbox-boxd 95.86% (0.00) 87.12% (0.00) 95.31% (0.00) 98.17% (0.00) ok ai-sandbox-cloudflare 67.91% (0.00) 57.47% (0.00) 71.79% (0.00) 69.62% (0.00) ok ai-sandbox-daytona 82.70% (0.00) 81.89% (0.00) 67.14% (0.00) 85.18% (0.00) ok ai-sandbox-docker 80.15% (0.00) 71.49% (0.00) 77.38% (0.00) 82.13% (0.00) ok ai-sandbox-e2b 94.42% (0.00) 88.97% (0.00) 93.24% (0.00) 98.63% (0.00) ok ai-sandbox-local-process 68.00% (0.00) 53.59% (0.00) 75.86% (0.00) 68.88% (0.00) ok ai-sandbox-railway 94.75% (0.00) 92.68% (0.00) 90.90% (0.00) 97.59% (0.00) ok ai-sandbox-sprites 73.23% (0.00) 59.70% (0.00) 73.83% (0.00) 76.17% (0.00) ok ai-sandbox-upstash-box 94.82% (0.00) 91.52% (0.00) 91.04% (0.00) 97.76% (0.00) ok ai-sandbox-vercel 44.67% (0.00) 38.18% (0.00) 35.18% (0.00) 45.76% (0.00) ok ai-skills 83.35% (+2.97) 67.70% (+3.65) 87.23% (+2.37) 85.35% (+2.91) ok ai-solid 53.73% (0.00) 40.45% (0.00) 51.94% (0.00) 57.78% (0.00) ok ai-svelte 70.44% (0.00) 54.50% (0.00) 69.86% (0.00) 75.99% (0.00) ok ai-typesafe 78.04% (0.00) 84.61% (0.00) 66.66% (0.00) 82.05% (0.00) ok ai-utils 76.38% (0.00) 74.00% (0.00) 92.30% (0.00) 76.56% (0.00) ok ai-vercel-gateway 75.97% (0.00) 55.63% (0.00) 85.41% (0.00) 79.38% (0.00) ok ai-vertex 96.77% (0.00) 97.22% (0.00) 100.00% (0.00) 96.77% (0.00) ok ai-vue 60.70% (0.00) 36.17% (0.00) 62.00% (0.00) 62.95% (0.00) ok ai-worldlabs 79.62% (0.00) 71.50% (0.00) 91.42% (0.00) 82.66% (0.00) ok openai-base 89.12% (0.00) 77.14% (0.00) 97.57% (0.00) 91.15% (0.00) ok github-actions[bot](GitHub profile, opens in a new tab) assignedtombeckenham
github-actions[bot](GitHub profile, opens in a new tab) added labelswaiting-on: maintainer
AlemTuzlak reviewed
approved
AlemTuzlak merged this47ea57a
AlemTuzlak closed this
Sign in to join this conversation.
🦋 Changeset detected#
Latest commit: e5dfe5ac26e7ab8cb1f1683b6c296d7546d1d69c
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR