Build a Basic AI Agent From Scratch: Skills A tutorial in the "Build a Basic AI Agent From Scratch" series shows how to add reusable "skills" to an agent harness, storing each skill as a SKILL.md file whose instructions are loaded into the model's context only on request via a single `load_skill` tool. The harness's `discover_skills()` function loads bundled skills first, then those under `~/.agent-harness/skills/`, then project skills passed with `--skills-dir`, with later definitions winning name collisions; the loader caps the catalog at 32 skills and each file at 16 KiB and requires a lowercase slug name matching the directory, a one-line description, and non-empty instructions. Because skills are read into a registry at startup, editing a skill requires restarting the agent. Previous parts of Build a Basic AI Agent From Scratch : You can find and clone this code in this blog series' GitHub repo https://github.com/rogiia/basic-agent-harness , in the agent-skills/ directory. In the previous part https://www.ruxu.dev/articles/ai/build-an-ai-agent-agents-subagents/ we gave our harness specialist agents. We could switch to a different agent or delegate part of a task to a sub-agent with its own context. But suppose we just want our general agent to write release notes in a consistent format. Setting up a new agent or tool for this purpose is overkill. Instead, we only need to define a short set of instructions that the agent can look up when it's time to write the notes. We call this a skill . A skill is a set of instructions that gives an agent useful information about how to perform a task. Those instructions are similar to the instructions we already give the agent in the system prompt. Unlike the system prompt, a skill's full instructions need not always be loaded into the model's context. Skills often describe tasks that the agent only occasionally needs to perform, so keeping all their instructions in context might be wasteful. In our harness, when the skill tool is available to an agent, the model sees a list of skill names and descriptions in the tool schema. It can then ask to load a skill's full instructions into its context when it needs them. A good description is important: if the model doesn't understand what a skill is for, it might not load it when needed. Our harness reads the full instructions into a registry at startup but only sends them to the model on request; other skill systems may discover and load instructions differently. Each skill will live in a directory with a SKILL.md file. Let's add a personal skill that turns meeting notes into decisions and action items: ~/.agent-harness/skills/ meeting-summary/ SKILL.md --- name: meeting-summary description: Summarize meeting notes into decisions and action items. --- Separate decisions from open questions. For each action item, list the owner and due date if provided. Otherwise, mark them as unspecified. This new file looks very similar to the SOUL.md files from the previous chapter, and we reuse their frontmatter parser. At startup, discover skills loads bundled skills first, then skills under ~/.agent-harness/skills/ , and finally project skills if we pass --skills-dir . If we have skill collisions by name, a later valid definition with the same name wins. That lets a project substitute its own specific instructions for a skill, without changing the default instructions. The loader checks that the name is a lowercase slug matching the directory, the description is one printable line, and the instructions aren't empty. It also caps the catalog at 32 skills and each file at 16 KiB. Skills are read into a registry at startup, so to update a skill after an edit, we have to restart the agent. The registry builds one tool schema, load skill . Its description contains the catalog, and the name argument is an enum of registered names. The model doesn't need to know where the skill lives, the tool just loads it. The lookup is just a dictionary read: php def load self, name: str - str: skill = self. skills.get name if skill is None: return f"Unknown skill '{name}'. Use a name from the skill catalog." return f"Skill: {skill.name}\n\n{skill.instructions}" Suppose we ask, “Use the test-plan skill to draft a test plan for this change.” The model sees that test-plan matches and can call load skill with {"name": "test-plan"} . The harness validates the call, looks up the Markdown in the registry, and returns it in a