skills/building-skills/SKILL.md
Create, restructure, and validate Claude Code skills following best practices. Handles directory structure, YAML frontmatter, progressive disclosure, credential management, self-learning with consolidation, and script organization. Use when creating new skills, restructuring existing skills, reviewing skills for quality, or asking about skill structure, patterns, or best practices.
npx skillsauth add changeflowhq/skills building-skillsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Read LEARNED.md before building or reviewing any skill.
Skills share context with system prompt, conversation history, other skills, and the user's request. Only add what Claude doesn't already know.
For every line ask: Does this justify its token cost? If Claude knows it, cut it.
Skills load in three stages. Design for this.
| Stage | What loads | Budget | Contains |
|-------|-----------|--------|----------|
| Discovery | name + description | ~100 tokens | Trigger keywords, when to use |
| Activation | SKILL.md body | <5000 tokens | Instructions, workflows, quick start |
| Execution | references/, scripts/ | As needed | Detailed docs, executable code |
Critical: The description field is the trigger mechanism. All "when to use" info goes there, not the body. The body only loads AFTER triggering.
Match instruction specificity to how fragile the task is:
python scripts/deploy.py --env prod"Every skill MUST have LEARNED.md with consolidation rules. No exceptions.
skill-name/
├── SKILL.md # Required. <500 lines. Core instructions.
├── LEARNED.md # Required. <50 lines. Dated entries + consolidation.
├── scripts/ # Executable code. Runs but never loaded into context.
├── references/ # Detailed docs. Loaded into context on demand (costs tokens).
├── setup/ # Credential templates, setup instructions.
└── assets/ # Files used in output (templates, icons). Never loaded into context.
Key distinction: references/ costs tokens when read. scripts/ and assets/ don't - scripts execute and return output, assets are used in generated files. Put large docs, templates, and data in assets/ not references/.
---
name: skill-name
description: |
Third person. WHAT it does + WHEN to use it + trigger keywords.
This is the primary trigger. Max 1024 chars. No angle brackets.
allowed-tools: Bash Read Write
---
name: kebab-case, max 64 chars, no consecutive/leading/trailing hyphens. Must match directory name.
description: The most important field. Claude reads ALL descriptions to decide which skill to trigger. Front-load trigger conditions. Include keywords users would actually say. Bad: "Manages Google Ads." Good: "Control Google Ads via official API. Create, pause, optimize campaigns, ads, keywords, bids. Run audits. Use when user mentions Google Ads, PPC, AdWords, Quality Score, or ad performance."
allowed-tools: Only tools the skill needs. Common: Bash Read Write Edit.
Allowed keys: name, description, license, allowed-tools, metadata, compatibility. Nothing else.
Write 3-5 user requests this skill should fire on. These become description keywords and test cases.
python3 ~/.claude/skills/building-skills/scripts/init_skill.py my-skill --path ~/.claude/skills
This creates SKILL.md, LEARNED.md, scripts/, references/, setup/, and assets/ with guided TODOs.
Before the body. The description determines if the skill ever triggers.
Pattern: [What it does] + [How/via what] + [Specific actions] + [Trigger keywords]
Example: "Local semantic search for markdown knowledge bases using qmd (tobi/qmd). Indexes markdown with BM25 keyword search, vector embeddings, and hybrid reranked queries. Auto-indexes on edits via Claude Code hooks. Use when searching project docs, knowledge bases, meeting notes, or any indexed markdown collection."
# Skill Name
## Quick Start
[Minimal working example - simplest successful use]
## Core Operations
[Brief list. Link to references/ for detail if >100 lines.]
## Workflows
[Checklists for multi-step tasks. Conditional routing for different paths.]
## Error Reference
[Common errors and fixes. Keep actionable, not exhaustive.]
## Self-Learning
[LEARNED.md link + what to record + consolidation rules]
Stay under 500 lines. If approaching 300, start splitting to references/.
Create LEARNED.md:
# skill-name - Learned
<!-- Keep under 50 lines. Consolidate before adding. -->
## [Category]
- (YYYY-MM-DD) Observation here
Add Self-Learning section to SKILL.md (see template below).
Scripts must detect missing deps and guide setup, not fail silently:
import os, sys
required = ['MY_API_KEY']
missing = [v for v in required if not os.environ.get(v)]
if missing:
print(f"Missing: {', '.join(missing)}")
print("Add to ~/.claude/settings.json under \"env\"")
sys.exit(1)
python3 ~/.claude/skills/building-skills/scripts/validate_skill.py ~/.claude/skills/my-skill
Fix errors, address warnings, re-run until clean.
~/.claude/settings.json env vars. Never hardcode. Scripts detect and print setup instructions. Document in setup/README.md.
Multi-step tasks get numbered, copy-able checklists with explicit steps.
**Creating new?** → See [Creation](#creation)
**Editing?** → See [Editing](#editing)
**Debugging?** → See [references/troubleshooting.md](references/troubleshooting.md)
1. Make changes → 2. Run validator → 3. If errors, fix and go to 2
Strict format: provide exact template in assets/. Flexible format: show examples.
Skills can hook into Claude Code (PreToolUse/PostToolUse) for system-level behavior like auto-indexing or domain blocking. Document in hooks/ subdirectory.
For detailed pattern examples, see references/patterns.md.
| Don't | Do |
|-------|-----|
| Trigger info only in body | Put trigger keywords in description |
| Credentials in skill files | ~/.claude/settings.json env vars |
| Scripts in global folder | Scripts inside skill directory |
| SKILL.md >500 lines | Split to references/ |
| Nested references (A→B→C) | One level deep from SKILL.md |
| No LEARNED.md | Every skill must self-learn |
| Unbounded LEARNED.md | Cap 50 lines, consolidate |
| README.md, CHANGELOG.md etc | Skills are for AI, not human docs |
| "You can use..." in description | Third person: "Processes..." |
| Assume deps installed | Check and guide setup on failure |
| Large docs in references/ | Put in assets/ if not needed in context |
## Self-Learning
Read [LEARNED.md](LEARNED.md) before using this skill.
**Update LEARNED.md when you discover:** [list skill-specific things to record]
**Consolidation (keep under 50 lines):**
Before adding a new entry, check file length. If over 50 lines:
1. Merge duplicate/overlapping entries into single proven patterns
2. Remove entries older than 3 months that haven't been reinforced
3. Drop one-off observations that never recurred
4. Move detailed context to `LEARNED-archive.md` if worth preserving
5. Keep only entries that would change behavior - if obvious, cut it
Read LEARNED.md before building or reviewing any skill.
Update LEARNED.md when you discover:
Consolidation (keep under 50 lines): Before adding, check length. If over 50: merge duplicates, prune stale (>3mo unreinforced), drop one-offs, archive to LEARNED-archive.md.
tools
Invisible Chrome automation for web scraping via CDP. Use when WebFetch fails or gets blocked (403, 429, Cloudflare, bot protection, JS-rendered pages). Launches your real Chrome install completely hidden, sends commands via Chrome DevTools Protocol. Sites see a normal browser with real extensions - no detectable automation. Learns which domains block and skips straight to stealth on future requests. Also handles form filling, clicking, screenshots, and scraping dynamic content.
development
Local semantic search engine for markdown knowledge bases using qmd (tobi/qmd). Indexes markdown files with BM25 keyword search, vector embeddings for semantic search, and hybrid reranked queries. Auto-indexes on file edits via Claude Code hooks and refreshes embeddings overnight via launchd. Use when searching project docs, knowledge bases, meeting notes, or any indexed markdown collection.
tools
Create short video animations from HTML/CSS/JS. Frame-by-frame capture at 30fps using Playwright + ffmpeg. Write CSS animations normally - the recorder pauses and steps them. Use for product demos, social clips, ad creative, feature announcements.
development
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.