@contentful/skill-kit

Typed steps.
Rich experiences.

A TypeScript SDK for building multi-step agent skills. You define the workflow. The SDK handles state, validation, and rich terminal UI.

$ npm install @contentful/skill-kit
security-audit.ts
1export default skill({
2 name: 'security-audit',
3 entry: 'gather-scope',
4})
5 .step('gather-scope', {
6 prompt: act.survey([
7 { question: 'Focus area?', options: ['Auth', 'XSS', 'Deps'] },
8 { question: 'Framework?', options: ['React', 'Vue', 'Svelte'] },
9 ]),
10 next: 'research',
11 })
12 .step('research', {
13 prompt: act.subagent({ prompt: 'Research best practices' }),
14 next: 'plan-and-write',
15 })
16 .step('plan-and-write', {
17 prompt: act.plan({ steps: ['Summary', 'Analysis', 'Findings'] }),
18 next: 'save-report',
19 })
20 .step('save-report', {
21 action: { run: saveReport },
22 next: terminal,
23 })
24 .build()
/security-audit
Focus areaFrameworkSubmit
What should the audit focus on?
1.
Authentication
Login flows, tokens, sessions
2.
XSS Prevention
Input sanitization, CSP headers
3.
Dependencies
Supply chain, outdated packages
Enter to select · Tab/Arrow keys to navigate
01

Agent skills are simple. Until they're not.

One-shot prompts work great. But multi-step workflows need gathering input, delegating research, getting approval, producing output. A single prompt file gets long, tangled, and fragile fast.

📄 SKILL.md

First, greet the user and ask what kind of report they want. If they say "security", ask which framework. If they say "performance", skip straight to the analysis section. But if they previously mentioned accessibility concerns, combine both paths.

When gathering preferences, present options one at a time. Wait for confirmation before moving on. If the user changes their mind about a previous answer, go back to that question but keep the answers to questions that came after, unless those answers depended on the changed answer.

For the research phase, search the codebase for relevant files. If you find more than 10 files, summarize first and ask the user which to focus on. If fewer than 3, expand the search scope. Do not search node_modules unless explicitly asked.

Once research is complete, draft an outline. Present the outline for approval. If rejected, ask what to change, then re-draft. Limit to 3 revision rounds. On the 4th rejection, proceed with the last version and note the disagreement.

Write each section one at a time. After each section, confirm with the user. If they want changes, revise that section before continuing. Track which sections are done. If the user asks to skip ahead, mark skipped sections as "TODO" and continue.

When all sections are written, compile the final report. Save it to disk. If the save fails, retry once, then report the error. Present a summary with word count, sections completed, and time elapsed.

02

Branching is code, not hope.

With skill-kit, each step has a typed schema and an explicit transition. Conditional paths, loop guards, and validation are TypeScript. The agent reasons freely within each step. The skill controls where it goes next.

Prose approach

"If the user chose security, proceed to the security research section. However, if they also mentioned performance concerns earlier, you should combine both into a joint analysis. If neither was selected, ask again, but only up to two more times before defaulting to a general overview..."

skill-kit
next: (response) =>
  response.focus === 'security'
    ? 'research-security'
    : 'research-general'
03

Rich UI for free.

Surveys, plan approvals, subagent delegation, structured output. One SDK call produces native interactive UI on every host. You write act.plan() once. Claude Code, Codex, and every MCP client render their best version of it.

act.survey()
✓ Theme Framework Submit
› React
  Vue
  Svelte
act.plan()
Audit Plan
1. Executive Summary
2. Auth Flow Analysis
3. Vulnerability Assessment
› Approve
act.subagent()
Explore (Research auth)
└ Done (5 tools · 20s)

Ready to build your first skill?

Get Started $ npm install @contentful/skill-kit

Why skill-kit

One SDK call, a full TUI element.

act.askUser() becomes a structured question. act.plan() becomes an approval flow. act.subagent() spawns a research agent. You define the interaction; every host renders its best UI.

Deterministic routing, intelligent steps.

Steps, schemas, and transitions are TypeScript. Branching is code, not hope. The agent reasons within each step; the skill decides what happens next. Loops have guards. Output has Zod validation.

Test offline. Ship everywhere.

runSkill() + mockModel() drives every step without an agent. Then skill-kit build compiles to an MCP server or standalone CLI. One binary, any host: Claude Code, Codex, or any MCP client.

Examples