Control Claude Skills Output with References and Examples

Lukas Ruebbelke
InstructorLukas Ruebbelke

Social Share Links

Tweet

When building custom skills for Claude, you might find that the output is too generic or doesn't follow the exact file structure and content format you need. Simple instructions aren't always enough to guarantee precision.

This lesson demonstrates a powerful technique to gain fine-grained control over AI agent behavior: adding an Examples section to your skill's SKILL.md file. By linking to a separate, detailed example markdown file, you can provide a clear blueprint for the AI to follow.

Workflow demonstrated in this lesson:

  • Add an ## Examples section to an existing SKILL.md file.
  • Create a link within this section to a dedicated example file (e.g., GIT-STATUS-EXAMPLES.md).
  • In the example file, define the exact folder structure and file content template you expect the AI to generate.
  • Run a prompt related to the example, and watch the AI read the linked file and produce output that perfectly matches your specification.

Key benefits:

  • Achieve Precise Formatting: Enforce specific file naming conventions, directory structures, and content layouts.
  • Improve Reliability: Get consistent, predictable results for complex tasks.
  • Lazy Loading of Context: The AI only reads the detailed example file when it's relevant to the task, saving context window space.
  • Separate Concerns: Keep your main skill file clean by moving complex examples into their own dedicated files.

Summary

This lesson teaches you how to improve the precision of AI agent outputs by providing detailed examples within a skill definition. The key technique involves adding an Examples section to your SKILL.md file that links to another markdown file containing a template. This template explicitly defines the desired folder structure and file content. When the AI is given a task that matches the example, it will read the linked file and use it as a strict blueprint, resulting in perfectly formatted and structured output. This approach is highly efficient as the detailed examples are only loaded into context when needed, and it allows for clear separation between the skill's main logic and its complex formatting rules.

Prompts

Please check the current git status and write out a timestamped file with a summary of it.
Please write a time-stamped summary of @index.ts

Terminal Commands

claude

Code Snippets

The SKILL.md file is updated to include a specific example for Git Status which links to another file for more details.

---
name: Timestamp
description: Create timestamps for files, directories, and other resources, in the format YYYY-MM-DD-HH-MM-SS
allowed-tools: Bash(date:*)
---

# Timestamp

Create a timestamp in the format YYYY-MM-DD-HH-MM-SS.

## Usage

```bash
date +%Y-%m-%d-%H-%M-%S
```

## Examples

### Git Status

See [GIT-STATUS-EXAMPLES.md](GIT-STATUS-EXAMPLES.md) for examples.

The GIT-STATUS-EXAMPLES.md file provides a detailed template for both the file path and the file content.

## Folder structure

<project-root>/summaries/git/YYYY-MM-DD-HH-MM-SS.md

## File content

```markdown
# Git Status Summary for YYYY-MM-DD-HH-MM-SS

Current Branch: <current-branch>

Untracked Files:
- <untracked-file>

Staged Files:
- <staged-file>

Unstaged Files:
- <unstaged-file>

Summary:
<summary>
```

[00:00] Now the more precise you want your skill to be, the more you want examples. So if we toss in an example section and then I'm going to toss in another git status section so that when I ask for a git status it sees this and it can look up another file with our git status examples. So if I say c examples for examples, and I'm going to be more specific and call these git status examples, then just command click on this which will create this file. And I'll create a section called folder structure and then just accept everything here where we started the project root slash summary slash git and then the timestamp and the file content and then I'll add the timestamp here remove this all this current branch and just add in some more on tracked staged unstaged summary this all looks fine so now if I open Claude and I press up to run our please check the current git status, hit enter, this will run our timestamp skill, run the bash command to get the timestamp, it's reading in our git status example, and now you can see it followed the structure of summary slash git with the timestamp, and then the file format structure was git status summary with the timestamp, the current branch, and then everything organized just as we explained it inside of our git status examples.

[01:19] So if you compare these two you can see side-by-side that it's following the content of our example inside of the result. So I'll accept this with 2 and you'll notice that if we start a new session, open clod again, and then say please write a timestamped summary of, and then reference something like index.ts file. Once I hit enter this time, because this isn't referencing a git summary, it's not going to read the git summaries example, So it will get our timestamp, but this time it did not need to read in the examples. So we'll see if we accept this that we now have a file in here, summaries index-ts, which is not our naming scheme for the git summaries since we don't have examples for this and it's just kind of doing the best job that it can because we didn't provide it any format or examples to follow. So when you create a skill file it's not going to load these in unless it thinks it needs to.

[02:15] The order being name and description is always loaded in when your session starts, if the skill is loaded in then it loads in the body of the skill, and then while the skill is running if it thinks it needs to load in references and examples then it'll load those in, all in an effort to save context.