AI Skills in Practice: A Complete Guide
This guide explains how to turn coding standards into persistent AI skills that tools can read. It covers the restaurant analogy that maps skills, agents, tool connections, global rules, and sub-agents to their roles; the folder structure and progressive disclosure loading model; five rules for writing instruction files; the division of work between scripts and reference assets; and a four-step rollout path with common pitfalls to avoid.
1. The Starting Problem: Why You Keep Explaining the Same Thing
When working with AI coding tools, the most common frustration is not limited model capability. It is that standards never stick. On the same team and in the same repository, the rule today may be “write tests before implementation,” but tomorrow, in a new session, the tool reverts to its default habits. Naming conventions, directory layout, log formats, and API error code design all have to be explained again. Communication costs are paid over and over, while output quality fluctuates from session to session.
Solving this requires extracting the “how” out of the conversation and turning it into a persistent asset the tool can read. That is the essence of a skill: a standard operating procedure written for an AI to follow.
2. A Restaurant Analogy for the Right Mental Model
Mapping the AI tooling ecosystem onto a restaurant makes each layer’s responsibility clear:
| Restaurant | Technical Role | Responsibility |
|---|---|---|
| Recipe | Skill | Defines steps, order, and acceptance criteria |
| Chef | Agent and model | The actual executor |
| Ingredients and specialized equipment | External tool connection layer | Provides data, services, and actions |
| Today’s set menu | One-off shortcut command | Triggers a single preset action |
| Basic kitchen rules | Global rules | Always-on baseline constraints |
| Sous-chef and prep cook | Sub-agents | Handle specialized collaboration tasks |
Two conclusions matter. First, the external tool connection layer answers “can we get the ingredients,” while a skill answers “once we have them, what process and standard turn them into a dish.” They complement each other rather than replace each other. Second, global rules are constants and skills are variables: rules are the place for hard constraints such as “never skip error handling,” while skills are the place for changeable processes such as “which steps a release review runs.”
3. Physical Structure and Loading Mechanics
A skill is a folder that follows an open convention. One file is required; the other directories exist only as needed:
your-skill-name/ # lowercase with hyphens├── SKILL.md # required, case-sensitive├── scripts/ # optional: executable scripts│ ├── process_data.py│ └── validate.sh├── references/ # optional: reference docs loaded on demand│ ├── api-guide.md│ └── examples/└── assets/ # optional: templates, icons, styles, and other resources└── report-template.md
Loading uses progressive disclosure across three layers:
- Metadata layer. At startup the tool scans only the name and description to judge whether the skill is relevant to the current task, at very low cost.
- Body layer. Only after a match does it read the full instruction file to obtain the complete process.
- Resource layer. Scripts and reference files mentioned in the document load only when actually needed.
The engineering value is a controllable context budget. Pushing every standard into global rules keeps consuming the window on every turn of every conversation. A skill stays out of the way until it is needed, so growing the number of skills does not linearly slow down everyday interaction.
4. Five Rules for Writing a High-Quality Instruction File
The instruction file is not an introductory article. It is a set of operating instructions, and it should follow these rules:
- State triggers up front. Make “when to use this skill” explicit at the top to avoid false triggers.
- Make steps verifiable. Rewrite “optimize this” as “confirm that an empty input array returns an empty result and does not throw,” so the outcome can be checked.
- Include counter-examples. “Do not edit files under the generated directory” is far more effective than “pay attention to conventions.”
- Control length. Keep the body concise and move long tables and long specifications into the references directory.
- Define acceptance. List the definition of done, for example “the change ships with matching test cases and static checks report no warnings.”
A sample document skeleton:
---name: api-change-reviewdescription: Use when reviewing API changes or generating change notes---## When to Use- Adding or modifying public API definitions- Changing error codes and response structures## Steps1. Read the naming and versioning conventions in references/api-guide.md2. Run scripts/validate.sh for a compatibility check3. Produce the change notes using assets/report-template.md## Definition of Done- Compatibility check passes- Change notes include impact scope and a rollback plan
5. Using Scripts and Resource Directories Correctly
Scripts handle deterministic work and the model handles judgment. This division is the key to stability. Anything a program can compute correctly in one pass, such as format validation, dependency scanning, or data conversion, should not be left to the model to reason through item by item. The model only decides when to call a script and how to interpret the result. Reference documents suit low-frequency, high-density content such as protocol details and edge cases. The assets directory holds reusable output templates that keep formatting consistent.
6. Rollout Path and Common Pitfalls
A four-step approach works well. Start with the single process you explain most often and write it as a minimal viable skill. Run it for two to three weeks, record deviations, and add counter-examples. Then push the stable parts down into scripts. Finally, set up a shared team directory with version control and review changes.
Common pitfalls include a directory name or main file name with the wrong casing, which prevents recognition; packing several unrelated processes into one skill, which lowers trigger accuracy; writing a description so broad that unrelated tasks match it; and putting secrets such as keys into skill files. In enterprise practice, unified identity and access management, logging services, and monitoring and alerting can audit and observe skill invocations. Baidu AI Cloud offers such general foundational capabilities in its related cloud product categories, which helps teams stay in control when rolling skills out at scale.
