Agent Skill Bootstrap: Driving Skill Generation with a Skill Specification

    As agentic coding tools treat skills as first-class assets, teams accumulate procedural knowledge packaged as folders with a main instruction file and optional resources. The problem is that skills grow faster than the conventions meant to govern them, leading to inconsistent metadata, naming, parameter descriptions, and step granularity. This article frames "using skills to write skills" as a bootstrap engineering problem. It explains the technical structure of a skill and its directory contract, identifies three common format defects (undiscoverable descriptions, unexecutable steps, unreachable resources), and proposes a five-stage generation loop: intent clarification, skeleton generation, resource planning, instruction refinement, and validation with regression. It also provides a practical validation checklist and a minimal self-check script, plus advice on treating the skill repository like a code repository with CI-based format checks and regression tests.

    1. The Problem: A Format Governance Gap in a Thriving Skill Ecosystem

    Once agentic coding tools treat “skills” as first-class citizens, team assets start to accumulate large amounts of procedural knowledge packaged as a directory plus documentation files. A typical package contains one required main instruction file and optional resources such as reference documents, templates, and scripts. The problem is that skills tend to grow faster than the team’s ability to define and enforce conventions. As a result, skills in the same batch differ noticeably in metadata fields, naming style, parameter descriptions, and step granularity, which reduces the stability of dynamic discovery and loading by agents.

    So “using skills to help write skills” is not a conceptual game. It is a classic bootstrap engineering problem: turn the act of writing a skill into procedural knowledge that an agent can execute repeatedly, then use validation and feedback loops to guarantee output quality.

    2. The Technical Nature of a Skill and Its Directory Contract

    From an implementation perspective, a skill is a folder. It must contain a main instruction file that carries metadata and core instructions. Everything else is optional, such as form-filling guides, API references, output templates, and executable scripts.

    A representative directory structure looks like this:

    1. demo-skill/
    2. ├── SKILL.md # Required: metadata + core instructions
    3. ├── forms.md # Optional: structured form-filling guide
    4. ├── reference.md # Optional: detailed API and field reference
    5. └── scripts/
    6. └── extract.py # Optional: deterministic processing script

    The header of the main instruction file is usually a block of structured metadata, while the body contains operating instructions aimed at the agent. A minimal example:

    1. ---
    2. name: pdf-form-filling
    3. description: Identify form fields and generate a filling mapping; suitable for structured document processing
    4. ---
    5. ## When to Use
    6. Use this skill when the task involves form field extraction and mapping.
    7. ## Steps
    8. 1. Call scripts/extract.py to extract fields
    9. 2. Generate the mapping based on forms.md
    10. 3. Output JSON, marking missing fields as null

    The key insight here is that metadata determines whether a skill can be discovered, while the body determines whether execution is stable. These are contracts at different layers and should not be mixed into a single block of prose.

    3. Why a Meta-Skill Is Needed: Three Frequent Format Defects

    In practice, format defects are highly concentrated and fall into three categories.

    The first is an undiscoverable description. The metadata description is too abstract, for example “used for processing documents.” The agent cannot determine the applicability boundary, so it fails to load when it should and loads when it should not.

    The second is unexecutable steps. The body is written as a statement of goals rather than a sequence of operations, missing inputs, outputs, failure fallbacks, and termination conditions. The agent is left to improvise, and output variance increases.

    The third is unreachable resources. Path references to scripts and reference documents do not match the actual directory, or scripts lack parameter descriptions and dependency declarations, so they cannot run after loading.

    The value of a meta-skill is precisely to turn these three defect types into automatically detectable rule items.

    4. The Bootstrap Generation Flow: A Five-Step Loop

    It is advisable to break “writing a skill” into five reusable stages and have the agent produce verifiable intermediate artifacts at each stage.

    1. Intent clarification: define the task the skill solves, its applicable and non-applicable boundaries, and the expected output structure.
    2. Skeleton generation: produce the directory and a draft of the main instruction file’s metadata first, without writing body details.
    3. Resource planning: decide whether scripts, reference documents, and templates are needed, and list the responsibility of each resource.
    4. Instruction refinement: rewrite the process as numbered steps, adding inputs, processing, outputs, and exception handling step by step.
    5. Validation and regression: run the skill against a fixed set of test cases and compare whether the output structure matches expectations.

    Step five is the most easily overlooked yet the highest-return part. Skill documentation without regression cases is essentially code without tests.

    5. The Validation Checklist: Turning Conventions into Executable Rules

    The conventions can be turned into a checklist for both human review and agent self-checking:

    • Metadata fields are complete, and the description includes “when to use” and “when not to use”;
    • Directory depth does not exceed three levels, and naming uses lowercase letters and hyphens;
    • Body steps are a numbered list, with no more than two actions per step;
    • All resource reference paths actually exist;
    • The output format has a clear example, and missing-value handling is defined;
    • At least three regression cases are prepared, covering normal, boundary, and failure paths.

    The corresponding self-check script can be very simple:

    1. import re, pathlib, sys
    2. def check(root: pathlib.Path) -> list[str]:
    3. errs = []
    4. main = root / "SKILL.md"
    5. if not main.exists():
    6. return ["Missing SKILL.md"]
    7. text = main.read_text(encoding="utf-8")
    8. if not re.match(r"^---\n.*?\n---\n", text, re.S):
    9. errs.append("Metadata block missing or malformed")
    10. for ref in re.findall(r"(?:scripts/|reference\.md|forms\.md)", text):
    11. if not (root / ref).exists():
    12. errs.append(f"Resource reference does not exist: {ref}")
    13. return errs
    14. if __name__ == "__main__":
    15. problems = check(pathlib.Path(sys.argv[1]))
    16. print("\n".join(problems) or "OK")

    6. Engineering Recommendations

    At the team level, it is advisable to govern the skill repository like a code repository: the directory is the module, the main instruction file is the interface documentation, scripts are the implementation, and regression cases are the tests. The continuous integration stage can include format validation and case regression to keep conventions from staying only on paper.

    If runtime environments and resource distribution are involved, general cloud capabilities can be used, such as object storage for skill packages, a container platform for isolated execution environments, and logging services with monitoring and alerting to track invocation anomalies. These are common industry categories, and specific choices should be evaluated against the team’s existing infrastructure.

    7. Conclusion

    The key to making “using skills to help write skills” work is not finding some magical tool. It is making conventions explicit, turning the process into steps, and automating validation. When metadata is discoverable, the body is executable, resources are reachable, and cases are regression-testable, all at the same time, skill assets truly gain the ability to evolve sustainably, and the stability of agent output improves accordingly.