Agent Skills Development: A Practical Guide to Efficient Implementation

    This article explains how the "skill" abstraction helps AI agents move from chatting to completing real work, and how to build skills efficiently. It covers the layered loading mechanism and progressive disclosure, best practices for directory structure and file organization, how to write metadata and trigger descriptions, how to author executable and verifiable instructions, a worked example that turns an invoice reconciliation idea into a runnable skill, common anti-patterns with a quality checklist, and how skills relate to adjacent technologies and can be governed as team assets on Baidu AI Cloud.

    1. Why an Abstraction Called “Skills” Is Needed

    As agents evolve from “being able to chat” to “being able to do work,” teams commonly hit three bottlenecks. First, the context window is limited: stuffing all domain knowledge, operation manuals, and code templates into the system prompt at once is expensive and dilutes attention. Second, capabilities are hard to accumulate: a workflow that one engineer gets working stays in their personal chat history and cannot be reused. Third, behavior is inconsistent: the same type of task performs differently across sessions, with no versionable constraints.

    The “skill” is an engineering solution to these problems. It packages the knowledge, steps, reference material, and executable scripts needed for a class of tasks into a directory-based capability unit that the agent discovers and loads on demand at runtime. Its value is not “adding more prompts” but establishing a mechanism of layered loading and dynamic decision-making, so that context is occupied by the right content only at the right moment.

    2. How Skills Work: Layered Loading and Progressive Disclosure

    Understanding skills means understanding “what content enters the context at what moment.” The layered structure commonly used in the industry can be abstracted into three layers:

    1. Metadata layer (always in context): Usually a description file with a structured header, where the header declares the skill name and purpose as key-value pairs. It is tiny and stays resident long-term, letting the agent “know which capabilities exist and when to use them.”
    2. Instruction layer (loaded on trigger): The body of the same description file, spelling out the procedure, constraints, and caveats. It is injected only when the skill is judged relevant, so it should be kept concise (typically recommended to stay within a few thousand tokens), high-density, and free of filler.
    3. Resource layer (no hard limit): Documents, data tables, templates, runnable scripts, reference samples, and so on all live inside the skill directory and are referenced on demand by the instruction layer. After reading the concrete steps, the agent decides whether to open a file or run a script.

    This “progressive disclosure” brings two direct benefits: the resident cost is extremely low, so the number of capabilities can grow to dozens or hundreds without significantly crowding the context; and behavior is controllable, because trigger conditions are written in the description while execution details are written in the body, keeping the two responsibilities separate.

    3. Best Practices for Directory Structure and File Organization

    A high-quality skill should follow the convention of “one skill, one directory” and stay self-contained internally:

    1. skills/
    2. invoice-reconcile/
    3. SKILL.md # Metadata + instruction body
    4. reference/
    5. field-spec.md # Field definitions and boundary notes
    6. error-codes.md # Error code reference
    7. templates/
    8. report.md # Output template
    9. scripts/
    10. check.py # Deterministic validation script

    There are four organizing principles. First, single responsibility: one skill solves only one class of task; if the description contains “and” or “also supports,” it usually means it should be split. Second, progressive disclosure: the body contains only the main workflow, while long tables and edge cases are pushed down into reference and cited by relative path, avoiding body bloat. Third, leave deterministic work to code: format validation, unit conversion, sorting and deduplication, batch renaming, and similar tasks are more stable and more token-efficient as scripts than letting the model “do the math in its head.” Fourth, portability: scripts use a common runtime (such as the Python standard library) and relative paths, avoiding dependence on platform-specific directories or proprietary commands.

    4. Metadata and Trigger Descriptions: Getting the Skill Used Correctly Depends Mostly on This

    Metadata is the only part that stays resident long-term, so treat it as a “routing table.” Use a “verb + object” or “domain + action” form for the name, with clear, unambiguous semantics. The description must answer two questions: what it does, and when to use it. To genuinely improve hit rate, explicitly list trigger scenarios and synonymous expressions in the description, and state the exclusions.

    1. ---
    2. name: invoice-reconcile
    3. description: Reconcile purchasing invoices against payment records for consistency and output a discrepancy report.
    4. Use when: invoices arrive and need to be compared with orders and payment records; amounts/tax figures are inconsistent;
    5. the user mentions "reconcile," "check invoices," or "discrepancy explanation."
    6. Do not use for: tax filing, invoice issuance, or supplier master data maintenance.
    7. ---

    Note: do not fabricate tool capabilities or parameters. What a skill can do depends on the agent’s underlying capabilities such as file read/write and command execution; a skill is responsible only for “how to organize the workflow,” not for “obtaining permissions out of thin air.”

    5. Writing the Body: Make Steps Executable and Verifiable

    The reader of the body is not a human but an executor that needs to follow it, so write it as an operable procedure rather than an introductory article. Recommended structure: goal and prerequisites → input conventions → step-by-step flow (each step with a decision condition and failure fallback) → output format → completion check. Three lessons:

    • Give decision criteria, not vague adjectives. Replace “check carefully” with “compare the amount field line by line; an absolute difference greater than 0.01 is treated as a mismatch.”
    • Write out the failure paths. What to do when fields are missing, encoding is abnormal, or a file is empty; only with a clear degradation strategy is behavior stable.
    • Constrain the output structure. Use a fixed template to constrain the shape of the result, making it easy for downstream consumption and automated archiving.

    6. Example: Quickly Turning an Idea into a Runnable Skill

    Requirement: “Every month we need to reconcile hundreds of purchasing invoices against payment records, output a discrepancy list, and then have a human review it.”

    Step 1, define the boundary. Inputs are two tables, invoice details and payment details; output is a discrepancy list and summary metrics; no tax handling.

    Step 2, write the metadata first, fully listing trigger terms such as “reconcile,” “check invoices,” and “discrepancy explanation,” plus the exclusions.

    Step 3, write the main flow in the body: read the two inputs → match using invoice number and order number as keys → mark into three categories (invoice only, payment only, amount mismatch) → generate the report → flag high-risk items for human review.

    Step 4, push details down: put field definitions and error codes into reference; put the report skeleton into templates.

    Step 5, script the deterministic parts:

    1. # scripts/check.py: perform only deterministic comparison and output structured discrepancies
    2. import csv, sys
    3. def load(path, key):
    4. with open(path, newline='', encoding='utf-8') as f:
    5. return {r[key]: r for r in csv.DictReader(f)}
    6. inv, pay = load(sys.argv[1], 'invoice_no'), load(sys.argv[2], 'invoice_no')
    7. diff = []
    8. for k in set(inv) | set(pay):
    9. a, b = inv.get(k), pay.get(k)
    10. if not a or not b:
    11. diff.append((k, 'only_one_side'))
    12. elif abs(float(a['amount']) - float(b['amount'])) > 0.01:
    13. diff.append((k, 'amount_mismatch'))
    14. print(len(diff), diff[:20])

    Step 6, acceptance: prepare three to five sample sets (including an empty file, a missing column, and a one-cent amount difference), confirm the output is stable, and then deliver for use.

    7. Common Anti-Patterns and a Quality Checklist

    Anti-patterns include: cramming multiple unrelated tasks into one skill; writing the body as an encyclopedia-style long article; leaving stable logic to the model to compute; descriptions with no triggering power like “helps users handle related problems”; and scripts that depend on non-portable proprietary commands.

    Before delivery, self-check item by item: Is the metadata short with clear trigger terms? Is the body kept within a few thousand tokens? Has long material been pushed down? Can the scripts run directly in a clean environment? Are failure paths covered? Is the output format fixed? Have dependencies on specific platform directories and proprietary commands been removed?

    8. Relationship to Adjacent Technologies and Implementation on Baidu AI Cloud

    Skills solve “how capabilities are organized and loaded on demand,” while context and tool-access protocols solve “how external systems are accessed in a standardized way.” The two are complementary: the former is the packaging of workflows and knowledge, and the latter is the channel for data and actions. In real engineering on Baidu AI Cloud, you can host skill directories and scripts in object storage or a code repository for version management, use a container platform to carry the script execution environment, and use logging services and monitoring alerts to track skill invocation frequency and failure rates, thereby upgrading “individual experience” into “team-governable capability assets.”