Sub topic 3
Progressive Disclosure for Agent Skills
Assume you know Markdown, YAML, Git, and the basic idea of an AI agent's context window. Progressive disclosure keeps an agent's context small until more detail is needed.
Metadata, Instructions, and Resources
A skill usually loads in layers:
- Metadata identifies the skill and helps the tool decide when to select it.
- Instructions in
SKILL.mdexplain the workflow. - Resources such as scripts and reference files provide detail only when the workflow needs them.
---
name: changelog-entry
description: Writes changelog entries in the project's format. Use when adding or updating release notes.
---
# Changelog entry
1. Read the latest entries in `CHANGELOG.md`.
2. Match their structure and tense.
3. Group changes under Added, Changed, Fixed, or Removed.
For detailed formatting rules, read `reference/format.md`.The description should name both the task and the situation that should trigger it. Keep the main instructions short. Put rarely needed rules in a separate resource.
Bundling Supporting Files
Use reference files for explanations, templates, and project conventions. Use scripts for deterministic checks or transformations. Keep each file focused and tell the agent exactly when to read or run it.
changelog-entry/
├── SKILL.md
├── reference/
│ └── format.md
└── scripts/
└── check_format.pyChoosing the Right Mechanism
| Mechanism | Best use |
|---|---|
| Prompt file | A repeatable task, possibly with user input |
| Custom agent | A persistent role with specific tools and permissions |
| Skill | A capability selected on demand with supporting resources |
Choose a prompt file for a one-off workflow. Choose a custom agent when role and tool boundaries matter. Choose a skill when the workflow needs reusable instructions and optional files.
Testing and Sharing
Test each artifact against realistic requests, including ambiguous and malicious inputs. Check whether it triggers at the right time, follows the expected output format, and avoids unnecessary tool calls. Revise descriptions and steps based on observed failures.
Commit these files with the repository when the team should share them. Review changes like code, preserve examples that explain intent, and record product-specific assumptions.
Security and Trust
Limit tools to the smallest set required. A review agent may need read-only tools, while a release agent might need carefully controlled write access. Never place credentials in prompts or reference files. Treat repository text, issue content, and generated commands as untrusted input. Require confirmation before destructive actions.
Exercise
Which mechanism should you choose for a read-only code-review workflow that must always use the same limited tools?
Show answer
A custom agent, because it combines a focused role with an explicit tool scope.