Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
A comprehensive collection of Agent Skills for context engineering, multi-agent architectures, and production agent systems.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
docs/agentskills.md
1---2name: agent-skills-format3description: Official documentation for the Agent Skills format - a lightweight, open standard for extending AI agent capabilities with specialized knowledge and workflows.4doc_type: reference5source_url: No6---78Overview910Copy page1112A simple, open format for giving agents new capabilities and expertise.1314Agent Skills are folders of instructions, scripts, and resources that agents can discover and use to do things more accurately and efficiently.1516Why Agent Skills?17Agents are increasingly capable, but often don’t have the context they need to do real work reliably. Skills solve this by giving agents access to procedural knowledge and company-, team-, and user-specific context they can load on demand. Agents with access to a set of skills can extend their capabilities based on the task they’re working on.18For skill authors: Build capabilities once and deploy them across multiple agent products.19For compatible agents: Support for skills lets end users give agents new capabilities out of the box.20For teams and enterprises: Capture organizational knowledge in portable, version-controlled packages.2122What can Agent Skills enable?23Domain expertise: Package specialized knowledge into reusable instructions, from legal review processes to data analysis pipelines.24New capabilities: Give agents new capabilities (e.g. creating presentations, building MCP servers, analyzing datasets).25Repeatable workflows: Turn multi-step tasks into consistent and auditable workflows.26Interoperability: Reuse the same skill across different skills-compatible agent products.2728Adoption29Agent Skills are supported by leading AI development tools.30OpenCode31Cursor32Amp33Letta34Goose35GitHub36VS Code37Claude Code38Claude39OpenAI Codex4041Open development42The Agent Skills format was originally developed by Anthropic, released as an open standard, and has been adopted by a growing number of agent products. The standard is open to contributions from the broader ecosystem.4344What are skills?4546Copy page4748Agent Skills are a lightweight, open format for extending AI agent capabilities with specialized knowledge and workflows.4950At its core, a skill is a folder containing a SKILL.md file. This file includes metadata (name and description, at minimum) and instructions that tell an agent how to perform a specific task. Skills can also bundle scripts, templates, and reference materials.51my-skill/52├── SKILL.md # Required: instructions + metadata53├── scripts/ # Optional: executable code54├── references/ # Optional: documentation55└── assets/ # Optional: templates, resources5657How skills work58Skills use progressive disclosure to manage context efficiently:59Discovery: At startup, agents load only the name and description of each available skill, just enough to know when it might be relevant.60Activation: When a task matches a skill’s description, the agent reads the full SKILL.md instructions into context.61Execution: The agent follows the instructions, optionally loading referenced files or executing bundled code as needed.62This approach keeps agents fast while giving them access to more context on demand.6364The SKILL.md file65Every skill starts with a SKILL.md file containing YAML frontmatter and Markdown instructions:66---67name: pdf-processing68description: Extract text and tables from PDF files, fill forms, merge documents.69---7071# PDF Processing7273## When to use this skill74Use this skill when the user needs to work with PDF files...7576## How to extract text771. Use pdfplumber for text extraction...7879## How to fill forms80...81The following frontmatter is required at the top of SKILL.md:82name: A short identifier83description: When to use this skill84The Markdown body contains the actual instructions and has no specific restrictions on structure or content.85This simple format has some key advantages:86Self-documenting: A skill author or user can read a SKILL.md and understand what it does, making skills easy to audit and improve.87Extensible: Skills can range in complexity from just text instructions to executable code, assets, and templates.88Portable: Skills are just files, so they’re easy to edit, version, and share.8990Next steps91View the specification to understand the full format.92Add skills support to your agent to build a compatible client.93See example skills on GitHub.94Read authoring best practices for writing effective skills.95Use the reference library to validate skills and generate prompt XML.9697Specification9899Copy page100101The complete format specification for Agent Skills.102103This document defines the Agent Skills format.104105Directory structure106A skill is a directory containing at minimum a SKILL.md file:107skill-name/108└── SKILL.md # Required109You can optionally include additional directories such as scripts/, references/, and assets/ to support your skill.110111SKILL.md format112The SKILL.md file must contain YAML frontmatter followed by Markdown content.113114Frontmatter (required)115---116name: skill-name117description: A description of what this skill does and when to use it.118---119With optional fields:120---121name: pdf-processing122description: Extract text and tables from PDF files, fill forms, merge documents.123license: Apache-2.0124metadata:125author: example-org126version: "1.0"127---128Field Required Constraints129name Yes Max 64 characters. Lowercase letters, numbers, and hyphens only. Must not start or end with a hyphen.130description Yes Max 1024 characters. Non-empty. Describes what the skill does and when to use it.131license No License name or reference to a bundled license file.132compatibility No Max 500 characters. Indicates environment requirements (intended product, system packages, network access, etc.).133metadata No Arbitrary key-value mapping for additional metadata.134allowed-tools No Space-delimited list of pre-approved tools the skill may use. (Experimental)135136name field137The required name field:138Must be 1-64 characters139May only contain unicode lowercase alphanumeric characters and hyphens (a-z and -)140Must not start or end with -141Must not contain consecutive hyphens (--)142Must match the parent directory name143Valid examples:144name: pdf-processing145name: data-analysis146name: code-review147Invalid examples:148name: PDF-Processing # uppercase not allowed149name: -pdf # cannot start with hyphen150name: pdf--processing # consecutive hyphens not allowed151152description field153The required description field:154Must be 1-1024 characters155Should describe both what the skill does and when to use it156Should include specific keywords that help agents identify relevant tasks157Good example:158description: Extracts text and tables from PDF files, fills PDF forms, and merges multiple PDFs. Use when working with PDF documents or when the user mentions PDFs, forms, or document extraction.159Poor example:160description: Helps with PDFs.161162license field163The optional license field:164Specifies the license applied to the skill165We recommend keeping it short (either the name of a license or the name of a bundled license file)166Example:167license: Proprietary. LICENSE.txt has complete terms168169compatibility field170The optional compatibility field:171Must be 1-500 characters if provided172Should only be included if your skill has specific environment requirements173Can indicate intended product, required system packages, network access needs, etc.174Examples:175compatibility: Designed for Claude Code (or similar products)176compatibility: Requires git, docker, jq, and access to the internet177Most skills do not need the compatibility field.178179metadata field180The optional metadata field:181A map from string keys to string values182Clients can use this to store additional properties not defined by the Agent Skills spec183We recommend making your key names reasonably unique to avoid accidental conflicts184Example:185metadata:186author: example-org187version: "1.0"188189allowed-tools field190The optional allowed-tools field:191A space-delimited list of tools that are pre-approved to run192Experimental. Support for this field may vary between agent implementations193Example:194allowed-tools: Bash(git:*) Bash(jq:*) Read195196Body content197The Markdown body after the frontmatter contains the skill instructions. There are no format restrictions. Write whatever helps agents perform the task effectively.198Recommended sections:199Step-by-step instructions200Examples of inputs and outputs201Common edge cases202Note that the agent will load this entire file once it’s decided to activate a skill. Consider splitting longer SKILL.md content into referenced files.203204Optional directories205206scripts/207Contains executable code that agents can run. Scripts should:208Be self-contained or clearly document dependencies209Include helpful error messages210Handle edge cases gracefully211Supported languages depend on the agent implementation. Common options include Python, Bash, and JavaScript.212213references/214Contains additional documentation that agents can read when needed:215REFERENCE.md - Detailed technical reference216FORMS.md - Form templates or structured data formats217Domain-specific files (finance.md, legal.md, etc.)218Keep individual reference files focused. Agents load these on demand, so smaller files mean less use of context.219220assets/221Contains static resources:222Templates (document templates, configuration templates)223Images (diagrams, examples)224Data files (lookup tables, schemas)225226Progressive disclosure227Skills should be structured for efficient use of context:228Metadata (~100 tokens): The name and description fields are loaded at startup for all skills229Instructions (< 5000 tokens recommended): The full SKILL.md body is loaded when the skill is activated230Resources (as needed): Files (e.g. those in scripts/, references/, or assets/) are loaded only when required231Keep your main SKILL.md under 500 lines. Move detailed reference material to separate files.232233File references234When referencing other files in your skill, use relative paths from the skill root:235See [the reference guide](references/REFERENCE.md) for details.236237Run the extraction script:238scripts/extract.py239Keep file references one level deep from SKILL.md. Avoid deeply nested reference chains.240241Validation242Use the skills-ref reference library to validate your skills:243skills-ref validate ./my-skill244This checks that your SKILL.md frontmatter is valid and follows all naming conventions.245246Integrate skills into your agent247248Copy page249250How to add Agent Skills support to your agent or tool.251252This guide explains how to add skills support to an AI agent or development tool.253254Integration approaches255The two main approaches to integrating skills are:256Filesystem-based agents operate within a computer environment (bash/unix) and represent the most capable option. Skills are activated when models issue shell commands like cat /path/to/my-skill/SKILL.md. Bundled resources are accessed through shell commands.257Tool-based agents function without a dedicated computer environment. Instead, they implement tools allowing models to trigger skills and access bundled assets. The specific tool implementation is up to the developer.258259Overview260A skills-compatible agent needs to:261Discover skills in configured directories262Load metadata (name and description) at startup263Match user tasks to relevant skills264Activate skills by loading full instructions265Execute scripts and access resources as needed266267Skill discovery268Skills are folders containing a SKILL.md file. Your agent should scan configured directories for valid skills.269270Loading metadata271At startup, parse only the frontmatter of each SKILL.md file. This keeps initial context usage low.272273Parsing frontmatter274function parseMetadata(skillPath):275content = readFile(skillPath + "/SKILL.md")276frontmatter = extractYAMLFrontmatter(content)277278return {279name: frontmatter.name,280description: frontmatter.description,281path: skillPath282}283284Injecting into context285Include skill metadata in the system prompt so the model knows what skills are available.286Follow your platform’s guidance for system prompt updates. For example, for Claude models, the recommended format uses XML:287<available_skills>288<skill>289<name>pdf-processing</name>290<description>Extracts text and tables from PDF files, fills forms, merges documents.</description>291<location>/path/to/skills/pdf-processing/SKILL.md</location>292</skill>293<skill>294<name>data-analysis</name>295<description>Analyzes datasets, generates charts, and creates summary reports.</description>296<location>/path/to/skills/data-analysis/SKILL.md</location>297</skill>298</available_skills>299For filesystem-based agents, include the location field with the absolute path to the SKILL.md file. For tool-based agents, the location can be omitted.300Keep metadata concise. Each skill should add roughly 50-100 tokens to the context.301302Security considerations303Script execution introduces security risks. Consider:304Sandboxing: Run scripts in isolated environments305Allowlisting: Only execute scripts from trusted skills306Confirmation: Ask users before running potentially dangerous operations307Logging: Record all script executions for auditing308309Reference implementation310The skills-ref library provides Python utilities and a CLI for working with skills.311For example:312Validate a skill directory:313skills-ref validate <path>314Generate <available_skills> XML for agent prompts:315skills-ref to-prompt <path>...316Use the library source code as a reference implementation.317318Skill authoring best practices319320Copy page321322Learn how to write effective Skills that Claude can discover and use successfully.323Good Skills are concise, well-structured, and tested with real usage. This guide provides practical authoring decisions to help you write Skills that Claude can discover and use effectively.324325For conceptual background on how Skills work, see the Skills overview.326327Core principles328Concise is key329The context window is a public good. Your Skill shares the context window with everything else Claude needs to know, including:330331The system prompt332Conversation history333Other Skills' metadata334Your actual request335Not every token in your Skill has an immediate cost. At startup, only the metadata (name and description) from all Skills is pre-loaded. Claude reads SKILL.md only when the Skill becomes relevant, and reads additional files only as needed. However, being concise in SKILL.md still matters: once Claude loads it, every token competes with conversation history and other context.336337Default assumption: Claude is already very smart338339Only add context Claude doesn't already have. Challenge each piece of information:340341"Does Claude really need this explanation?"342"Can I assume Claude knows this?"343"Does this paragraph justify its token cost?"344Good example: Concise (approximately 50 tokens):345346## Extract PDF text347348Use pdfplumber for text extraction:349350```python351import pdfplumber352353with pdfplumber.open("file.pdf") as pdf:354text = pdf.pages[0].extract_text()355```356Bad example: Too verbose (approximately 150 tokens):357358## Extract PDF text359360PDF (Portable Document Format) files are a common file format that contains361text, images, and other content. To extract text from a PDF, you'll need to362use a library. There are many libraries available for PDF processing, but we363recommend pdfplumber because it's easy to use and handles most cases well.364First, you'll need to install it using pip. Then you can use the code below...365The concise version assumes Claude knows what PDFs are and how libraries work.366367Set appropriate degrees of freedom368Match the level of specificity to the task's fragility and variability.369370High freedom (text-based instructions):371372Use when:373374Multiple approaches are valid375Decisions depend on context376Heuristics guide the approach377Example:378379## Code review process3803811. Analyze the code structure and organization3822. Check for potential bugs or edge cases3833. Suggest improvements for readability and maintainability3844. Verify adherence to project conventions385Medium freedom (pseudocode or scripts with parameters):386387Use when:388389A preferred pattern exists390Some variation is acceptable391Configuration affects behavior392Example:393394## Generate report395396Use this template and customize as needed:397398```python399def generate_report(data, format="markdown", include_charts=True):400# Process data401# Generate output in specified format402# Optionally include visualizations403```404Low freedom (specific scripts, few or no parameters):405406Use when:407408Operations are fragile and error-prone409Consistency is critical410A specific sequence must be followed411Example:412413## Database migration414415Run exactly this script:416417```bash418python scripts/migrate.py --verify --backup419```420421Do not modify the command or add additional flags.422Analogy: Think of Claude as a robot exploring a path:423424Narrow bridge with cliffs on both sides: There's only one safe way forward. Provide specific guardrails and exact instructions (low freedom). Example: database migrations that must run in exact sequence.425Open field with no hazards: Many paths lead to success. Give general direction and trust Claude to find the best route (high freedom). Example: code reviews where context determines the best approach.426Test with all models you plan to use427Skills act as additions to models, so effectiveness depends on the underlying model. Test your Skill with all the models you plan to use it with.428429Testing considerations by model:430431Claude Haiku (fast, economical): Does the Skill provide enough guidance?432Claude Sonnet (balanced): Is the Skill clear and efficient?433Claude Opus (powerful reasoning): Does the Skill avoid over-explaining?434What works perfectly for Opus might need more detail for Haiku. If you plan to use your Skill across multiple models, aim for instructions that work well with all of them.435436Skill structure437YAML Frontmatter: The SKILL.md frontmatter requires two fields:438439name:440441Maximum 64 characters442Must contain only lowercase letters, numbers, and hyphens443Cannot contain XML tags444Cannot contain reserved words: "anthropic", "claude"445description:446447Must be non-empty448Maximum 1024 characters449Cannot contain XML tags450Should describe what the Skill does and when to use it451For complete Skill structure details, see the Skills overview.452453Naming conventions454Use consistent naming patterns to make Skills easier to reference and discuss. We recommend using gerund form (verb + -ing) for Skill names, as this clearly describes the activity or capability the Skill provides.455456Remember that the name field must use lowercase letters, numbers, and hyphens only.457458Good naming examples (gerund form):459460processing-pdfs461analyzing-spreadsheets462managing-databases463testing-code464writing-documentation465Acceptable alternatives:466467Noun phrases: pdf-processing, spreadsheet-analysis468Action-oriented: process-pdfs, analyze-spreadsheets469Avoid:470471Vague names: helper, utils, tools472Overly generic: documents, data, files473Reserved words: anthropic-helper, claude-tools474Inconsistent patterns within your skill collection475Consistent naming makes it easier to:476477Reference Skills in documentation and conversations478Understand what a Skill does at a glance479Organize and search through multiple Skills480Maintain a professional, cohesive skill library481Writing effective descriptions482The description field enables Skill discovery and should include both what the Skill does and when to use it.483484Always write in third person. The description is injected into the system prompt, and inconsistent point-of-view can cause discovery problems.485486Good: "Processes Excel files and generates reports"487Avoid: "I can help you process Excel files"488Avoid: "You can use this to process Excel files"489Be specific and include key terms. Include both what the Skill does and specific triggers/contexts for when to use it.490491Each Skill has exactly one description field. The description is critical for skill selection: Claude uses it to choose the right Skill from potentially 100+ available Skills. Your description must provide enough detail for Claude to know when to select this Skill, while the rest of SKILL.md provides the implementation details.492493Effective examples:494495PDF Processing skill:496497description: Extract text and tables from PDF files, fill forms, merge documents. Use when working with PDF files or when the user mentions PDFs, forms, or document extraction.498Excel Analysis skill:499500description: Analyze Excel spreadsheets, create pivot tables, generate charts. Use when analyzing Excel files, spreadsheets, tabular data, or .xlsx files.501Git Commit Helper skill:502503description: Generate descriptive commit messages by analyzing git diffs. Use when the user asks for help writing commit messages or reviewing staged changes.504Avoid vague descriptions like these:505506description: Helps with documents507description: Processes data508description: Does stuff with files509Progressive disclosure patterns510SKILL.md serves as an overview that points Claude to detailed materials as needed, like a table of contents in an onboarding guide. For an explanation of how progressive disclosure works, see How Skills work in the overview.511512Practical guidance:513514Keep SKILL.md body under 500 lines for optimal performance515Split content into separate files when approaching this limit516Use the patterns below to organize instructions, code, and resources effectively517Visual overview: From simple to complex518A basic Skill starts with just a SKILL.md file containing metadata and instructions:519520Simple SKILL.md file showing YAML frontmatter and markdown body521522As your Skill grows, you can bundle additional content that Claude loads only when needed:523524Bundling additional reference files like reference.md and forms.md.525526The complete Skill directory structure might look like this:527528pdf/529├── SKILL.md # Main instructions (loaded when triggered)530├── FORMS.md # Form-filling guide (loaded as needed)531├── reference.md # API reference (loaded as needed)532├── examples.md # Usage examples (loaded as needed)533└── scripts/534├── analyze_form.py # Utility script (executed, not loaded)535├── fill_form.py # Form filling script536└── validate.py # Validation script537Pattern 1: High-level guide with references538---539name: pdf-processing540description: Extracts text and tables from PDF files, fills forms, and merges documents. Use when working with PDF files or when the user mentions PDFs, forms, or document extraction.541---542543# PDF Processing544545## Quick start546547Extract text with pdfplumber:548```python549import pdfplumber550with pdfplumber.open("file.pdf") as pdf:551text = pdf.pages[0].extract_text()552```553554## Advanced features555556**Form filling**: See [FORMS.md](FORMS.md) for complete guide557**API reference**: See [REFERENCE.md](REFERENCE.md) for all methods558**Examples**: See [EXAMPLES.md](EXAMPLES.md) for common patterns559Claude loads FORMS.md, REFERENCE.md, or EXAMPLES.md only when needed.560561Pattern 2: Domain-specific organization562For Skills with multiple domains, organize content by domain to avoid loading irrelevant context. When a user asks about sales metrics, Claude only needs to read sales-related schemas, not finance or marketing data. This keeps token usage low and context focused.563564bigquery-skill/565├── SKILL.md (overview and navigation)566└── reference/567├── finance.md (revenue, billing metrics)568├── sales.md (opportunities, pipeline)569├── product.md (API usage, features)570└── marketing.md (campaigns, attribution)571SKILL.md572# BigQuery Data Analysis573574## Available datasets575576**Finance**: Revenue, ARR, billing → See [reference/finance.md](reference/finance.md)577**Sales**: Opportunities, pipeline, accounts → See [reference/sales.md](reference/sales.md)578**Product**: API usage, features, adoption → See [reference/product.md](reference/product.md)579**Marketing**: Campaigns, attribution, email → See [reference/marketing.md](reference/marketing.md)580581## Quick search582583Find specific metrics using grep:584585```bash586grep -i "revenue" reference/finance.md587grep -i "pipeline" reference/sales.md588grep -i "api usage" reference/product.md589```590Pattern 3: Conditional details591Show basic content, link to advanced content:592593# DOCX Processing594595## Creating documents596597Use docx-js for new documents. See [DOCX-JS.md](DOCX-JS.md).598599## Editing documents600601For simple edits, modify the XML directly.602603**For tracked changes**: See [REDLINING.md](REDLINING.md)604**For OOXML details**: See [OOXML.md](OOXML.md)605Claude reads REDLINING.md or OOXML.md only when the user needs those features.606607Avoid deeply nested references608Claude may partially read files when they're referenced from other referenced files. When encountering nested references, Claude might use commands like head -100 to preview content rather than reading entire files, resulting in incomplete information.609610Keep references one level deep from SKILL.md. All reference files should link directly from SKILL.md to ensure Claude reads complete files when needed.611612Bad example: Too deep:613614# SKILL.md615See [advanced.md](advanced.md)...616617# advanced.md618See [details.md](details.md)...619620# details.md621Here's the actual information...622Good example: One level deep:623624# SKILL.md625626**Basic usage**: [instructions in SKILL.md]627**Advanced features**: See [advanced.md](advanced.md)628**API reference**: See [reference.md](reference.md)629**Examples**: See [examples.md](examples.md)630Structure longer reference files with table of contents631For reference files longer than 100 lines, include a table of contents at the top. This ensures Claude can see the full scope of available information even when previewing with partial reads.632633Example:634635# API Reference636637## Contents638- Authentication and setup639- Core methods (create, read, update, delete)640- Advanced features (batch operations, webhooks)641- Error handling patterns642- Code examples643644## Authentication and setup645...646647## Core methods648...649Claude can then read the complete file or jump to specific sections as needed.650651For details on how this filesystem-based architecture enables progressive disclosure, see the Runtime environment section in the Advanced section below.652653Workflows and feedback loops654Use workflows for complex tasks655Break complex operations into clear, sequential steps. For particularly complex workflows, provide a checklist that Claude can copy into its response and check off as it progresses.656657Example 1: Research synthesis workflow (for Skills without code):658659## Research synthesis workflow660661Copy this checklist and track your progress:662663```664Research Progress:665- [ ] Step 1: Read all source documents666- [ ] Step 2: Identify key themes667- [ ] Step 3: Cross-reference claims668- [ ] Step 4: Create structured summary669- [ ] Step 5: Verify citations670```671672**Step 1: Read all source documents**673674Review each document in the `sources/` directory. Note the main arguments and supporting evidence.675676**Step 2: Identify key themes**677678Look for patterns across sources. What themes appear repeatedly? Where do sources agree or disagree?679680**Step 3: Cross-reference claims**681682For each major claim, verify it appears in the source material. Note which source supports each point.683684**Step 4: Create structured summary**685686Organize findings by theme. Include:687- Main claim688- Supporting evidence from sources689- Conflicting viewpoints (if any)690691**Step 5: Verify citations**692693Check that every claim references the correct source document. If citations are incomplete, return to Step 3.694This example shows how workflows apply to analysis tasks that don't require code. The checklist pattern works for any complex, multi-step process.695696Example 2: PDF form filling workflow (for Skills with code):697698## PDF form filling workflow699700Copy this checklist and check off items as you complete them:701702```703Task Progress:704- [ ] Step 1: Analyze the form (run analyze_form.py)705- [ ] Step 2: Create field mapping (edit fields.json)706- [ ] Step 3: Validate mapping (run validate_fields.py)707- [ ] Step 4: Fill the form (run fill_form.py)708- [ ] Step 5: Verify output (run verify_output.py)709```710711**Step 1: Analyze the form**712713Run: `python scripts/analyze_form.py input.pdf`714715This extracts form fields and their locations, saving to `fields.json`.716717**Step 2: Create field mapping**718719Edit `fields.json` to add values for each field.720721**Step 3: Validate mapping**722723Run: `python scripts/validate_fields.py fields.json`724725Fix any validation errors before continuing.726727**Step 4: Fill the form**728729Run: `python scripts/fill_form.py input.pdf fields.json output.pdf`730731**Step 5: Verify output**732733Run: `python scripts/verify_output.py output.pdf`734735If verification fails, return to Step 2.736Clear steps prevent Claude from skipping critical validation. The checklist helps both Claude and you track progress through multi-step workflows.737738Implement feedback loops739Common pattern: Run validator → fix errors → repeat740741This pattern greatly improves output quality.742743Example 1: Style guide compliance (for Skills without code):744745## Content review process7467471. Draft your content following the guidelines in STYLE_GUIDE.md7482. Review against the checklist:749- Check terminology consistency750- Verify examples follow the standard format751- Confirm all required sections are present7523. If issues found:753- Note each issue with specific section reference754- Revise the content755- Review the checklist again7564. Only proceed when all requirements are met7575. Finalize and save the document758This shows the validation loop pattern using reference documents instead of scripts. The "validator" is STYLE_GUIDE.md, and Claude performs the check by reading and comparing.759760Example 2: Document editing process (for Skills with code):761762## Document editing process7637641. Make your edits to `word/document.xml`7652. **Validate immediately**: `python ooxml/scripts/validate.py unpacked_dir/`7663. If validation fails:767- Review the error message carefully768- Fix the issues in the XML769- Run validation again7704. **Only proceed when validation passes**7715. Rebuild: `python ooxml/scripts/pack.py unpacked_dir/ output.docx`7726. Test the output document773The validation loop catches errors early.774775Content guidelines776Avoid time-sensitive information777Don't include information that will become outdated:778779Bad example: Time-sensitive (will become wrong):780781If you're doing this before August 2025, use the old API.782After August 2025, use the new API.783Good example (use "old patterns" section):784785## Current method786787Use the v2 API endpoint: `api.example.com/v2/messages`788789## Old patterns790791<details>792<summary>Legacy v1 API (deprecated 2025-08)</summary>793794The v1 API used: `api.example.com/v1/messages`795796This endpoint is no longer supported.797</details>798The old patterns section provides historical context without cluttering the main content.799800Use consistent terminology801Choose one term and use it throughout the Skill:802803Good - Consistent:804805Always "API endpoint"806Always "field"807Always "extract"808Bad - Inconsistent:809810Mix "API endpoint", "URL", "API route", "path"811Mix "field", "box", "element", "control"812Mix "extract", "pull", "get", "retrieve"813Consistency helps Claude understand and follow instructions.814815Common patterns816Template pattern817Provide templates for output format. Match the level of strictness to your needs.818819For strict requirements (like API responses or data formats):820821## Report structure822823ALWAYS use this exact template structure:824825```markdown826# [Analysis Title]827828## Executive summary829[One-paragraph overview of key findings]830831## Key findings832- Finding 1 with supporting data833- Finding 2 with supporting data834- Finding 3 with supporting data835836## Recommendations8371. Specific actionable recommendation8382. Specific actionable recommendation839```840For flexible guidance (when adaptation is useful):841842## Report structure843844Here is a sensible default format, but use your best judgment based on the analysis:845846```markdown847# [Analysis Title]848849## Executive summary850[Overview]851852## Key findings853[Adapt sections based on what you discover]854855## Recommendations856[Tailor to the specific context]857```858859Adjust sections as needed for the specific analysis type.860Examples pattern861For Skills where output quality depends on seeing examples, provide input/output pairs just like in regular prompting:862863## Commit message format864865Generate commit messages following these examples:866867**Example 1:**868Input: Added user authentication with JWT tokens869Output:870```871feat(auth): implement JWT-based authentication872873Add login endpoint and token validation middleware874```875876**Example 2:**877Input: Fixed bug where dates displayed incorrectly in reports878Output:879```880fix(reports): correct date formatting in timezone conversion881882Use UTC timestamps consistently across report generation883```884885**Example 3:**886Input: Updated dependencies and refactored error handling887Output:888```889chore: update dependencies and refactor error handling890891- Upgrade lodash to 4.17.21892- Standardize error response format across endpoints893```894895Follow this style: type(scope): brief description, then detailed explanation.896Examples help Claude understand the desired style and level of detail more clearly than descriptions alone.897898Conditional workflow pattern899Guide Claude through decision points:900901## Document modification workflow9029031. Determine the modification type:904905**Creating new content?** → Follow "Creation workflow" below906**Editing existing content?** → Follow "Editing workflow" below9079082. Creation workflow:909- Use docx-js library910- Build document from scratch911- Export to .docx format9129133. Editing workflow:914- Unpack existing document915- Modify XML directly916- Validate after each change917- Repack when complete918If workflows become large or complicated with many steps, consider pushing them into separate files and tell Claude to read the appropriate file based on the task at hand.919920Evaluation and iteration921Build evaluations first922Create evaluations BEFORE writing extensive documentation. This ensures your Skill solves real problems rather than documenting imagined ones.923924Evaluation-driven development:925926Identify gaps: Run Claude on representative tasks without a Skill. Document specific failures or missing context927Create evaluations: Build three scenarios that test these gaps928Establish baseline: Measure Claude's performance without the Skill929Write minimal instructions: Create just enough content to address the gaps and pass evaluations930Iterate: Execute evaluations, compare against baseline, and refine931This approach ensures you're solving actual problems rather than anticipating requirements that may never materialize.932933Evaluation structure:934935{936"skills": ["pdf-processing"],937"query": "Extract all text from this PDF file and save it to output.txt",938"files": ["test-files/document.pdf"],939"expected_behavior": [940"Successfully reads the PDF file using an appropriate PDF processing library or command-line tool",941"Extracts text content from all pages in the document without missing any pages",942"Saves the extracted text to a file named output.txt in a clear, readable format"943]944}945This example demonstrates a data-driven evaluation with a simple testing rubric. We do not currently provide a built-in way to run these evaluations. Users can create their own evaluation system. Evaluations are your source of truth for measuring Skill effectiveness.946947Develop Skills iteratively with Claude948The most effective Skill development process involves Claude itself. Work with one instance of Claude ("Claude A") to create a Skill that will be used by other instances ("Claude B"). Claude A helps you design and refine instructions, while Claude B tests them in real tasks. This works because Claude models understand both how to write effective agent instructions and what information agents need.949950Creating a new Skill:951952Complete a task without a Skill: Work through a problem with Claude A using normal prompting. As you work, you'll naturally provide context, explain preferences, and share procedural knowledge. Notice what information you repeatedly provide.953954Identify the reusable pattern: After completing the task, identify what context you provided that would be useful for similar future tasks.955956Example: If you worked through a BigQuery analysis, you might have provided table names, field definitions, filtering rules (like "always exclude test accounts"), and common query patterns.957958Ask Claude A to create a Skill: "Create a Skill that captures this BigQuery analysis pattern we just used. Include the table schemas, naming conventions, and the rule about filtering test accounts."959960Claude models understand the Skill format and structure natively. You don't need special system prompts or a "writing skills" skill to get Claude to help create Skills. Simply ask Claude to create a Skill and it will generate properly structured SKILL.md content with appropriate frontmatter and body content.961962Review for conciseness: Check that Claude A hasn't added unnecessary explanations. Ask: "Remove the explanation about what win rate means - Claude already knows that."963964Improve information architecture: Ask Claude A to organize the content more effectively. For example: "Organize this so the table schema is in a separate reference file. We might add more tables later."965966Test on similar tasks: Use the Skill with Claude B (a fresh instance with the Skill loaded) on related use cases. Observe whether Claude B finds the right information, applies rules correctly, and handles the task successfully.967968Iterate based on observation: If Claude B struggles or misses something, return to Claude A with specifics: "When Claude used this Skill, it forgot to filter by date for Q4. Should we add a section about date filtering patterns?"969970Iterating on existing Skills:971972The same hierarchical pattern continues when improving Skills. You alternate between:973974Working with Claude A (the expert who helps refine the Skill)975Testing with Claude B (the agent using the Skill to perform real work)976Observing Claude B's behavior and bringing insights back to Claude A977Use the Skill in real workflows: Give Claude B (with the Skill loaded) actual tasks, not test scenarios978979Observe Claude B's behavior: Note where it struggles, succeeds, or makes unexpected choices980981Example observation: "When I asked Claude B for a regional sales report, it wrote the query but forgot to filter out test accounts, even though the Skill mentions this rule."982983Return to Claude A for improvements: Share the current SKILL.md and describe what you observed. Ask: "I noticed Claude B forgot to filter test accounts when I asked for a regional report. The Skill mentions filtering, but maybe it's not prominent enough?"984985Review Claude A's suggestions: Claude A might suggest reorganizing to make rules more prominent, using stronger language like "MUST filter" instead of "always filter", or restructuring the workflow section.986987Apply and test changes: Update the Skill with Claude A's refinements, then test again with Claude B on similar requests988989Repeat based on usage: Continue this observe-refine-test cycle as you encounter new scenarios. Each iteration improves the Skill based on real agent behavior, not assumptions.990991Gathering team feedback:992993Share Skills with teammates and observe their usage994Ask: Does the Skill activate when expected? Are instructions clear? What's missing?995Incorporate feedback to address blind spots in your own usage patterns996Why this approach works: Claude A understands agent needs, you provide domain expertise, Claude B reveals gaps through real usage, and iterative refinement improves Skills based on observed behavior rather than assumptions.997998Observe how Claude navigates Skills999As you iterate on Skills, pay attention to how Claude actually uses them in practice. Watch for:10001001Unexpected exploration paths: Does Claude read files in an order you didn't anticipate? This might indicate your structure isn't as intuitive as you thought1002Missed connections: Does Claude fail to follow references to important files? Your links might need to be more explicit or prominent1003Overreliance on certain sections: If Claude repeatedly reads the same file, consider whether that content should be in the main SKILL.md instead1004Ignored content: If Claude never accesses a bundled file, it might be unnecessary or poorly signaled in the main instructions1005Iterate based on these observations rather than assumptions. The 'name' and 'description' in your Skill's metadata are particularly critical. Claude uses these when deciding whether to trigger the Skill in response to the current task. Make sure they clearly describe what the Skill does and when it should be used.10061007Anti-patterns to avoid1008Avoid Windows-style paths1009Always use forward slashes in file paths, even on Windows:10101011✓ Good: scripts/helper.py, reference/guide.md1012✗ Avoid: scripts\helper.py, reference\guide.md1013Unix-style paths work across all platforms, while Windows-style paths cause errors on Unix systems.10141015Avoid offering too many options1016Don't present multiple approaches unless necessary:10171018**Bad example: Too many choices** (confusing):1019"You can use pypdf, or pdfplumber, or PyMuPDF, or pdf2image, or..."10201021**Good example: Provide a default** (with escape hatch):1022"Use pdfplumber for text extraction:1023```python1024import pdfplumber1025```10261027For scanned PDFs requiring OCR, use pdf2image with pytesseract instead."1028Advanced: Skills with executable code1029The sections below focus on Skills that include executable scripts. If your Skill uses only markdown instructions, skip to Checklist for effective Skills.10301031Solve, don't punt1032When writing scripts for Skills, handle error conditions rather than punting to Claude.10331034Good example: Handle errors explicitly:10351036def process_file(path):1037"""Process a file, creating it if it doesn't exist."""1038try:1039with open(path) as f:1040return f.read()1041except FileNotFoundError:1042# Create file with default content instead of failing1043print(f"File {path} not found, creating default")1044with open(path, 'w') as f:1045f.write('')1046return ''1047except PermissionError:1048# Provide alternative instead of failing1049print(f"Cannot access {path}, using default")1050return ''1051Bad example: Punt to Claude:10521053def process_file(path):1054# Just fail and let Claude figure it out1055return open(path).read()1056Configuration parameters should also be justified and documented to avoid "voodoo constants" (Ousterhout's law). If you don't know the right value, how will Claude determine it?10571058Good example: Self-documenting:10591060# HTTP requests typically complete within 30 seconds1061# Longer timeout accounts for slow connections1062REQUEST_TIMEOUT = 3010631064# Three retries balances reliability vs speed1065# Most intermittent failures resolve by the second retry1066MAX_RETRIES = 31067Bad example: Magic numbers:10681069TIMEOUT = 47 # Why 47?1070RETRIES = 5 # Why 5?1071Provide utility scripts1072Even if Claude could write a script, pre-made scripts offer advantages:10731074Benefits of utility scripts:10751076More reliable than generated code1077Save tokens (no need to include code in context)1078Save time (no code generation required)1079Ensure consistency across uses1080Bundling executable scripts alongside instruction files10811082The diagram above shows how executable scripts work alongside instruction files. The instruction file (forms.md) references the script, and Claude can execute it without loading its contents into context.10831084Important distinction: Make clear in your instructions whether Claude should:10851086Execute the script (most common): "Run analyze_form.py to extract fields"1087Read it as reference (for complex logic): "See analyze_form.py for the field extraction algorithm"1088For most utility scripts, execution is preferred because it's more reliable and efficient. See the Runtime environment section below for details on how script execution works.10891090Example:10911092## Utility scripts10931094**analyze_form.py**: Extract all form fields from PDF10951096```bash1097python scripts/analyze_form.py input.pdf > fields.json1098```10991100Output format:1101```json1102{1103"field_name": {"type": "text", "x": 100, "y": 200},1104"signature": {"type": "sig", "x": 150, "y": 500}1105}1106```11071108**validate_boxes.py**: Check for overlapping bounding boxes11091110```bash1111python scripts/validate_boxes.py fields.json1112# Returns: "OK" or lists conflicts1113```11141115**fill_form.py**: Apply field values to PDF11161117```bash1118python scripts/fill_form.py input.pdf fields.json output.pdf1119```1120Use visual analysis1121When inputs can be rendered as images, have Claude analyze them:11221123## Form layout analysis112411251. Convert PDF to images:1126```bash1127python scripts/pdf_to_images.py form.pdf1128```112911302. Analyze each page image to identify form fields11313. Claude can see field locations and types visually1132In this example, you'd need to write the pdf_to_images.py script.11331134Claude's vision capabilities help understand layouts and structures.11351136Create verifiable intermediate outputs1137When Claude performs complex, open-ended tasks, it can make mistakes. The "plan-validate-execute" pattern catches errors early by having Claude first create a plan in a structured format, then validate that plan with a script before executing it.11381139Example: Imagine asking Claude to update 50 form fields in a PDF based on a spreadsheet. Without validation, Claude might reference non-existent fields, create conflicting values, miss required fields, or apply updates incorrectly.11401141Solution: Use the workflow pattern shown above (PDF form filling), but add an intermediate changes.json file that gets validated before applying changes. The workflow becomes: analyze → create plan file → validate plan → execute → verify.11421143Why this pattern works:11441145Catches errors early: Validation finds problems before changes are applied1146Machine-verifiable: Scripts provide objective verification1147Reversible planning: Claude can iterate on the plan without touching originals1148Clear debugging: Error messages point to specific problems1149When to use: Batch operations, destructive changes, complex validation rules, high-stakes operations.11501151Implementation tip: Make validation scripts verbose with specific error messages like "Field 'signature_date' not found. Available fields: customer_name, order_total, signature_date_signed" to help Claude fix issues.11521153Package dependencies1154Skills run in the code execution environment with platform-specific limitations:11551156claude.ai: Can install packages from npm and PyPI and pull from GitHub repositories1157Anthropic API: Has no network access and no runtime package installation1158List required packages in your SKILL.md and verify they're available in the code execution tool documentation.11591160Runtime environment1161Skills run in a code execution environment with filesystem access, bash commands, and code execution capabilities. For the conceptual explanation of this architecture, see The Skills architecture in the overview.11621163How this affects your authoring:11641165How Claude accesses Skills:11661167Metadata pre-loaded: At startup, the name and description from all Skills' YAML frontmatter are loaded into the system prompt1168Files read on-demand: Claude uses bash Read tools to access SKILL.md and other files from the filesystem when needed1169Scripts executed efficiently: Utility scripts can be executed via bash without loading their full contents into context. Only the script's output consumes tokens1170No context penalty for large files: Reference files, data, or documentation don't consume context tokens until actually read1171File paths matter: Claude navigates your skill directory like a filesystem. Use forward slashes (reference/guide.md), not backslashes1172Name files descriptively: Use names that indicate content: form_validation_rules.md, not doc2.md1173Organize for discovery: Structure directories by domain or feature1174Good: reference/finance.md, reference/sales.md1175Bad: docs/file1.md, docs/file2.md1176Bundle comprehensive resources: Include complete API docs, extensive examples, large datasets; no context penalty until accessed1177Prefer scripts for deterministic operations: Write validate_form.py rather than asking Claude to generate validation code1178Make execution intent clear:1179"Run analyze_form.py to extract fields" (execute)1180"See analyze_form.py for the extraction algorithm" (read as reference)1181Test file access patterns: Verify Claude can navigate your directory structure by testing with real requests1182Example:11831184bigquery-skill/1185├── SKILL.md (overview, points to reference files)1186└── reference/1187├── finance.md (revenue metrics)1188├── sales.md (pipeline data)1189└── product.md (usage analytics)1190When the user asks about revenue, Claude reads SKILL.md, sees the reference to reference/finance.md, and invokes bash to read just that file. The sales.md and product.md files remain on the filesystem, consuming zero context tokens until needed. This filesystem-based model is what enables progressive disclosure. Claude can navigate and selectively load exactly what each task requires.11911192For complete details on the technical architecture, see How Skills work in the Skills overview.11931194MCP tool references1195If your Skill uses MCP (Model Context Protocol) tools, always use fully qualified tool names to avoid "tool not found" errors.11961197Format: ServerName:tool_name11981199Example:12001201Use the BigQuery:bigquery_schema tool to retrieve table schemas.1202Use the GitHub:create_issue tool to create issues.1203Where:12041205BigQuery and GitHub are MCP server names1206bigquery_schema and create_issue are the tool names within those servers1207Without the server prefix, Claude may fail to locate the tool, especially when multiple MCP servers are available.12081209Avoid assuming tools are installed1210Don't assume packages are available:12111212**Bad example: Assumes installation**:1213"Use the pdf library to process the file."12141215**Good example: Explicit about dependencies**:1216"Install required package: `pip install pypdf`12171218Then use it:1219```python1220from pypdf import PdfReader1221reader = PdfReader("file.pdf")1222```"1223Technical notes1224YAML frontmatter requirements1225The SKILL.md frontmatter requires name and description fields with specific validation rules:12261227name: Maximum 64 characters, lowercase letters/numbers/hyphens only, no XML tags, no reserved words1228description: Maximum 1024 characters, non-empty, no XML tags1229See the Skills overview for complete structure details.12301231Token budgets1232Keep SKILL.md body under 500 lines for optimal performance. If your content exceeds this, split it into separate files using the progressive disclosure patterns described earlier. For architectural details, see the Skills overview.12331234Checklist for effective Skills1235Before sharing a Skill, verify:12361237Core quality1238Description is specific and includes key terms1239Description includes both what the Skill does and when to use it1240SKILL.md body is under 500 lines1241Additional details are in separate files (if needed)1242No time-sensitive information (or in "old patterns" section)1243Consistent terminology throughout1244Examples are concrete, not abstract1245File references are one level deep1246Progressive disclosure used appropriately1247Workflows have clear steps1248Code and scripts1249Scripts solve problems rather than punt to Claude1250Error handling is explicit and helpful1251No "voodoo constants" (all values justified)1252Required packages listed in instructions and verified as available1253Scripts have clear documentation1254No Windows-style paths (all forward slashes)1255Validation/verification steps for critical operations1256Feedback loops included for quality-critical tasks1257Testing1258At least three evaluations created1259Tested with Haiku, Sonnet, and Opus1260Tested with real usage scenarios1261Team feedback incorporated (if applicable)126212631264https://github.com/anthropics/skills