Claude Code Configuration¶
This infrastructure includes comprehensive Claude Code enhancements for AI-assisted operations.
Overview¶
Claude Code is configured with custom skills, agents, commands, and safety hooks specific to this infrastructure. These enhancements enable:
- Context-aware assistance - Claude understands this specific infrastructure
- Safety guardrails - Dangerous commands are blocked before execution
- Specialized agents - Domain-specific experts for different tasks
- Quick commands - Slash commands for common operations
Components Summary¶
| Type | Count | Location |
|---|---|---|
| Skills | 12 | .claude/skills/ |
| Custom Agents | 4 | .claude/agents/ |
| Quick Commands | 4 | .claude/commands/infra/ |
| Safety Hooks | 3 | .claude/hooks/ |
Skills¶
Skills are model-invoked capabilities that activate automatically based on context.
Infrastructure-Specific Skills¶
| Skill | Activates When | Purpose |
|---|---|---|
monitoring-operations |
Discussing Prometheus, Grafana, Loki | PromQL queries, LogQL, dashboards |
notification-management |
Working with ntfy, Apprise | Push notifications, SMTP gateway |
security-auditing |
Security reviews, SSL checks | Certificate verification, secret detection |
git-operations |
Gitea, GitHub sync | Repository management, BFG filtering |
redis-management |
Redis operations | cache-redis, session-redis management |
media-services |
Jellyfin, Metube | Media streaming and downloads |
Core Skills (Pre-existing)¶
| Skill | Purpose |
|---|---|
backup-restore |
Backup procedures and disaster recovery |
database-operations |
PostgreSQL and Supabase database ops |
docker-stack-manager |
Docker Compose stack management |
infrastructure-diagnostics |
Troubleshooting and health checks |
n8n-workflow-builder |
n8n automation workflows |
service-deployment |
New service deployment with Traefik |
Custom Agents¶
Specialized agents with infrastructure-specific knowledge.
infrastructure-specialist¶
Model: Sonnet | Tools: Read, Grep, Glob, Bash, WebFetch
Context-aware expert on this specific infrastructure. Knows: - Service topology and dependencies - Network architecture (traefik_proxy, supabase_default) - Configuration file locations - Critical service paths
media-manager¶
Model: Haiku | Tools: Read, Bash, Glob
Fast operations for media services: - Jellyfin library management - Metube download troubleshooting - Stremthru and zurg configuration
security-reviewer¶
Model: Sonnet | Tools: Read, Grep, Glob (read-only)
Security auditing without modification capability: - Configuration review - Secret detection - SSL/TLS verification - Container security analysis
log-analyzer¶
Model: Haiku | Tools: Read, Grep, Glob, Bash
Fast log analysis and correlation: - Error pattern detection - Cross-service correlation - Incident timeline building
Quick Commands¶
Slash commands for common infrastructure operations.
/infra/quick-status - Fast infrastructure health overview
/infra/service-health - Detailed service diagnostics
/infra/emergency-stop - Safe shutdown procedures
/infra/backup-now - Trigger immediate backup
Using Commands¶
Commands are invoked with the slash prefix:
Some commands accept arguments:
Safety Hooks¶
Hooks intercept tool execution to enforce safety policies.
PreToolUse Hooks¶
dangerous-command-blocker.py
Blocks catastrophic commands before execution:
- rm -rf / and similar patterns
- docker system prune -a
- DROP DATABASE, TRUNCATE TABLE
- Writing to system directories (/etc, /usr)
production-service-guard.py Requires confirmation for critical service operations: - Protected services: supa-db, traefik, prometheus, grafana, alertmanager, loki, authentik, adguard, gitea, cache-redis, session-redis - Protected operations: stop, remove, kill, restart, down
PostToolUse Hook¶
audit-logger.py
Logs all tool executions for audit trail:
- Location: .claude/logs/audit.log
- Includes: timestamp, session ID, tool name, input summary, result status
Configuration Files¶
| File | Purpose |
|---|---|
.claude/settings.local.json |
Hook registration, permissions, MCP servers |
.claude/skills/*/SKILL.md |
Individual skill definitions |
.claude/agents/*.md |
Agent configurations |
.claude/commands/infra/*.md |
Command definitions |
Viewing Audit Logs¶
# View recent audit entries
tail -100 /srv/dockerdata/.claude/logs/audit.log
# Search for specific tool usage
grep "Bash" /srv/dockerdata/.claude/logs/audit.log | tail -20
# View today's activity
grep "$(date +%Y-%m-%d)" /srv/dockerdata/.claude/logs/audit.log
Extending the Configuration¶
Adding a New Skill¶
- Create directory:
.claude/skills/my-skill/ - Create
SKILL.mdwith YAML frontmatter:
Adding a New Agent¶
Create .claude/agents/my-agent.md:
---
name: my-agent
description: What this agent specializes in
tools: Read, Grep, Glob
model: haiku
---
# Agent Name
## Your Responsibilities
[What this agent should focus on]
## Key Knowledge
[Infrastructure-specific context]
Adding a New Command¶
Create .claude/commands/category/my-command.md:
---
description: What this command does
arguments:
- name: arg1
description: Optional argument
required: false
---
# Command Name
[Instructions for Claude to follow when command is invoked]
Related Documentation¶
- Safety Hooks - Detailed hook documentation
- n8n Workflows - Automation integration
- StackWiz MCP - AI-powered stack management
- CodeScribe MCP - Code documentation generator with MCP integration