Free self-study · No account needed · Progress stays in this browser. Back it up before clearing site data or changing devices.

← Week 11: Agent Skills

Week 11 / Lesson 1

Writing a reusable agent skill

Create an applicable skill with clear steps, metadata, and success checks.

Section 1.1 1 of 7

Overview

Focus

Create an applicable skill with clear steps, metadata, and success checks.

Your route through the lesson

  • 1.2 Skills, prompts, and executable tools
  • 1.3 The SKILL.md file and its metadata
  • 1.4 Discovery, trigger descriptions, and non-trigger cases
  • 1.5 Put it into practice
  • 1.6 Guided comparison
  • 1.7 A request near a skill trigger boundary

All required teaching is included here. Review selections are saved. Choose a correct answer for every question to continue; retries are unlimited. Study time and personal notes are optional.

Section 1.2 2 of 7

Skills, prompts, and executable tools

Focus

Explain how a reusable procedure differs from a prompt and an executable tool.

A skill packages instructions and supporting material for a recurring task. A prompt is the input given to a model for a particular interaction. A tool is executable functionality controlled by an implementation and its permissions. A skill can tell an agent when to inspect a repository or run a supplied checker, but it cannot itself grant permission to execute that checker or modify the repository.

Imagine a documentation skill that says to identify the audience, inspect relevant source, draft a usage example, and check that the example agrees with the implementation. The procedure can improve consistency across many requests. The file-reading tool still controls which files can be read, and the writing tool still controls which paths may be changed.

Packaging also creates maintenance obligations. A reusable procedure needs a clear applicability description, ordered steps, required inputs, failure handling, and observable success checks. “Write excellent documentation” is only an aspiration. “For each public command, show one valid invocation and its expected output, checked against the supplied implementation” defines behavior a fixture can assess.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A documentation skill says to edit a restricted file. What grants actual write authority?
2. Which skill instruction has an observable success check?
3. How does a tool differ from a skill?

Section 1.3 3 of 7

The SKILL.md file and its metadata

Focus

Create a valid SKILL.md file with useful metadata and explicit completion criteria.

The portable Agent Skills format uses a directory containing SKILL.md. The file begins with YAML frontmatter: a small metadata block between lines containing three hyphens. Markdown instructions follow it. The required fields are name and description. The name matches the directory, uses lowercase letters, digits, and single hyphens, and is at most 64 characters. The description is nonempty, at most 1,024 characters, and explains both behavior and applicability.

A small example names a directory repository-analysis and starts with name: repository-analysis. Its description says it maps source structure and dependencies when the user requests repository architecture analysis. The body explains how to inspect entry points, trace dependencies, report uncertainty, and stop when required source is unavailable.

Optional metadata can record a version as a string. A version records which procedure produced an output; it is not evidence of correctness. The official format specification provides exact constraints and optional fields. Reading that reference needs internet access but no account; everything needed for the core lab is taught here. The lab validates only its documented frontmatter subset rather than claiming to implement every YAML feature.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A skill directory is repository-analysis but frontmatter says name: repo-review. What should validation detect?
2. Which description best supports discovery?
3. A lab parser supports only simple name, description, and metadata fields. What should its report claim?

Section 1.4 4 of 7

Discovery, trigger descriptions, and non-trigger cases

Focus

Use positive and near-miss cases to test whether a skill should activate.

Discovery presents candidate skill names and descriptions before loading complete procedures. A trigger is the condition that makes a skill applicable. A non-trigger case resembles the task’s vocabulary but should not activate it. Testing both reduces accidental loading and missed assistance.

For repository-analysis, “Explain how this repository’s entry points connect” is positive. “Explain what a repository is” is a near miss: it asks for a general definition, not inspection of a specific codebase. For documentation, “Write a usage guide for this command” is positive, while “Read this existing guide and answer a question” need not trigger the authoring procedure. For troubleshooting, “Diagnose this traceback” is positive, while “Define the word traceback” is a near miss.

A deterministic activation fixture can encode these expected decisions, making description changes testable. It does not prove that every language model will interpret the description identically. Record false activations and missed activations separately. An always-on skill can appear to have no misses while imposing irrelevant instructions on every task, so positive-case accuracy alone is insufficient.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A user asks “What is a repository?” Should a skill for inspecting a specific codebase necessarily activate?
2. A trigger test includes only positive requests. Which failure can it miss?
3. A deterministic trigger classifier passes six fixtures. What remains uncertain?

