Skip to content

Agent profiles: honor skills: frontmatter to preload skill bodies into the agent's context #3532

@dfrysinger

Description

@dfrysinger

Summary

Allow custom agent profiles (in plugins and project-level .github/agents/) to declare a skills: list in YAML frontmatter. When the agent is instantiated (as a subagent or top-level agent), the named skills' SKILL.md bodies are prepended to the agent's system prompt automatically.

Motivation

Skills today use progressive disclosure — name and description live in context, full body loads on explicit invocation. That works well for opportunistic skills. It does not work well for protocols: shared content that must govern every dispatch of an agent (review procedures, output-format contracts, isolation rules, sandbox conventions).

Workarounds today:

  1. Duplicate the protocol prose into every agent body. Drift-prone, defeats the point of skills, hard to maintain when the protocol evolves.
  2. Have the agent instruct the model to invoke the skill tool first. Costs a round trip per dispatch and can be silently skipped by the model — exactly the kind of silent failure that protocol-bearing agents exist to prevent.
  3. Compile skills into agent files at plugin build time. Works, but every plugin author maintains their own toolchain and the maintenance burden compounds across cross-ported plugins.

Claude Code already supports this via skills: in agent frontmatter. A small upstream change would let one set of agent files preserve protocol-load semantics in both CLIs.

Proposal

Extend the agent profile schema:

---
name: code-quality-reviewer
description: Verifies implementation is clean and maintainable
tools: ["view", "grep"]
skills: [reviewer-protocol]
---
You are the Code Quality Reviewer ...

At agent instantiation:

  1. Resolve each entry in skills: against the plugin's registered skills, with the same precedence rules used for /skills lookup (first-found wins; project/user/plugin scopes honored).
  2. For each resolved skill, prepend the body of SKILL.md (minus its own frontmatter) to the agent's system prompt, before the agent's own body. Multiple entries load in declared order.
  3. Unresolved entries produce a warning but don't fail instantiation.

Design notes

  • Token-budget aware. Respect the same context-budget guardrails used for the initial skills list. If preloaded content would exceed budget, omit and warn rather than truncate silently.
  • Composable. Multiple skills load in declared order, which matters when one protocol layers on another.
  • Backwards compatible. Agents without skills: are unchanged.
  • Mirrors Claude Code semantics so cross-CLI plugins can ship one set of agent files.

Out of scope

  • No new tool. Skills remain invokable on demand by name.
  • No change to top-level skill discovery, precedence, or progressive disclosure for non-preloaded skills.

Acceptance

  • A custom agent declaring skills: [x] shows the body of x/SKILL.md in its initial system prompt (verifiable via /env or log inspection).
  • An agent without the skills: field behaves identically to today.
  • An unknown skill name emits a clear warning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:agentsSub-agents, fleet, autopilot, plan mode, background agents, and custom agentsarea:pluginsPlugin system, marketplace, hooks, skills, extensions, and custom agents
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions