Agent Skills in Practice: From Instruction Files to Workflows
This article explains how the Skill layer brings stability and repeatability to AI agents. It covers the structure of a SKILL.md file, how metadata and instructions divide responsibilities, the three levels of scope and their priority, and how to turn a single skill file into a reusable workflow with input contracts, step orchestration, and output templates. It also outlines quality assurance practices and common anti-patterns to avoid.
1. Why a Skill Layer Is Needed
When building agent applications, teams often run into a structural conflict: the model is capable enough, but its output style and process are hard to keep stable. Writing the rules into the system prompt makes it grow endlessly, while putting them in external documents means they cannot be followed automatically. The value of the Skill mechanism is that it inserts a layer of instructions that is independent of both the model and the tools between them. Unlike model weights, it is not hard to modify; unlike tool interfaces, it does not merely describe “what can be done” — it describes “how this kind of work should be done.”
A skill is usually a local directory whose core file is named SKILL.md. It has two parts: YAML frontmatter at the top for metadata, and a Markdown body below that defines the execution steps. Because it is a plain-text asset, it can naturally be versioned, reviewed, and reused.
2. Anatomy of a Skill File: A Minimal Working Example
Metadata serves “discovery and selection”; the body serves “execution and constraints.” The two responsibilities must stay separate.
---name: code-reviewdescription: Perform a structured review of a commit diff and output an issue list with fix suggestionstags: [quality, review]---# GoalReview the given diff for defects, readability, and security.# Steps1. Read the changed files and the caller context;2. Check item by item across five categories: correctness / robustness / security / performance / style;3. For each issue, provide: location, cause, suggested fix, risk level.# Constraints- Report only issues that are backed by evidence; do not speculate about code you have not read;- Do not modify files; output suggestions only.
Key points: use a stable identifier in kebab-case for name; make description state clearly “when to use” it, which is what makes it retrievable; write the body with imperative sentences, numbered steps, and explicit acceptance criteria, avoiding vague adjectives.
3. Discovery, Scope, and Priority
Skills generally support three levels of scope: project level (shared with the team through the repository), user level (personal habits reused across projects), and a custom directory (explicitly mounted through configuration). When skills with the same name conflict, the common approach is “the more specific scope wins,” meaning project level overrides user level. A practical recommendation: put mandatory team standards at the project level and include them in code review; put personal preferences at the user level; put experimental skills in a custom directory, and promote them once they are validated and mature.
4. From a Single File to a Reusable Workflow
Workflows have to solve three things: input contract, step orchestration, and output template.
- Input contract: specify which context is required (diff, logs, API definitions) and the fallback strategy when it is missing;
- Step orchestration: break a large task into verifiable stages, each producing an artifact;
- Output template: a fixed structure (such as “Conclusion — Evidence — Recommendation — Risk”) that downstream consumers can rely on.
Example (release notes generation):
---name: release-notesdescription: Generate user-facing release notes from commit history and change tickets---# InputCommit list, version number, compatibility change flags.# Steps1. Categorize into added / improved / fixed / breaking changes;2. Filter out internal refactors and dependency upgrade noise;3. Sort by user impact and produce both English and Chinese versions.# OutputA Markdown table plus a short upgrade note.
5. Quality Assurance and Iteration
Skills are “prompt engineering assets” and need to be governed like code: prepare a sample set for typical inputs and run regression comparisons on output stability; evaluate the retrieval hit rate of description to avoid triggering it by mistake when it is too broad; subtract from the body by deleting modifiers that do not affect the result. If an organization needs storage and distribution for skills, it can use general-purpose capabilities, such as object storage to hold skill packages, a logging service to collect invocation traces, and monitoring and alerting to track failure rates, forming a closed loop without binding to specific interfaces.
6. Common Anti-Patterns
The first is writing a skill as a “do-everything assistant,” where blurred boundaries make behavior unpredictable. The second is mixing the responsibilities of body and metadata, piling steps into description. The third is missing acceptance criteria, making it impossible to tell whether the task is done. The fourth is excessive nested references, which sharply increases maintenance cost. The way to avoid these is to keep a single responsibility, explicit inputs and outputs, and measurable completion conditions.
In short, the essence of the skill layer is turning “organizational knowledge” into “executable constraints.” Once teams master metadata design, scope priority, and workflow orchestration, team standards, review processes, and document templates can all be captured as stable assets, significantly reducing the behavioral variance of agents.
