Adds write-agent to plugins/kyberforge/skills/ — a factory skill parallel to write-skill that authors Claude Code subagent definitions and cross-tool plugin agents (Claude Code + GitHub Copilot CLI two-file pattern). Includes research references (claude-code-agents.md, copilot-cli-agents.md, cross-compat.md), three asset templates (subagent, plugin-agent-claude, plugin-agent-copilot), eval coverage, and CATEGORIES.md updated to register write-agent in the factory category per the conflict check finding. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
8.0 KiB
name, description, metadata, model
| name | description | metadata | model | ||
|---|---|---|---|---|---|
| write-agent | Use when the user wants to author a new agent definition file for Claude Code (subagent) or GitHub Copilot CLI (plugin agent). Triggers: "write an agent for X", "create a subagent that does Y", "add an agent to the Z plugin", "build a cross-tool agent". Do NOT use when the user wants to create a role skill that loads inline into the current conversation (use /write-skill with category: roles), scaffold a new plugin from scratch (use /plugin-create), edit or update an existing agent definition (use upgrade-agent), or author skills inside a plugin (use /write-skill). |
|
sonnet |
Required inputs
- Agent type — standalone subagent or plugin agent; inferred from request if obvious ("add an agent to plugin X" → plugin agent, "create a subagent" → standalone), ask if ambiguous
- Agent name — kebab-case slug; inferred from user description if not stated, ask if ambiguous
- Plugin name — plugin agents only; must be an existing plugin in
plugins/; ask if not stated - Purpose + use cases — what the agent does, what tasks it handles exclusively; source for the
descriptionfield and system prompt body - Tool access rationale — which tools the agent needs and why (allowlist, denylist, or inherit all); ask if not stated
Constraints
- One skill, two branches — determine agent type before any other step; do not proceed until type is confirmed
- Plugin agents: always generate both
<name>.md(Claude Code) and<name>.agent.md(Copilot CLI) — same system prompt body, translated frontmatter; never generate one without the other - Plugin agents:
plugins/<name>/must exist before writing — stop and redirect to/plugin-createif not found - Standalone subagents: write to
core/agents/<name>.mdper ADR-0010 — never write directly to.claude/agents/ - Do not create role skills (inline mode switches,
category: roles) — if the user wants a cognitive mode switch without context isolation, redirect to/write-skill - Load
references/cross-compat.mdbefore writing any plugin agent frontmatter — Claude Code and Copilot CLI diverge in field names, tool names, and supported features - Copy agent files from
assets/templates — never generate from memory; stop and report the path if a template is missing - Flag Claude-only fields (
permissionMode,isolation,maxTurns,memory,hooks,mcpServers) in a handoff comment when generating.agent.md— these have no Copilot CLI equivalent - Body under 500 lines
Process
-
Determine type. Infer standalone subagent or plugin agent from the request. Ask if ambiguous. Hard gate: do not proceed until type is confirmed.
-
Validate target. For plugin agents: confirm
plugins/<name>/exists. Stop and redirect to/plugin-createif not. For standalone subagents: confirmcore/agents/exists. -
Scan for overlap. Check
core/agents/(standalone) orplugins/<name>/agents/(plugin) for agents with similar purpose or name. Surface any found and wait for direction before continuing. -
Grill. One question at a time, with a recommendation for each: agent name, purpose, tasks it handles exclusively, what it explicitly does NOT do, tool access rationale, model selection, isolation needs (subagents only), and any optional fields worth setting. Stop when there is shared understanding of all five required inputs.
-
Conflict check. Spawn a sub-agent: read
docs/ai-constitution.md,docs/research/ai-coding-factory/ai-coding-factory-principles.md, anddocs/notes/factory-integration-decisions.md, then check the agreed agent design against all three. Return a numbered list of genuine unresolved tensions, or confirm none found. Hard gate: resolve any findings before proceeding. -
Write and test the description field. Draft the
description:using the agreed purpose and use cases — this is what Claude reads to decide whether to delegate. Propose negative trigger cases; get explicit user confirmation. Test explicit, implicit, and negative cases and show per-case PASS/FAIL. A failed case means revise and retest — do not proceed. -
Walk through the system prompt body. Propose the body section by section: role statement, task scope, explicit out-of-scope items, behavioral constraints. Wait for explicit confirmation of each before writing.
-
Walk through optional frontmatter. For each optional field (
model,tools,disallowedTools,maxTurns,effort,isolation,permissionMode,memory,background): propose a value if warranted by the agreed design, or confirm omission. Loadreferences/claude-code-agents.mdfor field semantics. Wait for confirmation of each. -
Check template. Load the appropriate template(s) from
assets/:subagent.mdfor standalone subagents;plugin-agent-claude.mdandplugin-agent-copilot.mdfor plugin agents. Stop and report the path if any template is missing — do not generate from memory. -
Copy and fill. Copy the template(s) to the target path(s). Fill with confirmed content. For plugin agents: load
references/cross-compat.mdand translate Claude frontmatter to Copilot equivalents in<name>.agent.md. Keep both bodies identical. Note Claude-only fields that have no Copilot equivalent in a handoff comment at the top of<name>.agent.md. -
Invoke
write-eval. Do not mark the agent complete without an eval file. -
Run self-check. Work through every item in the Self-check section below.
-
Prompt for HITL. Ask the user to open a fresh session, trigger the agent, and confirm behavior before committing.
Output format
For standalone subagents:
core/agents/<name>.md— copy-filled fromassets/subagent.mdplugins/kyberforge/skills/write-agent/evals/<name>.yaml— produced by write-eval
For plugin agents:
plugins/<plugin-name>/agents/<name>.md— copy-filled fromassets/plugin-agent-claude.mdplugins/<plugin-name>/agents/<name>.agent.md— copy-filled fromassets/plugin-agent-copilot.md; Claude-only fields noted in a handoff comment at the topplugins/kyberforge/skills/write-agent/evals/<name>.yaml— produced by write-eval
Failure handling
- Agent type cannot be determined from the request — stop and ask; do not proceed without explicit type confirmation
plugins/<name>/not found for a plugin agent — stop, report the path checked, redirect to/plugin-createcore/agents/not found for a standalone subagent — stop, report the path, do not write to.claude/agents/directly- Template missing from
assets/— stop, report the exact path searched, do not generate from memory - Overlap found in target directory — surface it and wait for explicit direction; do not continue
write-evalfails or is unavailable — flag, do not mark the agent complete- Conflict check sub-agent returns unresolved tensions — resolve before writing any file
Self-check
- Agent type confirmed before any other step
- Plugin validated to exist at
plugins/<name>/before any file was written (plugin agents only) - Overlap check completed in the correct target directory before any content was written
- Conflict check sub-agent ran — all findings resolved before writing began
- Description field tested against explicit, implicit, and negative cases — all passed before body was written
- Negative trigger cases confirmed by user before testing
- System prompt body confirmed section by section before writing
- Optional frontmatter fields confirmed or explicitly omitted
- Template(s) loaded from
assets/— not generated from memory - For plugin agents: both
.mdand.agent.mdwritten; bodies are identical; Claude-only fields noted in handoff comment references/cross-compat.mdloaded before translating plugin agent frontmatter (plugin agents only)- Standalone subagent written to
core/agents/<name>.md— not to.claude/agents/ write-evalinvoked — eval file exists and covers trigger cases