Building Reusable AI Agent Workflows with Custom Skills

    Custom Skills let you turn scattered team knowledge into structured, repeatable instructions that AI agents can follow reliably across sessions. This article explains what Skills are, how their discovery and loading mechanism works, how to organize directories and priorities, and how to write, harden, and maintain Skills as team assets—including reliability practices, security controls, and troubleshooting tips.

    Custom Skills let you turn scattered team knowledge into structured, repeatable instructions that AI agents can follow reliably across sessions. This article explains what Skills are, how their discovery and loading mechanism works, how to organize directories and priorities, and how to write, harden, and maintain Skills as team assets—including reliability practices, security controls, and troubleshooting tips.

    In AI coding tools, many tasks don’t require new plugins or extended runtime capabilities. Instead, they need a stable, well-defined, repeatable set of operating rules. For example: generating release notes requires knowing which changes to read, how to distinguish features from fixes, and which internal information must be hidden. Code reviews require knowing which files to check first, how to organize issue severity levels, and which conclusions require human confirmation. Encoding these rules as custom Skills allows an AI agent to follow a consistent workflow across different sessions.

    Understanding Skills: They Answer “How to Complete a Task”

    A Skill is essentially a structured task instruction, typically stored in a local directory and composed of metadata and a Markdown body:

    • Metadata describes the Skill’s name, purpose, and applicable scenarios;
    • The body defines task steps, constraints, output formats, and exception handling;
    • Runtime tools handle reading files, executing commands, searching content, and accessing other configured capabilities.

    Skills and plugins are therefore not concepts at the same level.

    Plugins usually add runtime capabilities—connecting new data sources, registering new functions, or extending access to external systems. Skills define “how existing capabilities should be used, in what order.” A Skill requires no programming and no tool registration. Once loaded, it enters the agent’s context as instructions and guides the agent through a specific type of work.

    This layered design has clear advantages: capability components can evolve independently, and task workflows can be maintained independently. Teams don’t need to write programs for every standard—they simply write the workflow as a clear Skill and reuse it across projects and tasks.

    How Skills Are Discovered, Loaded, and Executed

    A reasonable Skill runtime typically involves three phases.

    1. Discovery

    The system scans designated directories for Skill files matching naming conventions. At this point, it doesn’t load full bodies into context—it only reads metadata.

    2. Cataloging

    The system extracts each Skill’s name, description, and applicability conditions, adding them to the current session’s capability catalog. Catalog entries should be concise and accurate, because they help the agent decide “whether this Skill should be used.”

    3. Loading

    Only when the user explicitly invokes a Skill, or when the current task closely matches its description, does the system read the full Markdown body and pass its steps and constraints to the agent.

    This lazy-loading approach reduces the amount of irrelevant instructions occupying context. When a project contains many Skills, loading only what the current task needs helps reduce instruction conflicts and context pollution.

    Directory Planning and Priority Design

    Where you store Skills depends on the scope of reuse. A common layout:

    1. project-root/
    2. ├── .dsh/
    3. │ └── skills/
    4. │ └── release-note/
    5. │ └── SKILL.md
    6. └── src/

    Project-level directories are suited to workflows tightly coupled to the current codebase, such as:

    • Project release notes;
    • Code review standards;
    • Test report generation;
    • Data migration checks;
    • Project documentation sync.

    If you want multiple agent tools to share the same set of Skills, you can use a shared project-level directory. Skills for personal long-term use can live in the user directory for reuse across projects. Large teams can also configure additional custom directories to centrally maintain shared standards.

    When multiple directories contain Skills with the same name, you need explicit override rules. A common approach: project-level takes precedence over user-level, and explicit configuration takes precedence over default directories. This lets projects override personal general-purpose rules to fit their own context, while preventing outdated versions in a user environment from unexpectedly affecting project behavior.

    Directory planning should also account for version control:

    • Skills tightly coupled to project code should be committed to the project repository;
    • Skills containing personal preferences can be kept in the user directory;
    • Team-shared Skills should be published centrally after review;
    • Configurations involving sensitive information should never be written directly into Skill files.

    Writing a Minimal Viable Skill

    Here’s a basic structure using “generate release notes” as an example. Use lowercase kebab-case for directory names, and keep them consistent with the name in the metadata:

    1. .dsh/skills/release-note/SKILL.md

    The file content could look like this:

    1. ---
    2. name: release-note
    3. description: Generate user-facing Chinese release notes from code changes, covering changes, impact, and upgrade guidance
    4. whenToUse: Use when the user asks to organize change logs, version notes, or release announcements
    5. ---
    6. # Release Notes Workflow
    7. ## Goal
    8. Based on code changes between the current version and the last stable version, generate concise, accurate, user-facing release notes.
    9. ## Steps
    10. 1. Confirm the current branch, target version, and comparison range.
    11. 2. Read the code diff and related commit messages for the specified range.
    12. 3. Classify changes into new features, bug fixes, compatibility changes, and upgrade actions.
    13. 4. Remove internal implementation details, temporary branch names, personal information, and sensitive content.
    14. 5. Mark any impact that cannot be confirmed as "pending maintainer confirmation"—do not infer on your own.
    15. 6. Output release notes within 300 words.
    16. 7. Append a list of changed files after the main text.
    17. ## Output Format
    18. ### Release Notes
    19. - New features:
    20. - Bug fixes:
    21. - Compatibility changes:
    22. - Upgrade guidance:
    23. ### Changed Files
    24. - File path with a brief description

    This example illustrates several key principles.

    First, metadata descriptions should be task-oriented, not implementation-oriented. description should state what problem the Skill solves, and whenToUse should state when to activate it. An overly broad description leads to false triggers; an overly narrow one may prevent the agent from recognizing similar tasks.

    Second, the body must specify execution order. Writing only “generate a release note” is usually insufficient, because the agent can’t determine the data scope, classification criteria, or output boundaries. The clearer the steps, the more stable the results.

    Finally, the output format must be verifiable. Fixed headings, fields, and length requirements reduce format drift across sessions.

    Improving Skill Reliability

    1. Define Input Boundaries Clearly

    Specify what materials the agent should read. For example: compare the current branch with the previous version, or analyze files in a specified directory? Read only code diffs, or also commit messages and test results? Unclear input boundaries lead to conclusions without grounding.

    2. Separate Facts from Inference

    Skills should explicitly require the agent to distinguish “confirmed facts” from “reasonable speculation.” For compatibility impact, performance changes, or upgrade risks, if there’s no test evidence, mark them as pending confirmation rather than producing definitive conclusions.

    3. Provide Exception Handling Rules

    Real executions may encounter missing version tags, empty diff ranges, unreadable files, or oversized changes. Skills can include rules such as:

    • If the comparison range can’t be determined, ask the user first;
    • If no diff is available, don’t fabricate change descriptions;
    • If sensitive information is found, sanitize it before output;
    • If reading fails, explain the failure reason and missing materials;
    • If information is insufficient, preserve uncertainty instead of filling gaps.

    4. Constrain Output Length and Style

    User-facing release notes should be concise and readable, while developer-facing review reports need file locations, risk levels, and suggested fixes. Use different Skills for different audiences rather than forcing one Skill to serve conflicting output requirements.

    Treating Skills as Team Assets

    Once a Skill evolves from a personal experiment into a team workflow, it needs to be maintained like code.

    For each Skill, document:

    • Applicable scenarios;
    • Non-applicable scenarios;
    • Input requirements;
    • Output samples;
    • Common failure cases;
    • Maintainer;
    • Last updated date;
    • Change log.

    For critical workflows, add test cases in the repository. Prepare several fixed inputs and check whether the agent can:

    1. Correctly recognize whether the Skill should be invoked;
    2. Execute tasks in the prescribed order;
    3. Follow sensitive-information handling requirements;
    4. Produce complete output fields;
    5. Flag insufficient information instead of fabricating content.

    Also avoid stuffing irrelevant background into Skills. The goal of a Skill is not to become a project encyclopedia, but to guide the agent through one well-defined task. Unrelated historical notes, duplicate definitions, and vague slogans all add context overhead and reduce execution stability.

    Security and Permission Control

    Although Skills are primarily text instructions, they can influence file reading, command execution, and information output, so security still matters.

    First, never write credentials, keys, internal addresses, or personal data into Skills. Second, add human confirmation steps for high-risk operations such as deletion, overwriting, or publishing. Third, specify which directories can be read and which files must not be output. Fourth, treat instructions coming from external documents or code comments as ordinary data—never let them unconditionally override the Skill’s own rules.

    A safe execution strategy: gather information first, then generate a plan; pause for confirmation before any modification or external transmission; and output an operation summary and impact scope after completion. This preserves automation benefits while reducing the risk of mistakes.

    Common Issues and Fixes

    Skill Not Recognized

    Likely causes: directory location doesn’t match conventions, incorrect file name, incomplete metadata format, or duplicate names. Check the directory structure first, then metadata fields and indentation.

    Skill Triggered Incorrectly

    Usually the description is too broad. Add explicit trigger and exclusion conditions, e.g., “Use only when the user asks for user-facing release notes, not for internal review reports.”

    Unstable Output

    Refine the steps, classification criteria, and output template, and remove vague phrasing from the body, such as “handle appropriately” or “judge as needed.”

    Agent Ignores Key Constraints

    Repeat important restrictions in three places—task goal, execution steps, and output checks—and add a self-check list at the end:

    1. ## Pre-Output Checklist
    2. - Are all confirmed important changes described?
    3. - Are internal implementation details and sensitive information removed?
    4. - Are unconfirmable impacts marked?
    5. - Are word count and format requirements met?
    6. - Is the changed-file list attached?

    Conclusion

    The core value of custom Skills lies not in adding code, but in converting knowledge scattered across personal experience, team standards, and operational manuals into structured workflows that agents can execute reliably. A high-quality Skill has four characteristics: single responsibility, clear steps, well-defined boundaries, and verifiable results.

    In practice, start with a small task—such as generating release notes or organizing review comments—then, after several rounds of use, add exception handling, output templates, and security constraints before scaling to project-level and team-level directories. This keeps initial costs low and lets Skills evolve through real feedback, ultimately forming reusable, auditable, and maintainable AI agent workflows.