Agent Skill Design: From Instruction Files to Reusable Workflows

    This article explains how to turn one-off prompts into reusable agent skills. It covers what skills are, how they differ from plugins, how discovery and on-demand injection work, where to store them and how priority is resolved, how to build a minimal working skill, five practices for writing the body, common anti-patterns, and how to compose skills into workflows and govern them as code within a team.

    1. Why an Instruction Layer: From One-Off Prompts to Reusable Assets

    When teams work with AI coding tools, the common obstacle is not that “the model is not smart enough.” It is that the same class of task has to be re-explained every time: the background, the steps, and the acceptance criteria. Prompts end up scattered across chat history and personal habits, so output style drifts, key steps get skipped, and compliance checks happen only sometimes.

    The fix is to lift “how this task should be done” out of the conversation and turn it into an instruction asset that is independent of any specific model or tool. This is what the industry commonly calls a skill.

    Such an asset is essentially a reusable task description stored in a local directory. Structured metadata at the top describes its name, purpose, and trigger scenarios, while the body specifies the steps, constraints, and delivery format for a class of work. Its value comes from three properties:

    • Reuse: write it once, then call it across multiple sessions and projects.
    • Reviewability: the instruction is a file in version control, so changes to standards can be reviewed like code.
    • Composability: multiple skills can cover requirement clarification, implementation, review, and release, and be chained into an end-to-end workflow.

    2. Setting the Boundary: Skills and Plugins Solve Different Problems

    Teams often conflate two concepts early on. A skill answers “in what order, and to what standard, should this class of task be completed.” It belongs to the process and standards layer. A plugin answers “what extra capabilities are available at runtime.” It belongs to the tool and runtime layer. The two are complementary and cannot replace each other.

    A skill requires no host-language code and carries no responsibility for tool registration. Once loaded, it enters the current agent’s context as instruction text and can call tools that already exist in the environment: file read/write, command execution, retrieval, or integrations with external capabilities. In other words, a skill is a “methodology plus checklist,” not a new engine. The practical benefit is that adjusting a standard usually means editing text only, with no need to rebuild or republish runtime components, which keeps iteration costs very low.

    3. Loading Mechanism: Directory Discovery and On-Demand Injection

    A mature skill system usually splits the lifecycle into three stages. Understanding them helps you write skills that perform well and stay out of the way.

    The first stage is discovery and parsing. The system scans the agreed directories, reads the header metadata of each skill file, extracts the name and description, and builds a lightweight catalog. The second stage is matching. Only when the user request is semantically consistent with a description, or the user explicitly names a skill, does the flow move to the third stage. The third stage is body injection: the full instruction is loaded into context to guide the current task.

    This “catalog always resident, body on demand” design matters a lot. Everyday requests carry only a very short metadata overhead, and large blocks of standards do not occupy the context window indiscriminately, so response speed and instruction completeness are both preserved. One writing principle follows directly: the description must precisely express “when to use me,” and the body must completely express “how to do it when I am used.” The two must not be mixed.

    4. Placement and Priority: Making Standards Apply in the Right Scope

    Where a skill is stored determines its effective scope. Common conventions:

    • Project level: placed in the agreed skill directory at the project root, committed with the code, shared by the team, and traceable through review.
    • Cross-tool shared level: placed in the general agent configuration directory at the project root, so the same standards can be reused by other AI coding tools.
    • User level: placed in the corresponding configuration directory under the user’s home directory, carrying personal habits and kept out of the team repository.
    • Custom extension level: additional scan directories specified through configuration, used to centrally host organization-level standards.

    When the same skill name appears in several sources, a deterministic priority rule is needed to avoid ambiguity. The common industry practice is to rank sources by weight: project level outranks user level, and dedicated directories outrank general ones. The intent is clear: standards closer to a specific project are more specific and should override more general personal preferences. Teams can build a layered governance model of “organization baseline plus project overrides” on this basis.

    An illustrative directory structure:

    1. project/
    2. ├── .dsh/skills/ # project-level skills, committed with the repository
    3. │ └── release-note/
    4. │ └── SKILL.md
    5. ├── .agents/skills/ # cross-tool shared skills
    6. └── config # may specify additional skill directories

    5. Building a Minimal Viable Skill from Scratch

    Take “generate user-facing release notes” as an example. The goal is to turn a one-off cleanup task into a stable process.

    Step one, create the directory and file. Use a short hyphenated directory name and keep it consistent with the name in the metadata to avoid loading ambiguity.

    Step two, write the header metadata, which should contain at least the name, description, and applicable scenarios:

    1. ---
    2. name: release-note
    3. description: Generate user-facing Chinese release notes from code diffs, covering changes, impact, and upgrade notes
    4. whenToUse: Use when compiling changelogs, release notes, or release announcements
    5. ---

    Step three, write the body, spelling out the steps, classification criteria, redaction requirements, and fallback strategy:

    1. # Release Note Workflow
    2. 1. Read the code diff and commit history between the current branch and the previous release point.
    3. 2. Group changes into four categories: new features / bug fixes / compatibility changes / required upgrade actions.
    4. 3. Remove internal implementation details, temporary branch names, addresses, and any credential information.
    5. 4. Mark items with uncertain impact as "pending maintainer confirmation"; inferring conclusions is prohibited.
    6. 5. Output a Chinese note of no more than 300 characters, with a list of changed files attached.

    This minimal version already has three elements: a clear input (the code diff), clear processing rules (classification and redaction), and a clear delivery format (length limit and file list). It is runnable, reviewable, and iterable, which makes it the baseline for later extension.

    6. Five Points for Writing a Good Body

    First, make steps executable. Use ordered actions that start with verbs, and avoid unverifiable statements such as “pay attention to quality.” Second, quantify decision criteria. Rewrite “concise” as a character limit, and “complete” as the fields that must be present. Third, add a negative list. Explicitly prohibiting inference, prohibiting disclosure of sensitive information, and prohibiting edits to unrelated files is more effective than repeatedly stressing positive requirements. Fourth, provide a fallback path. When input is missing or information is insufficient, require the output to list items pending confirmation rather than fabricate conclusions. Fifth, control length. An overly long body crowds out the context window, so large reference material should be externalized into files that are read on demand.

    7. Common Anti-Patterns and How to Avoid Them

    The first is a mismatch of responsibilities between metadata and body: putting trigger conditions in the body, so the skill does not trigger when it should. The second is scope that is too broad: one skill tries to cover everything from requirements to deployment, and every step ends up shallow. The right approach is to split it into several single-responsibility skills and then orchestrate them. The third is a missing acceptance step: specifying “what to do” without specifying “what counts as done,” so output quality cannot be stable. The fourth is ignoring override rules: a team places a same-named skill at the project level without realizing it has overridden the personal version, which easily leads to misdiagnosis during troubleshooting.

    8. Advanced: From a Single Skill to a Reusable Workflow

    A single skill solves a single point; a workflow solves the chain. Requirement clarification, implementation, static checks, code review, change notes, and release checks can each be made into a skill, then invoked stage by stage by an upper-level process, with a unified artifact format agreed between stages, such as a structured change list and check conclusions. Once artifacts are structured, they can be validated automatically by a pipeline, or used as part of a quality gate in a continuous integration environment, working together with general cloud capabilities such as log services and monitoring alerts to close the loop from commit to release.

    9. Team Governance: Versioning, Review, and Measurement

    Treating skills as code is the dividing line for adoption at scale. Recommendations: put skill directories under version control and route them through code review; establish naming and wording standards for descriptions to keep matching accuracy high; prepare a small set of regression cases for critical skills to verify that they trigger correctly on typical requests and produce acceptable results; periodically measure invocation counts, manual rework rate, and the proportion of items pending confirmation, and use that data to drive body optimization. When an organization has multiple sets of technical standards, adopt a layered “organization baseline plus project overrides” strategy and let local standards take effect naturally through the priority mechanism, instead of maintaining many branch copies.

    10. Conclusion

    The essence of custom skills is converting a team’s tacit experience into explicit, reviewable, and reusable instruction assets. Once you understand the capability boundary with plugins, the directory and priority rules, how to write metadata and body, and the governance and measurement methods, AI coding tools can produce stable results in high-frequency scenarios such as code review, release notes, and release checks, upgrading one-off prompting tricks into organizational capability that keeps evolving.