Lesson
Control Claude Skills Output with References and Examples
Learn how to add an Examples section to a skill file in Claude, linking to a separate markdown file to provide a detailed blueprint for the AI to follow, ensuring precise formatting and structure in its output.
- Access
- Included
- Transcript
- Needs source
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
## Examplessection to an existingSKILL.mdfile. - 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>
```