Agent Skill Packaging: From SKILL.md to Reusable Workflows
This article explains how to package agent capabilities as skills using a SKILL.md file, covering directory structure, metadata conventions, discovery mechanisms, progressive loading, workflow orchestration, governance, common anti-patterns, and a practical adoption path. It shows how to turn repeated expert practices into versioned, reviewable text assets that can be reused across projects.
1. Why a Skill Layer Is Needed
In enterprise-grade agent applications, the most common problem is not insufficient model capability but inconsistency: the same type of task is handled differently every time. One code review request is checked item by item against a checklist today and skimmed from memory tomorrow; one set of release notes has more fields than the next. Writing the procedure into a prompt quickly bloats it into a long, hard-to-maintain text that cannot be shared across projects.
Skills solve exactly this problem. They extract “how to do a class of work” from the model’s memory and turn it into a versionable, reviewable instruction asset stored in a local directory. The core form is simple: a directory whose entry file is named SKILL.md, with YAML frontmatter at the top describing metadata (name, description, scope, and so on) and Markdown body text specifying execution steps, constraints, and output format. The value of this design lies in three points:
- The instruction layer is decoupled from the model and tools. Switching the underlying model or adjusting the toolset does not require rewriting the procedure.
- It is composable. Multiple skills can be layered as needed to form more complex chains of work.
- It is governable. Text assets naturally fit code review, change history, and access control.
2. Directory Structure and Metadata Conventions
A minimal usable skill directory typically looks like this:
my-skill/├── SKILL.md # Required: metadata + instruction body├── references/ # Optional: reference material, specification documents├── templates/ # Optional: output templates└── scripts/ # Optional: executable helper scripts
The header metadata in SKILL.md is responsible for “routing,” while the body is responsible for “execution.” Do not mix the two:
---name: code-review-checklistdescription: Complete a commit review against the team checklist and output structured commentsversion: 1.2.0tags: [review, quality]---# GoalComplete one reproducible review of the given commit scope.# Inputs- List of changed files and diff content- Team review checklist (see references/checklist.md)# Steps1. Read the checklist first and confirm the checks applicable to this round.2. Check items grouped into four categories: correctness, readability, security, and test coverage.3. Each comment must include: location, issue, impact, and suggested fix.4. Explicitly mark "passed" for check items with no issues to avoid omissions.# Constraints- Do not speculate about context that was not provided; ask clarifying questions when information is missing.- Do not modify code; output comments only.# OutputOutput in the table format of templates/review.md, ending with a conclusion: pass / conditional pass / reject.
The key to writing good metadata is making description “decidable.” It is not a marketing slogan for humans but the basis on which the dispatcher decides “whether this skill should be loaded.” Therefore, state the task type, applicable inputs, and outputs clearly, and avoid undecidable phrasing such as “very useful” or “very powerful.”
3. Discovery: Project-Level, User-Level, and Custom Directories
Whether a skill can be reused reliably depends on clear discovery paths. A common industry practice is to place skills in three types of locations:
- Project-level directory: committed with the repository and shared by the team, with changes going through review. Suitable for standards-type skills.
- User-level directory: located under an individual’s working directory and available across projects. Suitable for personal habits and private templates.
- Custom directory: scan paths explicitly added through configuration. Suitable for hosting skills centrally in a separate repository and then mounting them.
The engineering recommendation is to follow the principle of “nearest takes precedence, explicit overrides.” A skill with the same name is governed by the definition closer to the current project, while configuration can explicitly specify priority to avoid the troubleshooting cost of implicit overrides. Keeping the directory name consistent with the name field can significantly reduce the probability of incorrect loading.
4. Progressive Loading: Controlling the Context Budget
Where the skill mechanism truly shows design skill is “expanding on demand.” If the full body of every skill is stuffed into the context at once, cost rises linearly with the number of skills and attention is diluted. A workable layered strategy is:
- Layer 1: Load only
nameanddescriptionto match tasks to skills. - Layer 2: After a match, load the steps and constraints from the body.
- Layer 3: Read long documents under
references/or run scripts inscripts/only when truly needed.
This layering allows the skill library to scale to dozens or even hundreds of skills while keeping the context usage of a single task roughly constant. When writing, cooperate with this mechanism: keep the body concise, externalize long specifications to reference material, and state clearly in the body “when to read which document.”
5. From a Single Skill to Reusable Workflows
A single skill solves “one class of task”; a workflow solves “a sequence of tasks.” When chaining multiple skills, the recommended approach is “orchestration instructions + skill references” rather than copying process details into every skill:
# Release Process Orchestration1. Call change-summary to generate a change summary.2. Call code-review-checklist to complete the review and archive comments.3. If the conclusion is "conditional pass," enter a fix loop, up to two rounds.4. Call release-note-template to produce a draft release note.5. Output a unified delivery package: summary, review record, and release note.
There are three design points: first, explicitly declare the inputs and outputs of each stage to make failure retries easier; second, set loop limits and termination conditions to prevent repeated rework; third, keep human confirmation checkpoints and leave high-risk decisions outside the flow.
6. Quality Assurance and Governance
A skill is a code asset and should be managed like code:
- Validation: Add checks in continuous integration to ensure the frontmatter is parseable, required fields are complete, and referenced files exist.
- Review: Skill changes go through a merge request with at least one reviewer, and the change record states the motivation.
- Gradual rollout: Try a new version in a personal directory first, then merge it into the project-level directory.
- Metrics: Track invocation counts, first-pass rate, and manual rework rate, and use data to decide whether to keep or retire a skill.
- Security: Never write credentials into skills; script-type skills must restrict the scope of accessible resources.
7. Common Anti-Patterns
- Vague metadata:
descriptioncannot support automatic matching, so the skill is never hit. - An encyclopedic body that stuffs in all reference material and wastes context.
- Steps that lack output definitions, making execution results impossible to accept.
- One skill taking on too many responsibilities, making it impossible to compose and hard to test.
- Missing versions and change records, making rollback impossible after a problem occurs.
8. Recommended Adoption Path
First, pick a high-frequency task with clear boundaries (such as a review checklist, release notes, or API documentation) as the first skill. Second, fill in templates and reference material to form a three-layer structure of “metadata—body—material.” Third, connect validation and review processes. Fourth, gradually orchestrate multiple stages into a workflow and connect logging services and monitoring alerts to observe invocation behavior. If cross-team distribution is needed, host the skill repository on object storage or a code hosting platform and mount it through a custom directory to achieve “maintain once, reuse in many places.”
The essence of a skill is to write “how an expert does it” as a machine-readable, human-reviewable text asset. Doing four things well—good metadata, controlled context, clear outputs, and governance—turns scattered experience into stable organization-level capability.
