| name | claude-code-infrastructure-showcase |
| description | Expert in Claude Code infrastructure patterns - auto-activating skills, hooks, agents, and dev docs systems |
| triggers | ["how do I set up Claude Code skills","make my skills activate automatically","create a hook for Claude Code","build a specialized agent","set up dev docs pattern","implement skill auto-activation","configure skill-rules.json","create modular skills with progressive disclosure"] |
Claude Code Infrastructure Showcase
Skill by ara.so — Claude Code Skills collection.
Expert guidance for implementing production-tested Claude Code infrastructure including auto-activating skills, hooks, agents, and dev docs systems extracted from 6 months of real-world TypeScript microservices development.
What This Project Provides
The claude-code-infrastructure-showcase is a reference library (not a working application) providing:
- Auto-activating skills via hook-based triggers
- Modular skill pattern following 500-line rule with progressive disclosure
- Specialized agents for complex development tasks
- Dev docs system that preserves context across resets
- Production-tested patterns from real enterprise development
Key Philosophy: Copy what you need into your own projects. Everything is designed to be extracted and customized.
Repository Structure
.claude/
├── skills/ # Production skills
│ ├── backend-dev-guidelines/ # Node.js/Express/Prisma patterns
│ ├── frontend-dev-guidelines/ # React/TypeScript/MUI v7
│ ├── skill-developer/ # Meta-skill for creating skills
│ ├── route-tester/ # API route testing
│ ├── error-tracking/ # Sentry integration
│ └── skill-rules.json # Skill activation config
├── hooks/ # Automation hooks
│ ├── skill-activation-prompt.* # Auto-suggest skills (ESSENTIAL)
│ ├── post-tool-use-tracker.sh # Track file operations (ESSENTIAL)
│ ├── tsc-check.sh # TypeScript validation (optional)
│ └── trigger-build-resolver.sh # Build error resolution (optional)
├── agents/ # Specialized agents
│ ├── code-architecture-reviewer.md
│ ├── refactor-planner.md
│ └── ... 8 more agents
└── commands/ # Slash commands
└── dev-docs.md
dev/active/ # Dev docs examples
Core Concepts
1. Auto-Activation System
Problem: Skills don't activate automatically - you must remember to use them.
Solution: Hook + configuration system:
{
"skills": [
{
"name": "backend-dev-guidelines",
"activationRules": {
"pathPatterns": [
"**/src/routes/**",
"**/src/controllers/**",
"**/src/services/**"
],
"promptKeywords": [
"api", "endpoint", "route", "controller",
"service", "repository", "database"
],
"autoActivate": true
}
}
]
}
How it works:
skill-activation-prompt hook runs on every user prompt
- Analyzes prompt text and open file paths
- Matches against
skill-rules.json patterns
- Auto-suggests relevant skills
2. Modular Skills (500-Line Rule)
Large skills hit context limits. Use progressive disclosure:
skill-name/
├── SKILL.md # <500 lines - overview + navigation
└── resources/
├── routing-patterns.md # <500 lines each
├── testing-guide.md
└── error-handling.md
Example from backend-dev-guidelines:
<!-- SKILL.md -->
# Backend Development Guidelines
## Quick Navigation
- [Routing Patterns](resources/routing-patterns.md)
- [Controller Layer](resources/controllers.md)
- [Service Layer](resources/services.md)
## When to Load Resources
- Working on routes? → Load routing-patterns.md
- Writing business logic? → Load services.md
3. Dev Docs Pattern
Preserve context across Claude Code resets:
dev/active/[task-name]/
├── [task]-plan.md # Strategic overview
├── [task]-context.md # Key decisions & files
└── [task]-tasks.md # Checklist format
Installation & Setup
Phase 1: Essential Hooks (15 minutes)
Step 1: Copy hook files
cp .claude/hooks/skill-activation-prompt.* your-project/.claude/hooks/
cp .claude/hooks/post-tool-use-tracker.sh your-project/.claude/hooks/
chmod +x your-project/.claude/hooks/*.sh
Step 2: Install Node.js dependencies (for skill-activation-prompt)
cd your-project/.claude/hooks
npm init -y
npm install fs path
Step 3: Update settings.json
{
"hooks": {
"UserPromptSubmit": [
{
"command": "node",
"args": [".claude/hooks/skill-activation-prompt.js"],
"timeout": 5000
}
],
"PostToolUse": [
{
"command": ".claude/hooks/post-tool-use-tracker.sh",
"timeout": 3000
}
]
}
}
Phase 2: Add Your First Skill (10 minutes)
Step 1: Choose a skill
Available skills:
backend-dev-guidelines - Express/Prisma/TypeScript APIs
frontend-dev-guidelines - React/MUI/TypeScript
skill-developer - Creating new skills
route-tester - Testing authenticated routes
error-tracking - Sentry integration
Step 2: Copy skill directory
cp -r .claude/skills/backend-dev-guidelines your-project/.claude/skills/
Step 3: Create/update skill-rules.json
cp .claude/skills/skill-rules.json your-project/.claude/skills/
Step 4: Customize path patterns
{
"skills": [
{
"name": "backend-dev-guidelines",
"activationRules": {
"pathPatterns": [
"**/api/routes/**",
"**/api/controllers/**",
"**/services/**"
],
"promptKeywords": [
"api", "endpoint", "route"
],
"autoActivate": true
}
}
]
}
Phase 3: Test Activation (5 minutes)
Test 1: Path-based activation
code your-project/api/routes/users.ts
"How should I structure this route?"
Test 2: Keyword-based activation
"I need to create a new API endpoint for user registration"
Key Patterns & Examples
Pattern 1: Creating a Modular Skill
Structure:
.claude/skills/my-skill/
├── SKILL.md
└── resources/
├── topic-1.md
├── topic-2.md
└── topic-3.md
SKILL.md template:
---
name: my-skill
description: Brief one-line description
triggers:
- "trigger phrase 1"
- "trigger phrase 2"
---
# My Skill
> Skill by [ara.so](https://ara.so)
## Overview
High-level guidance (keep under 500 lines)
## Quick Navigation
- [Topic 1](resources/topic-1.md) - Use when...
- [Topic 2](resources/topic-2.md) - Use when...
## When to Load Resources
**Working on X?** → Load topic-1.md
**Debugging Y?** → Load topic-2.md
Pattern 2: Skill Rules Configuration
Full example:
{
"skills": [
{
"name": "backend-dev-guidelines",
"activationRules": {
"pathPatterns": [
"**/src/routes/**",
"**/src/controllers/**",
"**/src/services/**",
"**/src/repositories/**",
"**/prisma/**"
],
"promptKeywords": [
"api", "endpoint", "route", "controller",
"service", "repository", "database", "prisma",
"validation", "error handling", "middleware"
],
"autoActivate":
Pattern 3: Creating a Hook
Example: Simple post-commit hook
#!/bin/bash
echo "Commit completed: $(git log -1 --oneline)"
if [ -f "dev/active/current-task/tasks.md" ]; then
echo "✓ Remember to update dev/active/current-task/tasks.md"
fi
exit 0
Register in settings.json:
{
"hooks": {
"PostToolUse": [
{
"command": ".claude/hooks/post-commit.sh",
"timeout": 3000
}
]
}
}
Pattern 4: Creating a Specialized Agent
Template:
---
name: my-agent
description: Agent for [specific task]
---
# My Agent
## Purpose
[What this agent does]
## When to Use
- [Scenario 1]
- [Scenario 2]
## Capabilities
- [Capability 1]
- [Capability 2]
## Workflow
### Step 1: [Phase Name]
[Instructions]
### Step 2: [Phase Name]
[Instructions]
## Output Format
[Expected deliverables]
## Example Usage
[Concrete example]
Real example from showcase:
---
name: code-architecture-reviewer
description: Reviews code for architectural consistency and best practices
---
# Code Architecture Reviewer
## Purpose
Analyze code against established architectural patterns and provide
actionable improvement recommendations.
## When to Use
- Before merging large features
- After major refactoring
- When onboarding new patterns
## Workflow
### Step 1: Load Context
- Read architecture documentation
- Review relevant skills (backend-dev-guidelines, etc.)
- Understand project structure
### Step 2: Analyze Code
- Check layer separation (routes → controllers → services)
- Verify error handling patterns
- Review naming conventions
### Step 3: Generate Report
- Inconsistencies found
- Recommended changes
- Priority ranking
Pattern 5: Dev Docs Workflow
Create with slash command:
/dev-docs "implement user authentication"
Generates:
# dev/active/user-authentication/
## user-authentication-plan.md
### Overview
Implement JWT-based authentication with refresh tokens
### Success Criteria
- Users can register/login
- Tokens expire after 15 minutes
- Refresh tokens work
## user-authentication-context.md
### Key Files
- src/routes/auth.ts
- src/services/authService.ts
- src/middleware/authenticate.ts
### Important Decisions
- Using JWT (not sessions) for scalability
- Refresh tokens stored in httpOnly cookies
## user-authentication-tasks.md
- [ ] Create auth routes
- [ ] Implement JWT generation
- [ ] Add middleware
- [ ] Write tests
Configuration Reference
settings.json Structure
{
"hooks": {
"UserPromptSubmit": [
{
"command": "node",
"args": [".claude/hooks/skill-activation-prompt.js"],
"timeout": 5000
}
],
"PostToolUse": [
{
"command": ".claude/hooks/post-tool-use-tracker.sh",
"timeout": 3000
}
],
"Stop": [
{
"command": ".claude/hooks/tsc-check.sh",
"timeout": 10000,
"continueOnError": true
}
]
skill-rules.json Schema
interface SkillRulesConfig {
skills: SkillRule[];
globalSettings?: {
maxConcurrentSkills?: number;
skillSuggestionMode?: 'auto' | 'manual';
};
}
interface SkillRule {
name: string;
activationRules: {
pathPatterns: string[];
promptKeywords: string[];
autoActivate: boolean;
priority?: number;
};
}
Available Skills
backend-dev-guidelines
Purpose: Node.js/Express/Prisma/TypeScript API development
Resources:
routing-patterns.md - Route structure and conventions
controllers.md - Controller layer patterns
services.md - Business logic organization
repositories.md - Data access layer
error-handling.md - Error management
validation.md - Input validation patterns
testing.md - Testing strategies
authentication.md - Auth patterns
database.md - Prisma best practices
logging.md - Logging and monitoring
middleware.md - Custom middleware
api-design.md - REST API conventions
Activation:
{
"pathPatterns": [
"**/src/routes/**",
"**/src/controllers/**",
"**/src/services/**"
],
"promptKeywords": ["api", "endpoint", "route", "service"]
}
frontend-dev-guidelines
Purpose: React/TypeScript/MUI v7 development
Resources:
component-patterns.md - Component structure
state-management.md - State patterns
mui-patterns.md - MUI v7 best practices
datagrid-patterns.md - DataGrid usage
form-patterns.md - Form handling
hooks-patterns.md - Custom hooks
routing.md - React Router patterns
testing.md - Component testing
performance.md - Optimization
accessibility.md - A11y guidelines
error-handling.md - Error boundaries
Activation:
{
"pathPatterns": [
"**/src/components/**",
"**/src/pages/**",
"**/src/hooks/**"
],
"promptKeywords": ["component", "react", "mui", "form"]
}
skill-developer
Purpose: Meta-skill for creating new skills
Resources:
skill-structure.md - Skill anatomy
progressive-disclosure.md - 500-line rule
skill-rules.md - Activation configuration
resource-organization.md - Resource file patterns
testing-skills.md - Skill testing
maintenance.md - Updating skills
examples.md - Real skill examples
Use when: Creating new skills or modifying existing ones
Available Agents
code-architecture-reviewer
Reviews code for architectural consistency
Usage:
@code-architecture-reviewer Review the new user service for architectural issues
refactor-planner
Creates detailed refactoring strategies
Usage:
@refactor-planner Plan refactoring of the auth system to use dependency injection
frontend-error-fixer
Debugs frontend errors with React DevTools context
Usage:
@frontend-error-fixer Fix the "Cannot read property 'map' of undefined" error in UserList
documentation-architect
Generates comprehensive documentation
Usage:
@documentation-architect Generate API documentation for the user service
auth-route-tester
Tests authenticated API endpoints
Usage:
@auth-route-tester Test POST /api/users/register with sample data
auto-error-resolver
Automatically fixes TypeScript compilation errors
Usage:
@auto-error-resolver Fix type errors in src/services/userService.ts
Common Workflows
Workflow 1: Setting Up for a New Project
mkdir -p .claude/hooks
cp showcase/.claude/hooks/skill-activation-prompt.* .claude/hooks/
cp showcase/.claude/hooks/post-tool-use-tracker.sh .claude/hooks/
chmod +x .claude/hooks/*.sh
cd .claude/hooks && npm init -y && npm install fs path
mkdir -p .claude/skills
cp -r showcase/.claude/skills/backend-dev-guidelines .claude/skills/
cat > .claude/skills/skill-rules.json << 'EOF'
{
"skills": [
{
"name": "backend-dev-guidelines",
"activationRules": {
"pathPatterns": ["**/src/**"],
"promptKeywords": ["api", "service"],
"autoActivate": true
}
}
]
}
EOF
cat > .claude/settings.json << 'EOF'
{
"hooks": {
"UserPromptSubmit": [
{
"command": "node",
"args": [".claude/hooks/skill-activation-prompt.js"],
"timeout": 5000
}
],
"PostToolUse": [
{
"command": ".claude/hooks/post-tool-use-tracker.sh",
"timeout": 3000
}
]
}
}
EOF
Workflow 2: Creating a Custom Skill
mkdir -p .claude/skills/graphql-guidelines/resources
cat > .claude/skills/graphql-guidelines/SKILL.md << 'EOF'
---
name: graphql-guidelines
description: GraphQL API development patterns with Apollo Server
triggers:
- "graphql schema"
- "resolver implementation"
- "graphql query"
---
> Skill by [ara.so](https://ara.so)
Patterns for GraphQL API development
- [Schema Design](resources/schema-design.md)
- [Resolver Patterns](resources/resolvers.md)
EOF
Workflow 3: Using Dev Docs
/dev-docs "refactor authentication to use refresh tokens"
/dev-docs-update
Workflow 4: Adding a Hook
cat > .claude/hooks/pre-commit-check.sh << 'EOF'
echo "Running pre-commit checks..."
npm run lint
if [ $? -ne 0 ]; then
echo "❌ Linting failed"
exit 1
fi
echo "✅ Pre-commit checks passed"
exit 0
EOF
chmod +x .claude/hooks/pre-commit-check.sh
Troubleshooting
Skills Not Activating
Problem: Skills don't auto-suggest when expected
Check:
- Verify hook is registered in settings.json
- Check skill-rules.json path patterns match your structure
- Test hook manually:
node .claude/hooks/skill-activation-prompt.js
- Review hook logs in
.claude/hooks/activation-log.json
Common issues:
- Path patterns too specific (use broader globs)
- Keywords not matching (add more trigger words)
- Hook timeout too short (increase to 5000ms)
Hooks Not Running
Problem: Hooks don't execute at all
Check:
- Hook files are executable:
chmod +x .claude/hooks/*.sh
- settings.json syntax is valid (use JSON validator)
- Hook paths are relative to project root
- Node.js dependencies installed for .js hooks
Debug:
.claude/hooks/post-tool-use-tracker.sh
echo $?
Context Limit Errors
Problem: "Context limit exceeded" when loading skill
Solution: Skill is too large, needs modularization
wc -l .claude/skills/my-skill/SKILL.md
mkdir -p .claude/skills/my-skill/resources
Dev Docs Not Persisting
Problem: Context still lost after using dev docs
Check:
- Files saved in
dev/active/[task-name]/
- All three files created (plan, context, tasks)
- Files committed to git (not in .gitignore)
Best practice:
"Load all files in dev/active/auth-refactor/ and summarize the current state"
Hook Performance Issues
Problem: Hooks causing slowdowns
Solutions:
-
Optimize JavaScript hooks:
const cache = new Map();
function readFileWithCache(path) {
if (cache.has(path)) return cache.get(path);
const content = fs.readFileSync(path, 'utf8');
cache.set(path, content);
return content;
}
-
Set appropriate timeouts:
{
"timeout": 3000,
"timeout": 10000
}
-
Use continueOnError:
{
"command": ".claude/hooks/heavy-check.sh",
"continueOnError": true
}
Environment Variables
Hooks and skills reference these environment vars:
PROJECT_ROOT=/path/to/project
CLAUDE_CONFIG_DIR=/path/to/project/.claude
SKILL_RULES_PATH=$CLAUDE_CONFIG_DIR/skills/skill-rules.json
HOOK_LOG_LEVEL=info
ACTIVATION_LOG=$CLAUDE_CONFIG_DIR/hooks/activation-log.json
TSC_PATH=./node_modules/.bin/tsc
ESLINT_PATH=./node_modules/.bin/eslint
Best Practices
Skill Development
-
Keep main SKILL.md under 500 lines
- Use resources/ for deep dives
- Include navigation section
- Explain when to load each resource
-
Write clear activation rules
{
"pathPatterns": [
"**/specific/path/**",
"**/broad/path/**"
]
}
-
Use real code examples
- From your actual project
- Show before/after
- Include error cases
-
Version control skills
- Commit to git
- Document changes
- Tag releases
Hook Development
-
Keep hooks fast (<3 seconds)
- Cache expensive operations
- Use timeouts appropriately
- Fail gracefully
-
Handle errors explicitly
#!/bin/bash
set -e
if ! command -v node &> /dev/null; then
echo "❌ Node.js not found"
exit 1
fi
-
Log useful information
console.error(JSON.stringify({
timestamp: new Date().toISOString(),
hook: 'skill-activation',
trigger: 'pathMatch',
skill: 'backend-dev-guidelines'
}));
Agent Usage
-
Be specific in requests
@refactor-planner Create plan to extract email sending logic into a service
@refactor-planner Improve the code
-
Provide context
- Load relevant files first
- Explain constraints
- Mention related issues
-
Review agent output
- Agents suggest, you decide
- Verify recommendations
- Adapt to your project
Integration Checklist
## Phase 1: Core Setup
- [ ] Copy skill-activation-prompt hook
- [ ] Copy post-tool-use-tracker hook
- [ ] Install Node.js dependencies in .claude/hooks
- [ ] Update settings.json with hooks
- [ ] Test hooks execute (check logs)
## Phase 2: First Skill
- [ ] Choose relevant skill
- [ ] Copy skill directory
- [ ] Create skill-rules.json
- [ ] Customize path patterns for your project
- [ ] Test skill activation (open matching file)
## Phase 3: Validation
- [ ] Skill auto-suggests on file open
- [ ] Skill auto-suggests on relevant prompt
- [ ] No performance degradation
- [ ] Hooks log properly
- [ ] Skills load resources correctly
## Phase 4: Enhancement (Optional)
- [ ] Add more skills as needed
- [ ] Copy useful agents
- [ ] Add slash commands
- [ ] Customize Stop hooks
- [ ] Set up dev docs pattern
Advanced Usage
Custom Skill Rules Logic
Extend skill-activation-prompt.js:
function shouldActivateSkill(skill, context) {
const { filePath, promptText, timestamp } = context;
if (skill.activationRules.timeOfDay) {
const hour = new Date(timestamp).getHours();
if (hour < 9 || hour > 17) return false;
}
if (skill.activationRules.branches) {
const branch = getCurrentGitBranch();
if (!skill.activationRules.branches.includes(branch)) {
return false;
}
}
if (skill.activationRules.maxFileSize) {
const size = fs.statSync(filePath).size;
if (size > skill.activationRules.maxFileSize) {
return false;
}
}
return true;
}
Conditional Resource Loading
In SKILL.md, add logic for resource loading:
## Progressive Loading Strategy
**For small changes (<50 lines):**
Just use this main skill file.
**For new features:**
1. Load [architecture overview](resources/architecture.md)
2. Load relevant pattern resource
**For debugging:**
1. Load [error-handling](resources/error-handling.md)
2. Load [logging](resources/logging.md)
**For refactoring:**
Load ALL resources for comprehensive guidance.
Multi-Project Skill Sharing
Share skills across projects:
mkdir ~/claude-skills
cp -r project1/.claude/skills/* ~/claude-skills/
ln -s ~/claude-skills project2/.claude/skills
{
"skills": [
{
"name": "backend-dev-guidelines",
"activationRules": {
"pathPatterns": [
"**/project2-specific/path/**"
]
}
}
]
}
Resources
License
MIT License - Use freely in personal or commercial projects.