How to Build Reusable Claude Code Skills for Website Optimization
Problem
Every time I need to run an SEO audit on a website, I repeat the same steps: analyze page structure, check meta tags, validate schema markup, review Core Web Vitals, generate a prioritized report. I keep explaining these workflows to Claude Code from scratch, and I keep rediscovering the same patterns.
I realized my skills were just fancy prompts - they lacked real context and reusable structure.
Then I found a Reddit discussion in r/claudeskills where someone shared an open-source SEO analysis skill called Toprank. A staff member commented: “I’ve found that’s kind of the magic with skills in general - when they stop being just a fancy prompt and start acting more like a reusable workflow with real context.”
That insight changed how I approach skill design.
Purpose
This post demonstrates how to build reusable Claude Code skills that combine procedural workflows with real context - codebase analysis, external data, and bundled resources.
What is a Skill?
A skill is a modular package with three components:
skill-name/├── SKILL.md # Required: YAML frontmatter + instructions├── scripts/ # Optional: executable automation├── references/ # Optional: loaded when needed└── assets/ # Optional: output templatesThe key insight: skills work best when they combine structured workflows with actual context, not just prompt text.
Step 1: Define Skill Metadata
The SKILL.md file starts with YAML frontmatter. This metadata stays in context at all times (~100 words).
---name: seo-auditdescription: This skill should be used when the user asks to "audit SEO", "analyze page performance", "check meta tags", "validate schema markup", "run SEO analysis", or mentions website optimization tasks including Google Search Console integration, Core Web Vitals, or on-page SEO checks.version: 1.0.0---I learned these best practices for descriptions:
- Use third-person format
- Include exact phrases users would say
- Be concrete, not vague like “SEO optimization”
- List specific trigger scenarios
When I wrote vague descriptions like “optimizes websites”, the skill rarely triggered. When I used exact phrases like “audit SEO” and “check meta tags”, it worked reliably.
Step 2: Design the Workflow
After frontmatter, the SKILL.md body contains imperative instructions. These load when the skill triggers.
# SEO Audit Skill
## Workflow
1. **Analyze the website structure** - Inspect HTML files, identify key pages2. **Check on-page SEO** - Validate meta tags, headings, schema markup3. **Performance audit** - Core Web Vitals, page load times, image optimization4. **Content analysis** - Keyword usage, internal linking, duplicate content5. **Generate report** - Create actionable recommendations with priority
For Google Search Console integration, see [GSC_GUIDE.md](references/GSC_GUIDE.md)The workflow uses progressive disclosure:
- Frontmatter: Always loaded (triggers)
- SKILL.md body: Loaded when skill triggers
- References: Loaded only when mentioned
This keeps context small while providing depth when needed.
Step 3: Add Bundled Resources
Scripts provide reliable automation. I put executable code in the scripts/ directory:
scripts/├── fetch_gsc_data.py # Google Search Console API├── analyze_performance.js # Lighthouse automation└── validate_schema.py # Schema markup validationReferences hold documentation that loads on demand:
references/├── GSC_GUIDE.md # Google Search Console integration├── SCHEMA_PATTERNS.md # Common schema templates└── SEO_CHECKLIST.md # Complete audit checklistAssets store output templates:
assets/├── seo_report_template.md # Report format└── priority_matrix.md # Issue prioritizationStep 4: Integrate MCP Tools
Skills gain more power when they connect to MCP servers. For SEO work, I use:
- Fetch MCP - Retrieve webpage content, extract meta tags
- Context7 MCP - Get official SEO documentation
- Search Console MCP - Fetch search analytics data
The skill instructions reference these tools directly:
## Workflow
1. Use `mcp__fetch__fetch_markdown` to retrieve page content2. Use `mcp__context7__resolve-library-id` for SEO docs3. Call Search Console MCP for analytics dataStep 5: Test and Iterate
I tested the skill on real optimization tasks:
- Ran it on three different websites
- Noticed it struggled with schema validation
- Added
scripts/validate_schema.py - Updated SKILL.md to reference the script
- Tested again - now it handles schemas reliably
Each iteration made the skill more practical.
Common Mistakes I Made
When I started building skills, I made several mistakes:
Vague descriptions:
# Wrong - too genericdescription: This skill helps with SEO.
# Right - specific triggersdescription: This skill should be used when the user asks to "audit SEO", "check meta tags", or "validate schema markup".Bloated SKILL.md body: I put too much content in the body, which loaded every time the skill triggered. Now I use references for detailed guides.
Missing user phrases: I forgot to include exact phrases users say. Skills triggered unpredictably.
Too generic: I tried building “website helper” skills instead of focused “SEO audit” skills. Domain-specific skills work better.
Complete Example
Here’s a complete SKILL.md for a meta tag optimizer:
---name: meta-tag-optimizerdescription: This skill should be used when the user asks to "optimize meta tags", "update title and description", "fix SEO metadata", or mentions meta tag optimization including title tags, meta descriptions, open graph tags, or Twitter cards.version: 1.0.0---
# Meta Tag Optimizer
## Workflow
1. **Analyze current meta tags** - Inspect HTML files2. **Identify issues** - Missing tags, duplicates, length issues3. **Generate optimized tags** - Based on content and SEO best practices4. **Update files** - Apply changes with proper format
See [META_GUIDE.md](references/META_GUIDE.md) for complete tag specifications.The full directory structure:
seo-optimizer-skill/├── SKILL.md├── scripts/│ ├── run_lighthouse.sh│ ├── fetch_gsc_data.py│ └── generate_report.py├── references/│ ├── META_GUIDE.md│ ├── GSC_GUIDE.md│ └── SEO_CHECKLIST.md└── assets/ └── seo_report_template.mdWhy This Matters
Skills transform repetitive work into reusable workflows:
- Efficiency: I run SEO audits without re-explaining the process
- Consistency: Standardized approach across all audits
- Context: Skills combine codebase analysis with external data sources
- Community: Open-source skills like Toprank demonstrate proven patterns
The magic happens when skills stop being fancy prompts and start acting like workflows with real context.
Summary
In this post, I showed how to build reusable Claude Code skills using SKILL.md files with YAML frontmatter, structured workflows, and bundled resources. The key point is that skills become powerful when they combine procedural knowledge with real context - codebase analysis, external data, and scripts that run reliably.
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Comments