Agent Skills
Table of Contents
1. Introduction
Skills are model-invoked capabilities that Claude autonomously uses based on context. Unlike slash commands (user-invoked), skills are automatically activated when relevant to the current situation.
1.1. How Skills Work
- Discovery: Claude discovers skills from
.claude/skills/*/SKILL.mddirectories - Context matching: Claude evaluates if a skill's description matches the current context
- Automatic activation: When relevant, Claude uses the skill's instructions
- Tool execution: Skills execute within their defined
allowed-tools
1.2. Skill Structure
Each skill is a directory containing SKILL.md:
.claude/skills/
├── typescript-types/
│ └── SKILL.md
├── test-coverage/
│ └── SKILL.md
└── emacs-context/
└── SKILL.md
1.3. Frontmatter Format
--- name: Skill Display Name description: Clear description of when and how this skill activates allowed-tools: - Read - Write - Grep model: "sonnet" # Optional model override ---
1.4. Writing Good Descriptions
The description is crucial - it determines when the skill activates.
Good descriptions:
- "Automatically generate TypeScript type definitions from API responses, JSON data, or existing JavaScript code"
- "Analyze test coverage and suggest missing test cases when code is added or modified"
Bad descriptions:
- "Types" (too vague)
- "Does TypeScript stuff" (unclear when to activate)
2. Skill Categories
This directory contains skills organized by category. Each category has its own file for better navigation and maintenance.
2.1. JavaScript/TypeScript Development Skills
JavaScript and TypeScript development skills for modern syntax, type safety, security, and testing.
Includes:
- JavaScript/TypeScript Conventions Enforcer (✓ tangled)
- TypeScript Type Generator (✓ tangled)
- JavaScript/TypeScript Security Checker (✓ tangled)
2.2. Rails Development Skills
Ruby on Rails specific skills for conventions, security, performance, and testing.
Includes:
- Rails Convention Enforcer (✓ tangled)
- N+1 Query Detector (example)
- Rails Security Checker (✓ tangled)
- Test Coverage Assistant (Rails) (example)
- Migration Safety Checker (✓ tangled)
- Rails Upgrade Helper (example)
2.3. Python Development Skills
Python development skills for PEP 8, type safety, testing, security, and common pitfalls.
Includes:
- Python Conventions Enforcer (✓ tangled)
- Type Hints Assistant (example)
- Python Testing Assistant (example)
- Python Security Checker (✓ tangled)
- Python Common Pitfalls (example)
2.4. Emacs Integration Skills
Skills that leverage the Emacs MCP server for enhanced context-aware assistance.
Includes:
- Emacs Context Helper (✓ tangled)
2.5. Documentation Skills
Skills for maintaining and improving documentation quality.
Includes:
- Documentation Completeness Checker (example)
3. Best Practices for Skills
3.1. Skill Design Principles
3.1.1. Clear Activation Conditions
The description should clearly state when to activate:
- Specific contexts (working with TypeScript)
- Specific actions (code is added)
- Specific problems (missing tests)
3.1.2. Appropriate Tool Access
Only request tools the skill actually needs:
- More tools = more powerful but also more risky
- Restrict to minimum necessary
- Document why each tool is needed
3.1.3. Complementary to Commands
Skills and commands should work together:
- Commands: User explicitly invokes
- Skills: Automatic based on context
- Commands can leverage skills' logic
- Skills can suggest relevant commands
3.2. Writing Effective Skills
3.2.1. Be Proactive But Not Pushy
Good:
- "I notice there are no tests for this new function. Would you like me to generate some?"
- "This code could benefit from TypeScript types. Should I add them?"
Bad:
- "You MUST add tests now!"
- "I'm going to fix all your code"
3.2.2. Provide Value Automatically
Skills should:
- Save time on repetitive tasks
- Catch issues early
- Suggest improvements proactively
- Enhance capabilities without extra effort
3.2.3. Respect User Intent
Don't:
- Make changes without asking
- Override user decisions
- Be overly verbose
- Activate when not relevant
## Testing Skills
After creating a skill:
- Tangle the file to generate
.claude/skills/skill-name/SKILL.md - Restart Claude Code to discover the new skill
- Create test scenarios that match activation conditions
- Verify appropriate activation - not too eager, not too shy
- Check tool restrictions - ensure only allowed tools are used
- Refine description if activation isn't right
## Skill vs Command Decision
Use a Skill when:
- Action should happen automatically
- Context determines relevance
- Saves user from repetitive invocation
- Enhances existing workflows
Use a Command when:
- User should explicitly invoke
- Action needs user input/confirmation
- Used occasionally, not continuously
- Clear start and end point
Use Both when:
- Skill detects need
- Skill suggests using a command
- Command uses skill's logic
Example: Test Coverage
- Skill: Detects missing tests, suggests adding them
- Command:
/testexplicitly generates tests
4. Related Configuration
- Settings - Configure tool permissions for skills
- Slash Commands - User-invoked alternatives
- MCP Servers - External tools skills can use
5. Resources
5.1. General Skills
5.2. JavaScript/TypeScript Development
5.2.1. Official Documentation
- MDN JavaScript Documentation - Comprehensive JavaScript reference
- TypeScript Documentation - Official TypeScript handbook
- ECMAScript Specification - JavaScript language specification
5.2.2. TypeScript & Type Safety
- TypeScript Handbook - Complete TypeScript guide
- Total TypeScript - TypeScript learning resources
- QuickType - Generate types from JSON
- Zod - TypeScript-first schema validation
5.2.3. JavaScript/TypeScript Testing
- Jest - JavaScript testing framework
- Vitest - Fast unit testing for Vite projects
- Testing Library - React/Vue/Angular testing utilities
- Playwright - End-to-end testing
5.2.4. JavaScript/TypeScript Security
- ESLint Security Rules - Linting for security
- DOMPurify - XSS sanitizer
- Snyk - Dependency vulnerability scanner
- OWASP Node.js Security - Node.js security best practices
5.2.5. Code Quality & Formatting
- ESLint - JavaScript/TypeScript linter
- Prettier - Code formatter
- TypeScript ESLint - TypeScript-specific linting
- Biome - Fast formatter and linter
5.2.6. Frameworks & Libraries
- React Documentation - Official React docs
- Next.js Documentation - React framework
- Vue.js Guide - Vue.js framework
- Node.js Documentation - Server-side JavaScript
5.3. Python Development
5.3.1. Official Python Documentation
- Python 3 Documentation - Official comprehensive documentation
- PEP 8 - Python style guide
- PEP 257 - Docstring conventions
- PEP 484 - Type hints
- typing module - Type hints documentation
5.3.2. Python Testing
- pytest Documentation - Popular testing framework
- unittest - Built-in testing framework
- unittest.mock - Mocking library
- Coverage.py - Code coverage measurement
- Hypothesis - Property-based testing
5.3.3. Python Security
- Bandit - Python security linter
- Safety - Check dependencies for vulnerabilities
- pip-audit - Audit Python packages
- OWASP Top 10 - Web security vulnerabilities
- OWASP Python Security - Python security best practices
5.3.4. Python Code Quality
5.3.5. Python Type Hints
- mypy Documentation - Type checking
- typingextensions - Backported typing features
- Pydantic - Data validation using type hints
- Pyright - Microsoft's type checker
5.4. Rails Development
5.4.1. Official Rails Documentation
- Rails Guides - Official comprehensive guides
- Rails Security Guide - Security best practices
- Rails Migrations Guide - Migration documentation
- Rails Upgrading Guide - Version upgrade instructions
- Rails API Documentation - Complete API reference
5.4.2. Rails Security
- Brakeman - Static security analyzer for Rails
- bundler-audit - Check for vulnerable gem versions
- OWASP Top 10 - Common web vulnerabilities
- Brakeman Scanner - Rails security scanning tool
5.4.3. Rails Performance
- Bullet gem - N+1 query detector
- Prosopite - Alternative N+1 detector
- nplusonecontrol - RSpec/Minitest matchers for N+1
- rack-mini-profiler - Performance profiling
5.4.4. Rails Migration Safety
- strongmigrations gem - Catch unsafe migrations
- onlinemigrations gem - Advanced PostgreSQL migration safety
- PostgreSQL ALTER TABLE - Understanding database locks
5.4.5. Rails Testing
- RSpec - Behavior-driven testing framework
- FactoryBot - Fixture replacement for testing
- SimpleCov - Code coverage analysis
- Capybara - Integration testing framework
5.4.6. Rails Conventions
- Rails Style Guide - Community-driven style guide
- RuboCop Rails - Rails-specific linting
- Reek - Code smell detector
5.4.7. Rails Upgrade Resources
- RailsDiff.org - Compare Rails versions side-by-side
- Rails 7.2 Release Notes
- Rails 8.0 Release Notes