Skip to main content
You attach a skill to an agent by listing its folder name in the agent’s skills array. Keystroke materializes the attached skills into the agent’s workspace before each prompt runs.

Attach by folder name

The skills option on defineAgent() takes the folder names of skills under src/skills/:
src/agents/support.ts
import { defineAgent } from "@keystrokehq/keystroke/agent";

export default defineAgent({
  slug: "support",
  systemPrompt: "Answer support questions. Use the support skill for policy and tone.",
  model: "anthropic/claude-sonnet-4.6",
  skills: ["support"],
});
For skills: ["support"], Keystroke expects a folder at src/skills/support/ with a SKILL.md. If no such folder exists, the agent fails to build with an “unknown skill” error; the name and the folder must match.

Attach more than one

List as many skills as the agent needs:
skills: ["support", "billing", "escalation"],
Each is materialized into the workspace under its own folder, so they don’t collide.

Where skills land at runtime

Attached skills are written into the agent’s workspace at /workspace/agent/skills/{slug}/ before the prompt runs. The agent reads them like local files, opening SKILL.md first and pulling in references/ on demand. Seeding is idempotent: the files are written once per session and the agent’s own edits during a run are preserved. Because skills live under /workspace, you can reference them from the systemPrompt by path if you want to be explicit:
systemPrompt: "Read /workspace/agent/skills/support/SKILL.md before replying.",

Skills and files together

An agent can use both skills and files. Skills give it instructions it loads on demand; files give it context documents to read. A typical support agent uses both:
import { defineSandbox } from "@keystrokehq/keystroke/sandbox";

export default defineAgent({
  slug: "support",
  systemPrompt:
    "Read /workspace/agent/product-guide.md and use the support skill before answering.",
  model: "anthropic/claude-sonnet-4.6",
  skills: ["support"],
  sandbox: defineSandbox({ files: true }),
});

Next steps

Create skills

Write a SKILL.md with clear task guidance.

Attach files to agents

Add static context documents alongside skills.

Build agents

Configure models, tools, skills, and files.

Import skills

Reuse skills from external registries.