A Practical Guide to Custom Skills for AI Coding Tools
This article explains how custom Skills turn one-off prompts into reusable workflows for AI coding tools. It covers the instruction-layer concept, the three-stage discovery and loading mechanism, directory locations and priority ranks, a minimal release-note Skill example, six authoring guidelines, common pitfalls, and team adoption practices. Readers will learn how to structure, place, and maintain Skills so that team standards are enforced without polluting project baselines.
1. Why You Need an Instruction Layer: From One-Off Prompts to Reusable Workflows
When teams use AI coding tools, the most common problem is not that “the model cannot write code.” It is that the same rules have to be restated in every session. Commit message formats, code review checklists, release note structures, and compatibility criteria are usually scattered across chat history, internal documents, and individual memory, so output quality varies by person and by conversation.
The essence of a custom Skill is to extract this knowledge of “how a task should be done” out of temporary conversations and turn it into a reusable task instruction stored in a local directory. A Skill describes its own metadata with YAML frontmatter, then uses a Markdown body to define the steps and constraints the agent must follow for a class of work. By design, a Skill belongs to an instruction layer that is independent of the model and the tools: it adds no runtime capability, it only governs how existing capabilities are invoked.
One boundary needs to be clear: a Skill solves “what steps a task follows,” while a plugin solves “what capability is added at runtime.” A Skill therefore requires no TypeScript and carries no tool-registration responsibility. Once loaded, its body enters the current agent context as instructions, and it can require the agent to use existing file read/write, shell, search, or MCP-style tools.
2. Discovery, Directory, and Loading: A Three-Stage Mechanism and Context Cost
Mature implementations typically split Skill handling into three stages:
- Discovery: scan candidate directories and identify Markdown files that contain frontmatter;
- Directory building: parse only the name and description to form a lightweight session directory;
- On-demand loading: inject the full body into the context only when a task matches or the user explicitly invokes the Skill.
This “directory first, body later” two-phase design directly addresses the context budget problem. Everyday requests carry only the small overhead of the directory entries, while long workflow instructions enter the window only when actually needed. This keeps unrelated content from crowding the context and keeps the list of available capabilities enumerable and discoverable.
3. Placement and Priority: Let Standards Travel With the Project
Placement determines a Skill’s lifecycle and sharing scope:
- Project level:
.dsh/skillsin the project root, best suited to being committed, reviewed, and versioned along with the code; - Cross-tool sharing:
.agents/skillsin the project root, convenient for reusing the same instructions across other agent tools; - User level:
~/.dsh/skillsor~/.agents/skills, suitable for personal high-frequency habits; - Custom directories: additional sources specified via
customSkillDirs, which fit a centralized standards repository.
The default discovery order is sorted by rank in ascending order: project .dsh/skills is 100, project .agents/skills is 200, custom directories are 300, user ~/.dsh/skills is 400, and user ~/.agents/skills is 500. A lower number means higher priority, and when Skills share the same name, the higher-priority source wins. This rule leads to an important practical conclusion: a project-level Skill can reliably override a user-level Skill of the same name, so team standards gain the ability to be enforced, while personal preferences will not accidentally pollute the team baseline.
4. A Minimal Working Example: The Release Note Workflow
Create the files from the project root:
mkdir -p .dsh/skills/release-notetouch .dsh/skills/release-note/SKILL.md
Use kebab-case for the name, and keep the directory name identical to the name in the frontmatter to avoid invocation ambiguity. Example file content:
---name: release-notedescription: Generate user-facing release notes from the Git diff, covering changes, impact, and upgrade hintswhenToUse: Use when the user asks for a changelog, release notes, or a release announcement---# Release Note Workflow1. Read the Git diff of the current branch against the previous version.2. Group entries into "new features, bug fixes, compatibility changes, upgrade actions."3. Remove internal implementation details, temporary branch names, and any credentials.4. Mark uncertain impact as "pending maintainer confirmation" instead of guessing.5. Output a Chinese note of no more than 300 characters, with a list of changed files.
This minimal example already contains four key elements: a trigger condition (whenToUse), an input source (the Git diff), a classification skeleton (the four change types), and safety constraints (redaction and uncertainty labeling).
5. Six Guidelines for Writing High-Quality Skills
- Single responsibility: one Skill covers one class of task, avoiding a “do-everything assistant” that causes trigger confusion.
- Discoverability through description:
descriptionandwhenToUsemust state the applicable and excluded scenarios clearly, since this directly determines whether the Skill can be matched correctly at the directory stage. - Verifiable steps: each step should map to an observable artifact, such as “produce a list of changed files,” so results can be checked.
- Explicit constraints on uncertain behavior: require uncertain items to be labeled rather than freely inferred, reducing the risk of misleading output.
- Built-in safety baseline: explicitly prohibit outputting credentials, internal addresses, and temporary branch names.
- Control length: an overly long body amplifies context cost, so move long reference material into external files and have the steps instruct the agent to read them on demand.
6. Common Pitfalls and a Troubleshooting Checklist
- The directory name does not match
name, causing explicit invocation to fail; - Invalid frontmatter indentation or delimiters cause the file to be skipped during parsing;
- Writing tool capabilities into a Skill and expecting it to “add features,” when a plugin should be used instead;
- Unexpected same-name override: a user-level Skill is overridden by a project-level one and mistaken for “the configuration stopped working”;
- Inaccurate triggering: the description is too abstract and lacks concrete verbs and scenario nouns;
- Context bloat: the body embeds large passages of specification text, which should instead reference document paths inside the repository.
7. Recommendations for Team Adoption
Treat Skills as reviewable engineering assets rather than personal configuration: put them under version control, run them through code review, and use project-level overrides over user-level ones according to the rank rules. Establish naming conventions and directory conventions for high-frequency workflows, and add frontmatter validation to continuous integration to ensure names are unique and fields are complete. If team standards need centralized maintenance, distribute them through a custom directory, then apply local differences with project-level overrides, balancing consistency and flexibility.
