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:

    1. my-skill/
    2. ├── SKILL.md # Required: metadata + instruction body
    3. ├── references/ # Optional: reference material, specification documents
    4. ├── templates/ # Optional: output templates
    5. └── 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:

    1. ---
    2. name: code-review-checklist
    3. description: Complete a commit review against the team checklist and output structured comments
    4. version: 1.2.0
    5. tags: [review, quality]
    6. ---
    7. # Goal
    8. Complete one reproducible review of the given commit scope.
    9. # Inputs
    10. - List of changed files and diff content
    11. - Team review checklist (see references/checklist.md)
    12. # Steps
    13. 1. Read the checklist first and confirm the checks applicable to this round.
    14. 2. Check items grouped into four categories: correctness, readability, security, and test coverage.
    15. 3. Each comment must include: location, issue, impact, and suggested fix.
    16. 4. Explicitly mark "passed" for check items with no issues to avoid omissions.
    17. # Constraints
    18. - Do not speculate about context that was not provided; ask clarifying questions when information is missing.
    19. - Do not modify code; output comments only.
    20. # Output
    21. Output 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:

    1. Project-level directory: committed with the repository and shared by the team, with changes going through review. Suitable for standards-type skills.
    2. User-level directory: located under an individual’s working directory and available across projects. Suitable for personal habits and private templates.
    3. 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 name and description to 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 in scripts/ 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:

    1. # Release Process Orchestration
    2. 1. Call change-summary to generate a change summary.
    3. 2. Call code-review-checklist to complete the review and archive comments.
    4. 3. If the conclusion is "conditional pass," enter a fix loop, up to two rounds.
    5. 4. Call release-note-template to produce a draft release note.
    6. 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: description cannot 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.

    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.