This tutorial turns a repeated review checklist into a small TypeScript program: run a real check, ask the coding agent to review the branch, stop on critical findings, and save the structured result.
You need Node.js 24 or newer.
mkdir yield-example
cd yield-example
npm init -y
npm install --save-exact @operatorstack/yield@0.1.26 \
--registry=https://get.operatorstack.systems/npm/
npm exec -- yskill --versionThe package includes the TypeScript SDK and its matching Yield runtime.
npm exec -- yskill init skills/review \
--language typescript \
--description "Check and review the current branch before it is shipped."The canonical workflow stays under skills/review, inside the same dependency tree as
@operatorstack/yield. The generated skill.json records the language and
program entry point:
{"version":1,"language":"typescript","run":["node","main.ts"]}The starter is intentionally incomplete. It cannot pass doctor --test until
you replace its program and fixture with the behavior described by the skill.
Replace skills/review/main.ts:
import { defineSkill } from "@operatorstack/yield";
type Review = {
critical: number;
summary: string;
};
defineSkill((ctx) => {
const check = ctx.runCommand("check", "npm run check", 60);
ctx.require(check.exit_code === 0, "the code check passes", check);
const review = ctx.agentTask<Review>(
"review",
"Review the current branch. Find correctness, security, and data-loss risks.",
undefined,
{
type: "object",
required: ["critical", "summary"],
properties: {
critical: { type: "number" },
summary: { type: "string" },
},
},
);
ctx.require(review.critical === 0, "no critical findings remain", review);
return review;
});Add the real project check to the root package.json:
{"scripts":{"check":"node --check skills/review/main.ts"}}The generated skills/review/SKILL.md remains short. It tells the agent when
to use the workflow and how to follow the yielded operations; the program owns
the order and finish rule.
Replace skills/review/fixtures/responses.json:
{
"review": {
"critical": 0,
"summary": "No critical findings in the fixture run."
}
}Run the workflow check:
npm exec -- yskill doctor skills/review --testrun_command operations execute for real. The fixture supplies only model and
user responses. A successful result ends with reached completed and a doctor
summary.
# Detect installed verified agents
npm exec -- yskill register skills/review
# Or select them explicitly
npm exec -- yskill register skills/review \
--agent cursor,codex,claude-codeYield keeps one canonical skill workflow and writes only generated adapters:
.cursor/skills/review/SKILL.md # Cursor
.agents/skills/review/SKILL.md # Codex
.claude/skills/review/SKILL.md # Claude Code
Start a new agent session after registration, then invoke /review or ask for
the task described by the skill.
Check the generated adapters:
npm exec -- yskill doctor skills/review \
--agent cursor,codex,claude-codeInitialization is only for creating or wrapping a workflow. For an existing workflow, install the matching language package, register it for the agents in the project, then run it directly when needed:
npm exec -- yskill register skills/review --agent cursor
npm exec -- yskill run skills/reviewThe agent reads the generated adapter, starts the canonical skill workflow, performs
each yielded operation, and answers with yskill respond. If the session
closes, the run remains on disk.
Next: understand skill workflows, set up coding agents, understand each primitive, or follow the complete review tutorial.