Turn an agent's skills on and off.
Forge's skills
5 of 40Fix a flaky test
Draft from the agentUse when a test passes on rerun. Find the race; never add a retry or a sleep.
Written by Forge from Tuesday's session
Instructions
1. Run the test 20 times and note the failures. 2. Look for timers, shared state and order. 3. Fix the cause and run it 20 times again.
Write a database migration
Use when a change needs a new column or table. Migrations are reversible.
v3 · Used in 4 runs this week
Instructions
Write the up and the down. Test both on a copy of production.
Review a pull request
PublishedUse when asked to review. Comment on correctness first, style last.
v7 · Used in 31 runs this week
Instructions
Read the description, then the tests, then the code.
Write release notes
Use before tagging a release. Group changes by who they affect.
Instructions
Features, fixes, then breaking changes with how to migrate.
Upgrade a dependency
Use when a package needs a new major version. Read the changelog first.
From the platform team
Managed by the platform team.
import { Command, UiSchema } from "@effect/ui"import { Html } from "@effect/ui/html"import { Effect, Schema } from "effect"import { Skill, SkillLibrary } from "./ui/uicontext/components/kit/Skills.ts"const seed: ReadonlyArray<Skill> = [ { id: "flaky", name: "Fix a flaky test", description: "Use when a test passes on rerun. Find the race; never add a retry or a sleep.", body: "1. Run the test 20 times and note the failures.\n2. Look for timers, shared state and order.\n3. Fix the cause and run it 20 times again.", draft: true, origin: "Written by Forge from Tuesday's session", }, { id: "migrate", name: "Write a database migration", description: "Use when a change needs a new column or table. Migrations are reversible.", body: "Write the up and the down. Test both on a copy of production.", enabled: true, version: "v3", usage: "Used in 4 runs this week" }, { id: "review", name: "Review a pull request", description: "Use when asked to review. Comment on correctness first, style last.", body: "Read the description, then the tests, then the code.", enabled: true, published: true, version: "v7", usage: "Used in 31 runs this week" }, { id: "release", name: "Write release notes", description: "Use before tagging a release. Group changes by who they affect.", body: "Features, fixes, then breaking changes with how to migrate.", enabled: false }, { id: "deps", name: "Upgrade a dependency", description: "Use when a package needs a new major version. Read the changelog first.", enabled: true, origin: "From the platform team", readOnly: { tone: "neutral", text: "Managed by the platform team." } },]const Message = UiSchema.TaggedEnum({ Saved: { skill: Schema.NullOr(Schema.String), name: Schema.String, description: Schema.String, body: Schema.String }, Enabled: { skill: Schema.String, on: Schema.Boolean }, Accepted: { skill: Schema.String }, Declined: { skill: Schema.String }, Deleted: { skill: Schema.String }, PickedSkillFiles: { files: Schema.Array(Schema.instanceOf(File)) }, Imported: { skills: Schema.Array(Schema.Struct({ name: Schema.String, description: Schema.String, body: Schema.String })) },})// Reads each Markdown file: `name:` and `description:` from its front matter, the rest as the body.const ReadSkills = Command.make("ReadSkillFiles", { args: { files: Schema.Array(Schema.instanceOf(File)) } }, ({ files }) => Effect.forEach(files, (file) => Effect.promise(() => file.text()).pipe( Effect.map((text) => { const front = /^---\n([\s\S]*?)\n---\n?/u.exec(text) const field = (key: string) => new RegExp(`^${key}:\\s*(.+)$`, "mu").exec(front?.[1] ?? "")?.[1]?.trim() return { name: field("name") ?? file.name.replace(/\.md$/u, ""), description: field("description") ?? "Imported skill", body: front === null ? text : text.slice(front[0].length), } }), ), ).pipe(Effect.map((skills) => Message.Imported({ skills }))),)const update = (skills: ReadonlyArray<Skill>, id: string, change: (s: Skill) => Skill) => skills.map((s) => (s.id === id ? change(s) : s))export const CodingSkills = Html.component({ name: "CodingSkills", model: Schema.Struct({ skills: Schema.Array(Skill), next: Schema.Number }), message: Message,}).make({ init: () => ({ skills: seed, next: 1 }), update: { Saved: ($, s) => s.skill === null ? $.evolve({ skills: (all) => [{ id: `new-${$.model.next}`, name: s.name, description: s.description, body: s.body, enabled: true }, ...all], next: (n) => n + 1, }) : $.evolve({ skills: (all) => update(all, s.skill!, (x) => ({ ...x, name: s.name, description: s.description, body: s.body })) }), Enabled: ($, { skill, on }) => $.evolve({ skills: (all) => update(all, skill, (x) => ({ ...x, enabled: on })) }), Accepted: ($, { skill }) => $.evolve({ skills: (all) => update(all, skill, (x) => ({ ...x, draft: false, enabled: true, origin: "Taught by you" })) }), Declined: ($, { skill }) => $.evolve({ skills: (all) => all.filter((x) => x.id !== skill) }), Deleted: ($, { skill }) => $.evolve({ skills: (all) => all.filter((x) => x.id !== skill) }), PickedSkillFiles: ($, { files }) => $.evolve({}).run(ReadSkills.make({ files })), Imported: ($, { skills }) => $.evolve({ skills: (all) => [...skills.map((s, i) => ({ id: `imported-${$.model.next + i}`, ...s, draft: true, origin: "Imported" })), ...all], next: (n) => n + skills.length, }), }, view: (h, model) => SkillLibrary(h, { props: { id: "forge", agentId: "skills-coding", label: "Forge's skills", skills: model.skills, can: ["create", "edit", "delete", "enable", "accept", "import"], limit: { used: model.skills.length, max: 40 }, }, onEmit: { RequestedScope: () => undefined, RequestedSave: ({ skill, name, description, body }) => Message.Saved({ skill, name, description, body }), RequestedEnable: ({ skill, on }) => Message.Enabled({ skill, on }), RequestedPublish: () => undefined, RequestedSync: () => undefined, RequestedDefault: () => undefined, RequestedAccept: ({ skill }) => Message.Accepted({ skill }), RequestedDecline: ({ skill }) => Message.Declined({ skill }), RequestedDelete: ({ skill }) => Message.Deleted({ skill }), RequestedImport: ({ files }) => Message.PickedSkillFiles({ files }), }, }),})Installation
pnpm dlx shadcn@latest add checkfu/uicontext/skillsUsage
import { type Skill, SkillLibrary } from "./ui/uicontext/components/kit/Skills.ts"const Message = UiSchema.TaggedEnum({ SavedSkill: { skill: Schema.NullOr(Schema.String), name: Schema.String, description: Schema.String, body: Schema.String }, EnabledSkill: { skill: Schema.String, on: Schema.Boolean },})// your app stores the skills; the library asks for each changeexport const AgentSkills = (h: Html.H<typeof Message.Type>, skills: ReadonlyArray<Skill>) => SkillLibrary(h, { props: { id: "forge", label: "Skills", skills, can: ["create", "edit", "enable"] }, onEmit: { RequestedSave: ({ skill, name, description, body }) => Message.SavedSkill({ skill, name, description, body }), RequestedEnable: ({ skill, on }) => Message.EnabledSkill({ skill, on }), RequestedScope: () => undefined, RequestedPublish: () => undefined, RequestedSync: () => undefined, RequestedDefault: () => undefined, RequestedAccept: () => undefined, RequestedDecline: () => undefined, RequestedDelete: () => undefined, RequestedImport: () => undefined, }, })API reference
Props
| Name | Type | Default | Description |
|---|---|---|---|
idrequired | string | — | Identifies the library in the events it sends |
labelrequired | string | — | The library's heading: "Skills" |
skillsrequired | Skill[] | — | The skills in the current scope |
status | "loading" | "ready" | "ready" | "loading" shows a placeholder; "ready" by default |
scopes | { id, label }[] | — | Tabs: personal, team, organization, repository |
scope | string | — | The id of the scope tab showing |
canrequired | SkillAction[] | — | What this person may do: create, edit, delete, publish, sync, enable, set defaults, accept drafts and import files |
limit | { used, max } | — | "12 of 200 skills" |
noun | string | — | The word for what's listed: "skill", "playbook", "plugin" |
deleteCopy | { label, pendingLabel, description } | — | Copy for a removal such as taking a plugin off the current account. |
empty | { title, hint } | — | What shows when there are no skills |
outcome | Outcome | null | — | The app's answer to the request in flight. Its request is the action, and the skill's id after a colon when it's about one skill: "save", "delete:notes" (see skillRequest). |
agentId | string | — | The id agents see this library by; skills:<id> when left out |
Events
| Event | Payload | Description |
|---|---|---|
RequestedScope | { id: string; scope: string } | The person picked another scope tab |
RequestedSave | { id: string; skill: string | null; name: string; description: string; body: string } | skill is null for a new one |
RequestedEnable | { id: string; skill: string; on: boolean } | The person switched a skill on or off |
RequestedPublish | { id: string; skill: string; publish: boolean } | The person shared a skill, or stopped sharing it |
RequestedSync | { id: string; skill: string } | The person sent a published skill's edits to the shared copy |
RequestedDefault | { id: string; skill: string; on: boolean } | The person made a skill a default, or took that back |
RequestedAccept | { id: string; skill: string } | The person kept a skill an agent drafted |
RequestedDecline | { id: string; skill: string } | The person turned down a skill an agent drafted |
RequestedDelete | { id: string; skill: string } | The person confirmed deleting a skill |
RequestedImport | { id: string; files: instanceOf[] } | The person picked skill files to import (Markdown); the app reads them |
Agent actions
| Action | Description |
|---|---|
ChoseScope | Show another scope by id |
ClickedNew | Start a new skill |
ClickedEdit | Edit a skill by id |
UpdatedDraft | Type the name, description or body of the skill being edited |
SubmittedDraft | Save the skill being edited (name and description are required) |
ToggledEnabled | Turn a skill on or off for this agent |
ClickedPublish | Publish a skill to others, or stop publishing it |
ClickedSync | Sync a published skill's edits to the shared copy |
ClickedDefault | Make a skill a default, or stop |
ClickedAccept | Accept a draft skill an agent wrote |
ClickedDecline | Decline a draft skill an agent wrote |
ClickedDelete | Open confirmation to remove an entry from the library |
ConfirmedDeleteasks first | Remove the library entry being confirmed. Name it as your target. |
Accessibility
- Each skill is an article named by its title; its on and off control is a switch, and every button names the skill it acts on.
- Scopes are a row of toggle buttons (
aria-pressed). A missing name or description is announced and markedaria-invalid. - Removing a skill asks first, and agents must name the skill they remove.