Advanced Skill Patterns
Multi-file skills, variable injection, conditional logic, and context files — patterns that make skills production-ready.
Premium Course Content
This lesson is part of a premium course. Upgrade to Pro to unlock all premium courses and content.
- Access all premium courses
- 1000+ AI skill templates included
- New content added weekly
Your first skill works. But it handles one scenario in one way. Real work is messier — different audiences, different data formats, different output needs. This lesson shows you how to build skills that adapt.
🔄 Quick Recall: In the last lesson, you built a SKILL.md with frontmatter and instructions. You learned that the description controls auto-discovery, and the body defines how Claude executes. Now we’ll make those instructions smarter.
Context Files
The simplest power-up: add reference materials that Claude reads when the skill activates.
.claude/skills/proposal-writer/
├── SKILL.md # Instructions
├── brand-voice.md # Your company's tone guidelines
├── proposal-template.md # The exact template to follow
└── past-example.md # A real proposal that got approved
In your SKILL.md, reference these files:
## Reference Materials
Before writing, read these files in the skill directory:
- `brand-voice.md` — Follow this tone and vocabulary
- `proposal-template.md` — Use this exact structure
- `past-example.md` — Match the quality and style of this approved proposal
Claude reads all files in the skill directory when the skill activates. Context files give it the domain knowledge that turns generic output into output that sounds like your company wrote it.
What makes good context files:
- Style guides and brand voice documents
- Templates with placeholder markers
- Examples of high-quality outputs (real ones, not hypothetical)
- Glossaries of company-specific terms
- Checklists for quality standards
✅ Quick Check: Where do context files go in the skill directory? (In the same folder as SKILL.md — Claude reads all files in the skill directory.)
Conditional Logic
One skill that handles multiple scenarios — instead of building three separate skills.
## Instructions
### Determine the audience
Before generating, identify who this report is for:
**If the audience is executive leadership:**
- Use summary format (1 page max)
- Lead with key metrics and decisions needed
- No technical details — link to full report instead
- Include risk flags with severity ratings
**If the audience is the direct team:**
- Use detailed format (2-3 pages)
- Include technical specifics and implementation details
- Add task assignments with owners and deadlines
- Include raw data tables
**If the audience is external stakeholders:**
- Use formal format with company branding
- Include context paragraphs (stakeholders lack internal knowledge)
- Emphasize outcomes and ROI, not process
- Add an executive summary at the top
### Default
If the audience isn't specified, ask before proceeding.
This single skill replaces three. Claude reads the conditional branches and applies the right one based on your task context.
Variable Injection
Make skills reusable with placeholder variables:
## Instructions
Create a [DOCUMENT_TYPE] for [COMPANY_NAME] targeting [AUDIENCE].
Use the following framework:
1. Opening hook relevant to [INDUSTRY]
2. Problem statement from [AUDIENCE]'s perspective
3. Solution positioning for [PRODUCT_NAME]
4. Evidence section with [NUMBER_OF_CASE_STUDIES] case studies
5. Call to action appropriate for [SALES_STAGE]
When Claude encounters bracketed variables, it either:
- Fills them from context (if you mentioned these details in your task)
- Asks you to provide them (if they’re not obvious)
This turns a skill from “does one specific thing” to “does a category of things, customized each time.”
Multi-Step Skills
For complex workflows, structure skills as sequential phases:
## Workflow
### Phase 1: Discovery
- Read all source files
- Identify the data type and structure
- Report findings and wait for confirmation
### Phase 2: Analysis
- Apply the analysis framework specified below
- Generate initial findings
- Flag any data quality issues
### Phase 3: Output
- Create the final deliverable in the format specified
- Include source citations for every claim
- Run the quality checklist before saving
### Phase 4: Review
- Present a summary of what was created
- List any assumptions made
- Ask if revisions are needed
Each phase has a natural checkpoint. Claude pauses between phases to let you verify — preventing cascading errors.
Skills That Reference Other Skills
You can build skill chains where one skill’s output feeds another:
## Instructions
This skill produces a cleaned dataset. After completing:
1. Suggest running the `/data-analysis` skill on the cleaned output
2. If the user agrees, the analysis skill will use the cleaned data as input
## Handoff Notes
When suggesting the next skill, tell the user:
"Your data is cleaned and saved as [filename]. Want me to run the analysis? Type /data-analysis."
This isn’t automatic chaining — Claude suggests the next step and the user decides. It keeps you in control while making the workflow feel seamless.
✅ Quick Check: Why does the skill suggest the next step instead of automatically chaining? (To keep the user in control — each step needs review before the next one runs.)
Testing Advanced Skills
Advanced skills have more moving parts. Test them systematically:
Test the happy path: Give it exactly the input it expects. Does it produce the right output?
Test the conditions: Try each conditional branch. Executive audience, team audience, external stakeholder — does each path produce the right format?
Test with missing data: Don’t provide a variable. Does it ask for it, or does it guess badly?
Test with bad data: Give it messy input. Does the skill handle it gracefully, or does it break?
Test the context files: Remove a context file and run the skill. Does it fail loudly (good) or produce subtly wrong output (bad)?
Document what works and what doesn’t. Update the skill instructions based on what you find.
Real-World Example: The Content Brief Skill
Here’s a production-quality skill that combines everything:
.claude/skills/content-brief/
├── SKILL.md
├── seo-guidelines.md # Company SEO standards
├── content-types.md # Defines: blog, case study, whitepaper
├── brief-template.md # The template Claude fills out
└── sample-brief.md # An approved example brief
The SKILL.md includes conditional logic (different structures for blog vs case study vs whitepaper), variable injection (target keyword, audience segment, funnel stage), and multi-step execution (research → outline → brief → review).
One skill. Five files. Handles every content brief your team needs.
Key Takeaways
- Context files add domain knowledge — templates, examples, style guides
- Conditional logic lets one skill handle multiple scenarios
- Variable injection with brackets makes skills reusable
- Multi-step skills include natural checkpoints between phases
- Skills can suggest other skills to create workflow chains
- Test each branch, each condition, and each edge case
Up Next
Skills work with local files. MCP connectors make them work with everything else — your CRM, your project tracker, your data warehouse. Next lesson: wiring Cowork to external tools at the protocol level.