Creating Components
Extend Claude Code with custom components tailored to your workflow.Component Types
Claude Code supports five component types:Agent Components
Agents are AI specialists with focused expertise.Agent File Structure
Agents use Markdown with YAML frontmatter:- Measure Impact
- Before/after benchmarks
- Bundle size reduction
- Lighthouse scores
Guidelines
When optimizing React applications:- Profile first, optimize second
- Focus on measurable improvements
- Balance performance with code readability
- Document optimization decisions
name- Unique identifier (kebab-case)description- Clear, concise expertise description
tools- Comma-separated list of allowed toolsmodel- Preferred Claude model variant
Use
model: opus for complex reasoning tasks, model: sonnet for balanced performance, or model: haiku for speed.Agent Categories
Organize agents by domain:Example: Security Auditor Agent
Security Tools
- Static Analysis: ESLint security plugins, Semgrep
- Dependency Scanning: npm audit, Snyk
- Secret Detection: git-secrets, TruffleHog
- Penetration Testing: Burp Suite, OWASP ZAP
Implementation
-
Bundle Analysis
-
Lighthouse Audit
-
Generate Report
- Bundle size breakdown
- Performance score
- Optimization recommendations
Output Format
Recommendations
Based on audit results, suggest:- Code splitting opportunities
- Lazy loading strategies
- Image optimization
- Caching improvements
Required Fields
Environment Variables
Use placeholders for sensitive data:Example: GitHub MCP
MCP Categories
Hook Components
Hooks automate actions based on events.Hook File Structure
Hook Types
- PreToolUse - Before tool execution
- PostToolUse - After tool execution
- PreConversation - Before conversation starts
- PostConversation - After conversation ends
Example: Git Auto-Add Hook
Available Variables
$CLAUDE_TOOL_NAME- Name of tool executed$CLAUDE_EDITED_FILE- Path to edited file$CLAUDE_PROJECT_PATH- Current project directory$CLAUDE_CONVERSATION_ID- Active conversation ID
Hook Categories
Settings Components
Settings configure Claude Code behavior.Settings File Structure
Common Settings
Performance:Component Review Process
Validation Checklist
Thecomponent-reviewer agent checks:
- ✅ Valid YAML frontmatter (for agents/commands)
- ✅ Valid JSON structure (for MCPs/hooks/settings)
- ✅ Required fields present
- ✅ Kebab-case naming conventions
- ✅ No hardcoded secrets or API keys
- ✅ Relative paths only (no absolute paths)
- ✅ Clear, specific descriptions
- ✅ Correct category placement
Example Review
Publishing Components
1
Create Component
Write component file in appropriate category directory
2
Review with Agent
3
Fix Issues
Address critical issues and warnings
4
Update Catalog
5
Test Installation
6
Submit PR
Open pull request with clear description and examples
Catalog Generation
After creating/modifying components:docs/components.json with:
- Component metadata
- File contents
- Installation instructions
- Search indexes
Best Practices
Naming Conventions
DO:- ✅
react-performance-expert(kebab-case) - ✅
security-auditor(descriptive) - ✅
github-integration(clear purpose)
- ❌
ReactExpert(PascalCase) - ❌
expert_agent(snake_case) - ❌
myagent(vague)
Descriptions
Good descriptions:Security
Use placeholders:Next Steps
Contributing Guide
Full contribution guidelines and workflow
Component Examples
Browse 900+ existing components for inspiration