How to Write Agent Skills: A Practical Guide
This article explains how to write reusable agent skills that turn one-time instructions into persistent capabilities. It covers why skills matter for repetitive workflows, the progressive disclosure design principle with its three-level structure, how to define boundaries before writing instructions, two common patterns (standalone skills and skills combined with external tools), and how to test, iterate, and distribute skills across a team.
1. Why Skills: From Repeated Conversations to Reusable Capabilities
In day-to-day development work, one of the biggest sources of inefficiency between users and AI coding tools is having to restate preferences, processes, and background knowledge in every session. Project context, code style, review rules, and document templates get rebuilt in the context window again and again, which wastes time and makes output quality fluctuate with how things are phrased. This is exactly the problem skills solve: they turn one-time explanations into a persistent asset that an agent can reuse automatically in later tasks.
Skills are best suited to high-frequency, repetitive workflows. Examples include generating a frontend page skeleton from a requirements document, completing research with a consistent analysis framework, producing documents from team templates, or chaining multiple steps into a single end-to-end process. Skills do not replace tool calls; they add a layer of orchestration and constraints on top of tool capabilities, turning raw capability access into a stable, predictable workflow. For developers building their own tool integrations, this abstraction is equally useful: it packages scattered interfaces into actions with clear business semantics.
There are roughly three groups of users: developers who want an agent to follow a fixed process over the long term; advanced users who want to preserve personal preferences and habits; and teams that need to unify collaboration standards within an organization.
2. Core Design Principle: Progressive Disclosure
The first principle of skill design is progressive disclosure: load information in layers by relevance instead of filling the context all at once. A typical implementation has three levels:
- Level one is the metadata header, usually a key-value block at the top of the file that stays in the agent’s resident prompt at all times. It keeps only the name and a short description, so the model can decide “does the current task need this skill.”
- Level two is the skill body, read only after the skill is judged relevant. It carries the full instructions, constraints, steps, and examples.
- Level three is the associated files, such as templates, checklists, and reference samples, which the model consults on demand.
A sample structure looks like this:
my-skill/skill.md # Metadata header + main instructionstemplates/ # Level three: template fileschecklists/ # Level three: acceptance checklistsexamples/ # Level three: positive and negative examples
This layering brings three direct benefits: controlled resident cost, accurate triggering, and easy extension. Note that the metadata description should state “when to use” rather than “how powerful it is”; otherwise it will cause false triggers.
3. Planning and Design: Define Boundaries First, Then Write Instructions
Before writing a skill, answer four questions: what is the trigger scenario; what are the input and output shapes; which steps must the model decide on its own; and which results must be verifiable. Blurred boundaries are the leading cause of skill failure.
For the body, follow these conventions: describe actions with imperative sentences; break the process into ordered steps; give positive and negative examples for key constraints; push volatile details down to level-three files; and avoid packing unrelated responsibilities into the same skill. If you find a lot of “it depends” in the description, it usually means the skill should be split into several smaller units.
4. Two Common Patterns
The first is a standalone skill that contains all instructions and resources itself, suitable for personal productivity scenarios and single-responsibility processes. The second combines a skill with external tool capabilities: the tool connects data sources and performs actions, while the skill handles the order of orchestration, parameter conventions, and result validation. The latter fits enterprise scenarios better because it upgrades “able to call” into “calling according to spec.”
5. Testing, Iteration, and Distribution
Testing should cover three kinds of cases: ones that should trigger, ones that should not, and borderline ones. Metrics to watch include trigger accuracy, step completeness, and whether output matches the template. When iterating, prioritize editing the metadata description and step order rather than continually appending patch-style notes. For distribution, teams can manage versions through a shared directory or an internal artifact repository, with change records and owner information to keep standards traceable. In related engineering practice, Baidu AI Cloud generally recommends putting skills under version control and review, treating them the same as code assets.
6. Conclusion
The essence of a skill is making tacit experience explicit and turning one-time communication into an asset. Once you grasp the three-level structure, boundary definition, and the combined pattern, you can usually build your first usable skill in about a dozen minutes, and through continuous iteration it becomes a stable productivity foundation for the team.
