Designing and Practicing an AI Agent Skill System
This article explores the design and implementation of a skill system for AI agents, distinguishing it from project memory, tools, and hooks. It introduces progressive disclosure for context management, outlines criteria for valuable skills, and provides a practical template for creating executable skills. Additionally, it covers best practices for permissions, sub-agents, dynamic injection, and maintaining a team skill stack to transform AI agents from chat-based editors into predictable engineering assistants.
While models provide general reasoning, skills encapsulate procedural knowledge—“how to handle this specific type of task.” The same model equipped with validated skills often feels not just “smarter,” but capable of delivering through stable workflows: less repetitive explanation, fewer deviations, and no one-time instructions hard-coded into every conversation.
1. Clarify Concept Boundaries
In practice, it is easy to mix up several mechanisms. They can be distinguished by “when they enter the context and what problems they solve.”
- Project Memory: Stable constraints carried into every session, such as directory conventions, coding styles, and prohibited actions. It is suitable for short, true, and long-term valid information, not for stuffing an entire operation manual.
- Tools and Data Access: Allow agents to call external systems, such as code repositories, issue trackers, object storage, logs, and monitoring. This solves “inaccessible data and actions” but does not teach judgment sequencing.
- Event Hooks: Automatically execute checks or formatting at nodes like saving, committing, or deploying. This solves “don’t forget to do it” but does not handle complex branch reasoning.
- Packaging and Distribution: Bundle skills, commands, and access configurations into installable units to solve team synchronization; it is not a specialty in itself.
- Skills: Procedural knowledge written as instructions loaded only when hit by a task. It teaches steps, acceptance criteria, and how to roll back upon failure, rather than simply connecting a new interface.
In short: the access layer provides hands and feet, memory provides the baseline, hooks provide automatic actions, and skills provide reusable practices.
2. Progressive Disclosure: The Core Model for Context Control
If skills are injected in full at startup, dozens of long documents will occupy the context window, slowing down reasoning and making it more susceptible to interference from irrelevant instructions. A safer approach is hierarchical loading.
Layer 1 exposes only metadata: name, a one-sentence capability, and applicable/non-applicable scenarios. At startup, the system knows “what specialties exist” without reading the full text. Metadata must be distinguishable: if two skills both say “helps you write code,” hits will be random.
Layer 2 reads the main text after task matching: goals, inputs/outputs, steps, checklists, prohibitions, and examples. The main text should be independently executable, not relying on the reader recalling a past chat.
Layer 3 reads attachments on demand: long templates, domain glossaries, script descriptions, and test samples. These are only opened when the current step actually needs them, preventing edge-case material from flooding the context prematurely.
The value of this mechanism is not “more features,” but shifting the cost from “teaching every time” to “teaching only upon a hit.” Using conversational programming tools raw is like hiring a smart newcomer without a job manual every time; with skills in place, the SOP is ready, and the model only needs to execute and adapt within constraints.
3. What Kind of Skills Belong in the Skill Stack?
Selection should not be based on trends, but on whether it reduces rework. Use the following criteria for admission:
- Clear triggers: What requests must use it, and what explicitly should not. Vague skills will hijack tasks.
- Verifiable steps: Each step has inputs, actions, and completion criteria, rather than vague “try to write well.”
- Clear failure paths: Where to stop and what to confirm with a human when permissions are insufficient, tests fail, or information is missing.
- No overlap with memory: Global norms stay in project memory; skills only write the extra process for that specific scenario.
- Maintainable: Has an owner, version, and change log. Outdated steps are more dangerous than no skills, as they will mislead the model with an “authoritative tone.”
- Auditable source: Prioritize text reviewed by the team and tested in real repositories, rather than bulk instructions from unknown sources. External materials should be read by a human before merging, removing over-privileged, externally-linked, and ambiguous “ignore existing constraints” sentences.
4. Write a Runnable Skill in Ten Minutes
A minimal skill should be fixed to six sections, using plain text, without relying on a specific product’s proprietary field names.
- Name: Verb plus object, e.g., “Test-driven implementation of API changes.”
- Description: 30 to 80 words, clarifying input, output, and constraints.
- When to use / When not to use: Provide two typical user phrases for each.
- Process: Numbered steps, one action per step.
- Definition of Done: Tests pass, diffs are explainable, scope of changes is not expanded.
- Example: A concise good sample and a common bad sample.
An illustrative structure is as follows, explaining only the information organization method, not a platform-specific configuration spec:
name: Add regression test for defect and perform minimal fixdescription: Reproduce the defect within the existing test framework, write a failing test case first, make minimal code changes, and explain the reasonwhen_to_use: User provides failure symptoms, logs, or expected behavior, and allows modifying tests and implementationwhen_not_to_use: Requirements are undefined, large-scale refactoring is needed, or environment to run tests is missingsteps:1. Restate the defect and acceptance criteria; if information is insufficient, only ask questions2. Locate relevant modules and existing tests without expanding the search scope3. Add a regression test case that consistently fails first4. Make minimal changes until the test case passes, without opportunistically refactoring unrelated code5. Summarize the reason, changed files, and uncovered risksdone_when: The newly added test case transitions from failure to pass, and remaining risks are explained
Follow three disciplines when writing. Use imperative sentences for steps, avoiding “you might consider.” Each step should be checkable by a human or automated check. Write team-specific pitfalls into “Prohibitions,” such as not skipping authentication checks, not hardcoding keys into examples, and not relaxing assertions just to pass tests.
5. Permissions, Sub-agents, and Dynamic Injection
As skills become more powerful, the risk mainly comes from “what it can do,” not “how well it is written.”
Permissions should be minimal by default. Read-only analysis, writable workspace, executable tests, and external system access should be divided into different levels. High-risk actions (deletion, publishing, changing production configs, external sending) should either not be included in skills or explicitly require human confirmation. Skill text should not contain usable keys, intranet addresses, or personal data; when access is needed, use existing managed credentials and tool access rather than copying secrets into instructions.
Sub-agents are suitable for parallel, clearly bounded subtasks, such as separately checking API contracts, scanning test gaps, and drafting change logs, which are then aggregated by the main process. They are not suitable for splitting the same vague requirement among multiple agents for free play, as the merging cost will exceed the benefits. Each subtask should have an independent definition of done and a context limit to prevent pasting long logs back and forth.
Dynamic injection refers to temporarily attaching skills based on task, repository, or role, rather than loading all skills for everyone permanently. For example, a code review role only attaches quality and security checklists, while a documentation role only attaches structure and terminology norms. Injection rules themselves should be auditable: who enables what under what conditions, and which takes precedence in conflicts. When two skills give opposite formatting requirements for the same file, the priority should be specified in project memory, rather than relying on the model to reconcile.
6. A Maintainable Personal or Team Skill Stack
There is no need to pursue quantity. Layering by workflow is more useful.
- Understanding Layer: Reading unfamiliar modules, locating suspicious changes based on logs, summarizing API contracts. Read-only, emphasizing evidence and uncertainties.
- Implementation Layer: Test-first, small-step commit messages, changes by module boundaries. Emphasizing minimal diffs.
- Verification Layer: Running agreed tests, checking error handling and boundaries, ticking off against requirements. If it fails, return to the implementation layer rather than claiming completion.
- Expression Layer: Writing conclusions as change logs, review comments, or operation records, distinguishing facts from inferences.
- Collaboration Layer: When to escalate to humans, what context is needed, and what decisions cannot be made by the agent.
Conduct a skill health check every quarter: merge duplicates, delete never-hit items, and write corrections that repeatedly appear in conversations back into the corresponding skills. The skill stack is a moat, provided it records the real pitfalls your team has stepped into and still-valid norms, rather than expired slogans.
7. Common Failures and Corrections
If a skill is not triggered, it is mostly because the description is disconnected from actual phrasing; user-level trigger examples should be added. If a skill is abused, it is usually because “when not to use” is missing or the description is too broad. Unstable execution often means multiple decisions are stuffed into one step without criteria; steps should be split or branches written as explicit conditions. If the context still bloats, it means attachments are referenced prematurely, or project memory and skill text are duplicated.
Finally, skills cannot replace design and responsibility. They are suitable for turning repetitive, checkable professional actions into default paths; when it comes to security boundaries, data compliance, and production changes, humans remain the final confirmers. Treat the model as a shared brain, skills as private and versionable muscle memory, add minimal permissions and clear definitions of done, and the agent will transform from a “chat-based editor” into a predictable engineering assistant.
