Usage
agent-creationallowed-skills#agent-creator
Configuration
read_filewrite_fileedit_fileapply_patchglobgrepshellask_user |
Instructions
Overview
AGENT.mdAGENT.md.stencila/agents/~/.config/stencila/agents/
Steps
Determine the agent name and description from the user's request Validate the name against the naming rules below Decide the target location: Workspace agent (default): resolve the closest workspace by walking up from the current directory to find the nearest .stencila/directory. If none exists, create .stencila/agents/<name>/at the repository root (or the current working directory if not in a repository). Create the agent under <workspace>/.stencila/agents/<name>/User agent (when the user says "user-level", "global", or "shared across workspaces"): create under ~/.config/stencila/agents/<name>/
Ask the user about model/provider preferences if not specified, or use the defaults from the Choosing Configuration section below Add keywords, when-to-use, and when-not-to-useto help managers select this agent — include terms from the user's request and relevant domain words in keywords, and add when-to-use/ when-not-to-usesignals describing when this agent should or should not be chosen Write the AGENT.mdfile with frontmatter and optional system instructions Replace all placeholders such as TODObefore considering the agent complete Top-down design : When the user wants to design the agent first and create its skills afterward: list planned skills in allowed-skillsusing kebab-case names that follow naming conventions, even if no corresponding SKILL.mdexists yet note which skills need to be created and inform the user of the outstanding dependencies validation and the runtime accept forward references (unresolved skills produce a runtime warning, not an error), so the agent can be authored and iterated on before all skill dependencies are in place
Validate the finished agent with stencila agents validate <name>, the agent directory path, or the AGENT.mdpath
Naming Rules
1–64 characters Only lowercase alphanumeric characters and hyphens ( a-z, 0-9, -) Must not start or end with a hyphen Must not contain consecutive hyphens ( --) Must match the parent directory name Pattern: ^[a-z0-9]([a-z0-9-]{0,62}[a-z0-9])?$
thing-rolecode-engineercode-reviewerdata-analystsite-designer
codeReviewercode-reviewerdata_analystdata-analystCode-Engineercode-engineer
AGENT.md Format
YAML frontmatter between ---delimiters — configuration Markdown body (optional) — system instructions appended to the agent's prompt
Required frontmatter fields
name— the agent name (must match directory name) description— what the agent does (max 1,024 characters)
Optional frontmatter fields
Agentschema/Agent.yaml
model— model identifier. When omitted, the provider's default model is used. provider— provider identifier. For CLI-backed sessions, use the CLI variant (e.g., claude-cli). When omitted, inferred from the model name or first available provider. model-size— preferred model size tier, e.g. small, medium, large. Use this to express broad cost/latency/capability preferences without hard-coding a model. reasoning-effort— low, medium, or high. Controls model reasoning depth. trust-level— low, medium(default), or high. Controls tool call guard strictness. allowed-tools— list of tool names the agent may use. Use a YAML list (one item per line) to avoid confusion. When omitted, all provider tools are available. allowed-skills— list of skill names the agent may use. When omitted, all discovered skills are available. Set to []to disable skills. When set to exactly one skill, that skill's full content is automatically preloaded into the system prompt in addition to being available via use_skill. Forward references to skills that do not yet exist are valid — see step 8 (Top-down design). allowed-domains— domain allowlist for web_fetch. Supports *.example.comwildcards. disallowed-domains— domain denylist for web_fetch. max-turns— maximum conversation turns (0 = unlimited, default: 0). max-tool-rounds— maximum tool-call rounds per user input. tool-timeout— default tool timeout in seconds. max-subagent-depth— maximum subagent nesting depth (default: 1). enable-mcp— register MCP tools directly (default: false). enable-mcp-codemode— register the mcp_codemodeorchestration tool (default: true). allowed-mcp-servers— list of MCP server IDs the agent may use. history-thinking-replay— none(default) or full. Controls chain-of-thought replay in history. truncation-preset— strict, balanced(default), or verbose. Controls tool output truncation. compaction-trigger-percent— context usage percentage that triggers history compaction (default: 70). compatibility— environment requirements (max 500 characters). keywords— list of keywords or tags for discovery and routing; use terms that reflect likely user intents, artifacts, and domains when-to-use(positive selection signals) and when-not-to-use(negative selection signals); help managers choose the right resource
allowed-toolsallowed-toolsuse_skilluse_skill
Common Agent Patterns
Minimal agent (configuration only)
---
name: fast-coder
description: Quick coding tasks with a fast model
max-turns: 5
---Read-only agent (restricted tools)
---
name: code-reviewer
description: Reviews code for correctness, style, and security issues
allowed-tools:
- read_file
- grep
- glob
- shell
---
You are a code reviewer. When asked to review code:
1. Read the files and understand the change
2. Check for correctness, security issues, and style problems
3. Suggest concrete improvements with code examples
4. Do not modify files — only read and analyzeSingle-skill agent
allowed-skillsuse_skill
allowed-toolsuse_skilluse_skill
---
name: code-reviewer
description: Reviews code using the code-review skill
allowed-skills:
- code-review
allowed-tools:
- read_file
- grep
- glob
- shell
---
You are an assistant that specializes in reviewing code for correctness, style, and security issues.Full-featured agent
---
name: code-engineer
description: A general-purpose coding agent for software engineering tasks
keywords:
- code
- implement
- debug
- refactor
when-to-use:
- when the user asks to write, implement, debug, or refactor code
- when the task involves software engineering work
when-not-to-use:
- when the user only wants a code review without modifications
trust-level: medium
allowed-tools:
- read_file
- write_file
- edit_file
- grep
- glob
- shell
- web_fetch
max-turns: 0
max-tool-rounds: 25
tool-timeout: 120
---
You are a software engineer. Follow these principles:
- Write clean, readable code that follows the project's existing conventions
- Prefer simple, focused changes over large refactors
- Handle errors appropriately
- Do not introduce security vulnerabilitiesExample Walkthrough
Derive name: pr-reviewer(thing-role pattern, kebab-case) Resolve workspace: find nearest .stencila/directory, e.g., at the repository root Target path: .stencila/agents/pr-reviewer/AGENT.mdSelect read-only tools, high reasoning effort, no model/provider (use defaults) Write the file, then validate
---
name: pr-reviewer
description: Reviews pull requests for correctness, security, and style issues
reasoning-effort: high
allowed-tools:
- read_file
- grep
- glob
- shell
---
You are a pull request reviewer. For each review:
1. Read the changed files and understand the intent
2. Check for bugs, security issues, and style problems
3. Provide specific, actionable feedback with code examples
4. Do not modify any filesstencila agents validate pr-reviewer
Choosing Configuration
modelprovidermodel-size
model-size
model-sizereasoning-effort
model-sizechooses the class of model to use. reasoning-effortcontrols how much deliberation that chosen model applies.
model-sizeprovidersmodel
medium | medium | medium | allowed-tools | |
mediumlarge | lowmedium | high | read_filegrepglobshell | |
small | medium | low | ||
mediumlarge | medium | high | ||
smallmedium | low | medium | read_filewrite_fileedit_filegrepglob |
model-size: smallmodel-size: mediumlarge
allowed-skillsallowed-tools
No tool restrictions needed: omit allowed-toolsTool restrictions needed and no skills: include only the tools the agent itself needs Tool restrictions needed and exactly one allowed skill: include the tools required by that skill, plus any extra agent-specific tools; use_skillis optional because the skill is preloaded Tool restrictions needed and multiple allowed skills or dynamic skill invocation: include use_skilland the union of tools required by those skills, plus any extra agent-specific tools
Edge Cases
Agent directory already exists : Ask the user whether to overwrite, merge, or abort before modifying an existing agent. Never silently overwrite. Name mismatch : If the user provides a name that doesn't match kebab-case rules, suggest a corrected version rather than failing silently. Nested workspaces : If multiple .stencila/directories exist in the ancestor chain, use the nearest one. Do not create a duplicate .stencila/agents/tree. Empty or placeholder content : Do not consider the agent complete if any TODO, <placeholder>, or empty descriptionremains in the final AGENT.md. User vs workspace confusion : Confirm with the user if the intent is ambiguous. Default to workspace-level agents. CLI-backed agents : When the user wants to use a CLI tool, set the provider to the corresponding CLI variant (e.g., claude-cli, codex-cli, gemini-cli). Body is optional : A frontmatter-only AGENT.mdis valid. Only add a Markdown body when the user provides custom instructions or the agent needs behavioral guidance beyond what project docs supply. Skill/tool mismatch : If an agent sets both allowed-skillsand allowed-tools, check that every tool allowed by the selected skills is also included in the agent's allowed-tools. Also check whether use_skillis needed: it is optional for exactly one preloaded skill, but should be included when the agent may need to invoke skills dynamically or choose among multiple skills. Unknown skills : List outstanding skill dependencies so the user can create them. This is valid in top-down design (see step 8) — validation passes, and the runtime produces a warning for unresolved skill names, not an error. Do not remove skill references just because the targets do not exist yet.
Validation
# By agent name
stencila agents validate <agent-name>
# By directory path
stencila agents validate .stencila/agents/<agent-name>
# By AGENT.md path
stencila agents validate .stencila/agents/<agent-name>/AGENT.mdLimitations
This skill covers agent structure, configuration, and authoring conventions. It does not verify that chosen models, providers, MCP servers, or external services are available at runtime. Validation checks structure and known constraints, but some configuration mistakes may still surface only during execution.
.stencila/skills/agent-creation/SKILL.md