Agent Skills Engineering: Insights and Practices for Building Reliable AI Agents

    This article explains why adding more skills no longer improves AI agent performance and how to treat skills as infrastructure instead of a collection of prompts. It breaks down the core formula Agent = Model + Harness + Skills, then covers layered skill design, retrieval with coarse filtering and budget trimming, context token allocation, security-aware evaluation, and large-scale skill management. The goal is to turn occasional "smart moments" into stable, deliverable productivity.

    1. Background: Why Piling Up Skills No Longer Works

    For a while, the industry placed its hopes for capability gains in the sheer number of skill modules, and skill libraries and development frameworks expanded rapidly. Yet engineering practice keeps pointing to the same conclusion: the number of skills and the final outcome are not linearly related. The real bottleneck is rarely whether a skill exists, but whether it enters the context at the right moment, at the right granularity, and with the right constraints.

    A telling example comes from the AI coding tools space. In a widely reported “performance regression” incident, the model weights did not change at all. Only three runtime defaults were adjusted (the context injection strategy, tool-calling constraints, and retry logic on failure), yet users clearly felt the difference. This shows that an agent’s behavior is determined jointly by the model and the runtime. The runtime, often called the Harness in the industry, handles context management, tool interfaces, constraints, verification, and correction. It is the engineering layer that stitches together “smart moments.”

    The same logic has been validated repeatedly on the evaluation side: as frontier model capabilities converge, running the same model under different runtime frameworks can produce measured score gaps of tens of points. What really creates the gap is often not the model’s origin but the details of the engineering implementation. Skill systems therefore need to be upgraded from a “collection of materials” to “infrastructure.”

    2. The Core Formula: Agent = Model + Harness + Skills

    It helps to break capability expression into three layers:

    • Model layer: provides the foundational reasoning and generation capability; it is probabilistic and momentary.
    • Runtime layer: responsible for context orchestration, tool protocols, permissions and constraints, execution and rollback, logging and tracing.
    • Skill layer: packages domain knowledge, operating procedures, and validation rules into modules that are retrievable, composable, and verifiable.

    The relationship among the three is multiplicative, not additive: if any layer is zero, the overall capability is zero. The value of a skill lies not in “having a lot of content” but in whether the runtime can retrieve it efficiently, constrain it strictly, and verify it automatically.

    3. Layered Design of Skill Modules

    It is recommended to split skills into four types, avoiding mixing prompts, scripts, and knowledge documents in one place:

    1. Knowledge skills: glossaries, domain specifications, interface conventions; they answer “what it is.”
    2. Process skills: standard operating procedures, branch conditions, fallback paths; they answer “how to do it.”
    3. Tool skills: wrappers around callable external capabilities, including input/output schemas and error codes; they answer “what to use.”
    4. Validation skills: acceptance checklists, static check rules, test case templates; they answer “how to confirm it was done right.”

    An illustrative skill description structure (pseudocode, only expressing the field design idea):

    1. skill:
    2. name: report_aggregation
    3. type: process # knowledge | process | tool | validation
    4. when_to_use: "When generating periodic summaries across multiple data sources"
    5. inputs: { schema: "object", required: ["range", "metrics"] }
    6. constraints:
    7. max_context_tokens: 1200
    8. forbid_actions: ["delete", "publish"]
    9. verification:
    10. checklist: ["consistent definitions", "unified units", "missing data annotated"]
    11. fallback: "Degrade to templated output with a confidence note"

    Key design principle: every skill must carry its own “applicability conditions” and “verification method,” otherwise it cannot be orchestrated automatically.

    4. Retrieval: The Stage That Sets the Ceiling

    Retrieval quality determines the ceiling of the skill system. In practice, a three-stage approach of “coarse filtering + fine ranking + budget trimming” is recommended:

    • Coarse filtering: use semantic similarity and tag filtering to quickly narrow the candidate set and control latency.
    • Fine ranking: perform a second ranking based on task type, historical success rate, and timeliness to avoid “similar but useless.”
    • Budget trimming: do combinatorial optimization within the context budget; prefer fewer and accurate over more and messy.

    It is worth stressing that “negative retrieval” is equally important: explicitly stating which skills are banned in the current scenario can significantly reduce misuse. On the engineering side, you can maintain an exclusion rule table that runs in parallel with positive retrieval.

    5. Generation and Context Budget

    Injecting more skills is not better. It is advisable to set a token budget cap for skills and distinguish “always-on” from “on-demand”: always-on holds only global constraints and terminology, while the rest load on demand. For long-running tasks, use segmented loading and summary compression to avoid losing key constraints midway.

    A reusable budget allocation example:

    1. Total budget 100%
    2. ├─ System constraints 10%
    3. ├─ Always-on terms/specs 10%
    4. ├─ Retrieved skills 50% (per-skill cap 15%)
    5. ├─ Tool output 20%
    6. └─ Reserved correction room 10%

    Reserved correction room is often overlooked, but it is the prerequisite for the runtime’s “self-correction.”

    6. Evaluation: Bringing Security Holes into Regression

    The evaluation system should cover four kinds of metrics: task success rate, constraint compliance rate, average context overhead, and failure recovery rate. Beyond standard benchmarks, security regression must be added, such as scenarios for inducing unauthorized operations, leaking sensitive information, and prompt injection, forming a fixed test set that runs automatically after every skill update.

    It is recommended to build a closed loop of “skill change - evaluation - canary”: any addition or modification of a skill triggers regression, and rollout is allowed only if metrics do not degrade. This is how you avoid a repeat of the incident where “changing one default value caused an overall drop in perceived quality.”

    7. Evolution and Scaled Management

    When the number of skills reaches the order of a hundred thousand, management problems exceed algorithm problems. You need a unified metadata specification, versioning and canary mechanisms, hot/cold tiered storage, and expiration and eviction strategies; online, you also need to support recursive orchestration, where skills call skills, with hard limits on recursion depth, loop detection, and timeouts.

    Three levers at the scaling stage:

    • Standardization: unify description formats and error codes to lower the cost of cross-team reuse.
    • Observability: trace every retrieval and invocation across the full chain to locate gains and losses.
    • Automation: pipeline retrieval evaluation, generation validation, and management eviction.

    8. Implementation Advice and Conclusion

    From an engineering perspective, the right order for building a skill system is: first define runtime constraints and verification mechanisms, then build retrieval and budget strategies, and only then expand the number of skills. In related practice, Baidu AI Cloud also emphasizes using an engineering platform to carry common capabilities such as context management, tool integration, and monitoring and alerting, turning “techniques” into “assets.”

    The conclusion is clear: the model sets the floor, while the runtime and skill engineering set the ceiling. Make retrieval accurate, make constraints solid, make evaluation strict, and make management stable, and an agent’s capability will turn from occasional “smart moments” into sustainable, deliverable productivity.