> ## Documentation Index
> Fetch the complete documentation index at: https://app.keystroke.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Attach skills to agents

> Attach skills to agents by name.

You attach a [skill](/learn/skills/overview) to an [agent](/learn/agents/overview) 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/`:

```ts src/agents/support.ts theme={null}
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:

```ts theme={null}
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:

```ts theme={null}
systemPrompt: "Read /workspace/agent/skills/support/SKILL.md before replying.",
```

## Skills and files together

An agent can use both [skills](/learn/skills/overview) and [files](/learn/files/overview). Skills give it *instructions* it loads on demand; files give it *context documents* to read. A typical support agent uses both:

```ts theme={null}
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

<CardGroup cols={2}>
  <Card title="Create skills" href="/learn/skills/create-skills">
    Write a SKILL.md with clear task guidance.
  </Card>

  <Card title="Attach files to agents" href="/learn/files/attach-files-to-agents">
    Add static context documents alongside skills.
  </Card>

  <Card title="Build agents" href="/learn/agents/build-agents">
    Configure models, tools, skills, and files.
  </Card>

  <Card title="Import skills" href="/learn/skills/import-skills">
    Reuse skills from external registries.
  </Card>
</CardGroup>