Section 1.5 5 of 7

Put it into practice

Focus

Package three temporary skills and run their metadata and activation fixtures.

Save week11.py in your exercise folder and run python week11.py --lesson 1. The lab creates repository-analysis, documentation, and troubleshooting directories inside a temporary exercise root. Each contains a real SKILL.md. It validates metadata and tests a positive request and a near miss for each procedure. Nothing is installed into your personal assistant configuration.

pathlib is Python’s standard-library path interface. Path / "name" joins a path component; write_text writes text with an explicit encoding:

from pathlib import Path
import tempfile
with tempfile.TemporaryDirectory() as folder:
    skill = Path(folder) / "repository-analysis"
    skill.mkdir()
    (skill / "SKILL.md").write_text("---\nname: repository-analysis\ndescription: Analyze repository architecture.\n---\nInspect entry points.\n", encoding="utf-8")
    assert (skill / "SKILL.md").is_file()

The with block removes the temporary directory afterward. The full lab adds complete procedures and failure fixtures. Expect all three metadata checks and six activation decisions to pass. These checks evaluate packaging and the supplied classifier, not model behavior or permission to run arbitrary bundled code.

Download this week’s Python lab ↓

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. What does Path(folder) / "repository-analysis" do?
2. The lab creates SKILL.md only inside a temporary root. What persists after cleanup?
3. Three metadata checks pass. Does that establish that every procedure is appropriate for every task?

Section 1.6 6 of 7

Guided comparison

Focus

Explain metadata, activation, and behavioral checks as separate evidence.

The completed repository-analysis package has matching name and directory, a specific description, and steps that identify entry points before describing dependencies. The positive request activates it, while the general-definition near miss does not. This establishes the expected boundary for the supplied discovery fixture.

The documentation package activates for authoring a command guide. Its body requires an invocation, expected output, and an implementation check. A metadata validator cannot verify those steps were followed; a behavioral fixture must inspect the produced artifact. The troubleshooting package similarly requires a reproducible symptom, a hypothesis tied to evidence, and a bounded diagnostic step.

The lab also changes a name to contain consecutive hyphens and removes a required description. Both packages fail validation before activation is considered. These failures do not mean the underlying task is impossible; they mean the portable package is malformed. Keeping failure categories separate helps maintenance: repair metadata for a format defect, refine trigger wording for a false activation, and revise the procedure or supporting assets for an incorrect output.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A skill has valid metadata but produces a guide without expected output. Which kind of check should catch this?
2. A package name contains consecutive hyphens. Which boundary failed?
3. A skill activates on a general definition request it should ignore. Which improvement is most direct?

Section 1.7 7 of 7

A request near a skill trigger boundary

Focus

Apply a trigger boundary to a request that mentions a domain without requesting its procedure.

A user asks, “Why does this troubleshooting guide use the word rollback?” The request mentions troubleshooting but asks for an explanation of language in an existing document. Activating an incident-diagnosis skill could lead the assistant to request logs, inspect services, or propose unnecessary changes.

A completed applicability decision reads the requested action: explain a term in supplied text. It answers from that context without launching diagnosis. If the user instead says, “The service fails after rollback; diagnose this traceback,” the evidence and requested action match troubleshooting. The same keyword appears in both, but their purposes differ.

This transfer case teaches discovery as task interpretation rather than simple keyword spotting. A skill description should state what work it performs and enough exclusions to distinguish close neighbors. The lab’s deterministic fixtures encode the boundary explicitly; an actual assistant’s discovery behavior must be tested with its real model and prompt configuration. A correct non-trigger is useful success, because it avoids unnecessary context loading and irrelevant operational behavior.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. “Explain the word rollback in this guide” mentions troubleshooting. Which action is actually requested?
2. “The service fails after rollback; diagnose this traceback” differs because it requests what?
3. Why count a correct non-trigger as success?

Your personal notes

Optional, ungraded, and saved only in this browser. Export a backup from the Academy homepage to keep them.

References and further reading
Ask your own AI assistant

Copy this prompt into an assistant you already use. Nothing is sent automatically, and your personal notes are not included.

Next lesson: Loading a skill and its supporting files →