4.2 KiB
4.2 KiB
Claude Code Platform Architecture
This directory contains the core configuration and extensions that transform Claude Code from a coding assistant into a complete development platform.
📁 Directory Structure
.claude/
├── agents/ # AI agents that assist with various tasks
├── commands/ # Custom commands that extend Claude Code
├── tools/ # Shell scripts for automation and notifications
├── docs/ # Deep-dive documentation
├── settings.json # Claude Code configuration
└── README.md # This file
🏗️ Architecture Overview
AI Agents
The agents/
directory contains the AI agents that assist with various tasks within Claude Code.
- Each
.md
file defines a specific agent and its capabilities. - The agents can be composed together to handle more complex tasks.
- Agents can also share data and context with each other.
Custom Commands
The commands/
directory contains markdown files that define custom workflows:
- Each
.md
file becomes a slash command in Claude Code - Commands can orchestrate complex multi-step processes
- They encode best practices and methodologies
Automation Tools
The tools/
directory contains scripts that integrate with Claude Code:
notify.sh
- Cross-platform desktop notificationsmake-check.sh
- Intelligent quality check runnersubagent-logger.py
- Logs interactions with sub-agents- Triggered by hooks defined in
settings.json
Configuration
settings.json
defines:
- Hooks: Automated actions after specific events
- Permissions: Allowed commands and operations
- MCP Servers: Extended capabilities
🔧 How It Works
Event Flow
- You make a code change in Claude Code
- PostToolUse hook triggers
make-check.sh
- Quality checks run automatically
- Notification hook triggers
notify.sh
- You get desktop notification of results
- If sub-agents were used,
subagent-logger.py
logs their interactions to.data/subagents-logs
Command Execution
- You type
/command-name
in Claude Code - Claude reads the command definition
- Executes the defined process
- Can spawn sub-agents for complex tasks
- Returns results in structured format
Philosophy Integration
/prime
command loads philosophy documents- These guide all subsequent AI interactions
- Ensures consistent coding style and decisions
- Philosophy becomes executable through commands
🚀 Extending the Platform
Adding AI Agents
Options:
- [Preferred]: Create via Claude Code:
- Use the
/agents
command to define the agent's capabilities. - Provide the definition for the agent's behavior and context.
- Let Claude Code perform its own optimization to improve the agent's performance.
- Use the
- [Alternative]: Create manually:
- Define the agent in a new
.md
file withinagents/
. - Include all necessary context and dependencies.
- Must follow the existing agent structure and guidelines.
- Define the agent in a new
Adding New Commands
Create a new file in commands/
:
## Usage
`/your-command <args>`
## Context
- What this command does
- When to use it
## Process
1. Step one
2. Step two
3. Step three
## Output Format
- What the user sees
- How results are structured
Adding Automation
Edit settings.json
:
{
"hooks": {
"YourEvent": [
{
"matcher": "pattern",
"hooks": [
{
"type": "command",
"command": "your-script.sh"
}
]
}
]
}
}
Adding Tools
- Create script in
tools/
- Make it executable:
chmod +x tools/your-tool.sh
- Add to hooks or commands as needed
🎯 Design Principles
- Minimal Intrusion: Stay in
.claude/
to not interfere with user's project - Cross-Platform: Everything works on Mac, Linux, Windows, WSL
- Fail Gracefully: Scripts handle errors without breaking workflow
- User Control: Easy to modify or disable any feature
- Team Friendly: Configurations are shareable via Git