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 2

Loading a skill and its supporting files

Load only the procedure and supporting assets needed for the current task.

Section 2.1 1 of 7

Overview

Focus

Load only the procedure and supporting assets needed for the current task.

Your route through the lesson

  • 2.2 Progressive disclosure
  • 2.3 References, templates, and relative paths
  • 2.4 Bundled scripts, dependencies, and authority
  • 2.5 Put it into practice
  • 2.6 Guided comparison
  • 2.7 A missing versioned reference file

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 2.2 2 of 7

Progressive disclosure

Focus

Load metadata first and supporting detail only when the task requires it.

Progressive disclosure means revealing information in stages. A skill catalog exposes concise names and descriptions. Once a task matches, the assistant loads the main procedure. Only when a specific step needs a reference, template, or script does it load that supporting asset. This reduces irrelevant context and makes dependencies visible.

Consider a documentation skill with a 300-word main procedure and a 2,000-word command reference. A request to explain the workflow may need only the main file. Writing a release guide for a particular command may need the corresponding reference section. Loading the entire catalog and every reference for every request wastes context and can introduce unrelated instructions.

Less context is not automatically better. Omitting a necessary reference can make the output incomplete or wrong. The goal is sufficient relevant context, measured against the task’s acceptance checks. The lab records each loaded path and character count. Character counts are an explicit storage measure, not token counts, since different tokenizers split the same text differently.

// 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 catalog contains descriptions and many large references. What should a relevant task load first after discovery?
2. A reference is necessary to verify a command option. Is omitting it a successful context reduction?
3. The lab reports loaded characters. Can that be labeled an exact model-token count?

Section 2.3 3 of 7

References, templates, and relative paths

Focus

Resolve references relative to the skill root and check asset compatibility.

A supporting reference explains details; a template supplies an output structure; a script performs a defined computation. These roles should be explicit in the main procedure. A reference path such as references/commands-v1.md is resolved relative to the skill directory, not the caller’s current working directory.

Suppose the skill lives at exercise/documentation. Joining that root with references/commands-v1.md finds the intended file even if the program launches elsewhere. Resolve the final path and ensure it remains under the permitted skill root. A path containing parent traversal must not silently load unrelated private files.

Version compatibility also matters. A main procedure for schema version 2 may require a version 2 template. A version 1 template with similar wording can omit a required field and produce a plausible but invalid artifact. Record dependencies and their expected versions, then validate them before generating output. A missing required reference is a blocked dependency with a useful error, rather than permission to invent the missing rules.

// 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 references references/commands-v1.md. Relative to what should that path resolve?
2. A resolved supporting path escapes the permitted skill root. What should the loader do?
3. A version 2 procedure requires a new template field. Only a version 1 template exists. What is justified?

Section 2.4 4 of 7

Bundled scripts, dependencies, and authority

Focus

Execute only understood bundled scripts within explicit permissions and dependencies.

Bundled code is executable behavior, not merely more prose. Before using a script, identify its purpose, inputs, outputs, dependencies, and effects. A skill that says “run scripts/check.py” does not establish that the script is safe or that the user authorized every effect it might perform. The executor still controls paths, environment, network access, time, and output limits.

The lab’s checked script counts fixture headings. It uses only the standard library, reads a specified temporary file, and prints a small result. The caller invokes the Python interpreter directly with an argument list, without a shell. A timeout prevents a stuck child from blocking indefinitely.

A missing dependency should be reported before claiming success. If a script requires an unavailable library, a prerecorded output is not an executed check. The main procedure can offer a documented alternative, but the report must say which path actually ran. This preserves the difference between reading instructions, interpreting a reference, and executing real code.

// 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 says to run a bundled script. What should still be checked?
2. Why invoke a known Python script with an argument list and no shell?
3. A required library is absent, but a prerecorded result is available. What should the report say?

Section 2.5 5 of 7

Put it into practice

Focus

Trace loaded assets and run one bounded supplied checker.

Save week11.py in your exercise folder and run python week11.py --lesson 2. The lab splits a real temporary documentation package into a main file, a versioned reference, a template, and a checked script. It prints loaded paths and character totals, runs the script with a timeout, then removes a required reference and verifies a dependency error.

subprocess runs a separate process. sys.executable selects the same Python interpreter as the current program. capture_output collects the child’s text rather than mixing it with protocol or test output:

import subprocess, sys
result = subprocess.run([sys.executable, "-c", "print(2 + 3)"],
                        capture_output=True, text=True, timeout=2, check=True)
assert result.stdout.strip() == "5"

The literal -c program here is supplied trusted teaching code, not model-generated input. The weekly file executes a known script path within its temporary root. check=True treats a nonzero exit status as failure. Expected output includes a verified heading count and a controlled missing-reference error, not a fabricated complete artifact after dependency loss.

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 sys.executable select in a subprocess call?
2. What does check=True do when the child process exits unsuccessfully?
3. The required reference is removed in a negative fixture. What should the loader produce?

Section 2.6 6 of 7

Guided comparison

Focus

Compare sufficient staged loading with a long embedded procedure.

The completed trace starts by loading catalog descriptions. The documentation task matches one description, so the loader reads that SKILL.md. Its procedure requires commands-v1.md and guide-v1.txt for a release guide, so those two assets are loaded. The heading checker runs only because this artifact needs structural verification. Repository-analysis and troubleshooting references remain unloaded.

The comparison baseline embeds every procedure and reference in one long prompt. Both paths produce the same deterministic fixture guide and pass the same required-field checks. The staged path loads fewer characters for this case. That demonstrates a context-size difference and contract equivalence in the fixture, not lower model cost or better generated prose, since no model call occurred.

When the required command reference is missing, the staged path refuses to produce a complete guide. This is correct failure handling, even though a naive character metric would call the smaller load an improvement. Report correctness, dependency failures, and loaded context together. Optimizing only length can reward leaving out the very information that makes the procedure reliable.

// Quick review

Check your understanding.

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

1. Two fixture paths produce the same valid guide, and one loads fewer characters. What is supported?
2. The smallest load omits a required reference and cannot validate the output. Is it preferable?
3. Why keep a loaded-path trace?

Section 2.7 7 of 7

A missing versioned reference file

Focus

Report a missing versioned reference rather than substituting an incompatible one.

A release-guide skill at version 2 requires references/output-schema-v2.md. The exercise folder contains only output-schema-v1.md, whose guide format lacks a recovery section. The names are similar, and an assistant could produce a polished document using the older file. It would still violate the current procedure’s acceptance condition.

The completed loader checks the exact required path before drafting. It reports the missing version 2 dependency and explains which required section cannot yet be verified. If an authorized compatible reference is supplied, the task can continue. The loader does not silently rename version 1 or claim it read version 2.

This transfer case makes dependency integrity concrete. Progressive disclosure is not opportunistic guessing about any file that looks related. The procedure declares what evidence it needs, and loading records what actually exists. A fallback is acceptable only when its limitations and changed acceptance criteria are explicit. For the core fixture, the required reference is mandatory, so the correct result is a dependency failure with no claimed-complete guide.

// 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 version 2 guide requires a recovery section absent from the only available version 1 schema. What should the loader do?
2. When can a documented fallback be used honestly?
3. Which statement best preserves execution provenance?

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: Testing and maintaining skills →