Skip to content

Code

Last updated View as MarkdownAgent setup

skills.manifest() creates a source from Agent Skills defined in code. It needs no Workspace or bucket, which suits tests and small sets of skills that ship with your Worker.

Define skills

Each entry holds the SKILL.md fields and, optionally, its resources:

src/server.jsjs
import { Think, skills } from "@cloudflare/think";

const handbook = skills.manifest({
	id: "handbook",
	skills: [
		{
			name: "release-notes",
			description: "Turn a list of changes into release notes.",
			body: "Read `references/style-guide.md`, then write one line per change.",
			metadata: { author: "my-team" },
			resources: [
				{
					path: "references/style-guide.md",
					content: "Start each line with a past-tense verb.",
				},
			],
		},
	],
});

export class MyAgent extends Think {
	getSkills() {
		return [handbook];
	}
}
src/server.tsts
import { Think, skills } from "@cloudflare/think";

const handbook = skills.manifest({
	id: "handbook",
	skills: [
		{
			name: "release-notes",
			description: "Turn a list of changes into release notes.",
			body: "Read `references/style-guide.md`, then write one line per change.",
			metadata: { author: "my-team" },
			resources: [
				{
					path: "references/style-guide.md",
					content: "Start each line with a past-tense verb.",
				},
			],
		},
	],
});

export class MyAgent extends Think<Env> {
	getSkills() {
		return [handbook];
	}
}

Entry fields

Field Required Description
name Yes Skill name. Must follow the naming rules
description Yes What the skill does and when to use it
body Yes Markdown instructions
license No License name or bundled license file
compatibility No Environment requirements
metadata No String key-value metadata
allowedTools No Space-separated list of pre-approved tools
resources No Files as { path, content }. Use encoding: "base64" for binary files

Entries pass the same checks as SKILL.md files: an entry that breaks a rule loads with a warning, and one with no description is skipped and logged.

skills.fromManifest() is a deprecated alias of skills.manifest().

Combine with other sources

A manifest works next to other sources. Sources are applied in order, so put the source you want to win first:

export class MyAgent extends Think {
	getSkills() {
		return [skills.workspace(this.workspace), handbook];
	}
}
export class MyAgent extends Think<Env> {
	getSkills() {
		return [skills.workspace(this.workspace), handbook];
	}
}

Here, a Workspace skill named release-notes replaces the manifest's version.

Was this helpful?