SUBAGENT_QUICKSTART.md•8.46 kB
# Sub-Agent Quick Start Guide
Fast reference for using EurekaClaude sub-agent tools.
## TL;DR
Four new MCP tools that leverage Claude Code sub-agents for intelligent automation:
```typescript
// 1. Smart commit messages
mcp__eureka-tasks__generate_smart_commit_message({ gitDiff })
// 2. AI PR descriptions
mcp__eureka-tasks__generate_smart_pr_description({ branchTasks, gitDiff })
// 3. Setup validation
mcp__eureka-tasks__validate_setup({ projectPath })
// 4. Smart configuration
mcp__eureka-tasks__generate_smart_setup({ projectPath, projectType })
```
---
## Quick Examples
### 1. Generate Commit Message
```typescript
// Get your changes
const diff = await exec('git diff --staged');
// Generate smart commit message
await mcp__eureka-tasks__generate_smart_commit_message({
gitDiff: diff.stdout
});
// Claude Code launches technical-writer sub-agent
// Returns professional commit message:
// "feat: Add user authentication with JWT\n\nImplement JWT-based auth..."
```
**Time**: 5 seconds | **Quality**: Professional | **Format**: Conventional Commits
---
### 2. Generate PR Description
```typescript
// Get branch tasks
const tasks = await mcp__eureka-tasks__list_branch_tasks();
// Get git summary
const diff = await exec('git diff main..HEAD --stat');
// Generate PR description
await mcp__eureka-tasks__generate_smart_pr_description({
branchTasks: tasks.tasks,
gitDiff: diff.stdout,
baseBranch: 'main'
});
// Returns comprehensive PR description with:
// - Japanese summary (概要)
// - English description
// - Testing checklist
// - Related tasks
```
**Time**: 30 seconds | **Quality**: Comprehensive | **Format**: GitHub markdown
---
### 3. Validate Setup
```typescript
// Check your environment
await mcp__eureka-tasks__validate_setup({
projectPath: process.cwd()
});
// Returns detailed report:
// ✅ Passing checks
// ⚠️ Warnings
// ❌ Critical issues
// 🔧 Fix commands
```
**Time**: 20 seconds | **Coverage**: Complete | **Actionable**: Yes
---
### 4. Generate Setup Config
```typescript
// Analyze project and create config
await mcp__eureka-tasks__generate_smart_setup({
projectPath: '/path/to/new/project',
projectType: 'react' // optional
});
// Returns:
// - claude_desktop_config.json
// - Recommended hooks
// - Task templates
// - Setup instructions
```
**Time**: 1 minute | **Tailored**: Yes | **Ready**: To use
---
## Common Workflows
### Workflow 1: Complete Task with Smart Commit
```typescript
// 1. Complete your work
// ... code implementation ...
// 2. Stage changes
await exec('git add .');
// 3. Generate commit message
const diff = await exec('git diff --staged');
const msg = await mcp__eureka-tasks__generate_smart_commit_message({
gitDiff: diff.stdout,
taskContext: { taskId: 'task-123' }
});
// 4. Complete task
await mcp__eureka-tasks__complete_task_work({
taskId: 'task-123',
summary: '実装完了'
});
// Result: Professional commit with task tracking
```
---
### Workflow 2: Create PR with AI Description
```typescript
// 1. Get all branch tasks
const tasks = await mcp__eureka-tasks__list_branch_tasks();
// 2. Generate smart description
const diff = await exec('git diff main..HEAD --stat');
const desc = await mcp__eureka-tasks__generate_smart_pr_description({
branchTasks: tasks.tasks,
gitDiff: diff.stdout
});
// 3. Create PR (description auto-used)
await mcp__eureka-tasks__create_pull_request({
title: 'Feature: User Authentication'
});
// Result: PR with comprehensive AI-generated description
```
---
### Workflow 3: Validate Before Deployment
```typescript
// 1. Run validation
const report = await mcp__eureka-tasks__validate_setup();
// 2. Check for issues
if (report.criticalIssues.length > 0) {
console.error('Fix issues before deploying');
process.exit(1);
}
// 3. Deploy
await deploy();
// Result: Safe deployment with validated environment
```
---
### Workflow 4: Onboard New Project
```typescript
// 1. Generate configuration
const config = await mcp__eureka-tasks__generate_smart_setup({
projectPath: '/path/to/project',
projectType: 'react'
});
// 2. Apply configuration
await applyConfig(config.claudeConfig);
await installHooks(config.recommendedHooks);
await createTemplates(config.taskTemplates);
// 3. Start working
console.log('Setup complete! Next steps:');
config.setupSteps.forEach(step => console.log(step));
// Result: Fully configured project ready to use
```
---
## When to Use Each Tool
### `generate_smart_commit_message` ✅
- Multi-file changes
- Complex refactoring
- Want professional quality
- Team has commit standards
### `generate_smart_commit_message` ❌
- Single line change
- Typo fixes
- Work in progress commits
- Personal experiments
---
### `generate_smart_pr_description` ✅
- Feature branches
- Multiple tasks completed
- Team collaboration
- Production releases
### `generate_smart_pr_description` ❌
- Draft PRs
- Personal branches
- Trivial changes
- Emergency hotfixes
---
### `validate_setup` ✅
- New team member onboarding
- Troubleshooting issues
- Before important deployment
- Periodic health checks
### `validate_setup` ❌
- Already validated recently
- In the middle of coding
- System is working fine
- Time is critical
---
### `generate_smart_setup` ✅
- New project setup
- New team member joining
- Migrating to EurekaClaude
- Optimizing configuration
### `generate_smart_setup` ❌
- Already configured
- Non-standard project
- Quick experiment
- Temporary project
---
## Sub-Agents Reference
| Sub-Agent | Expertise | Used By |
|-----------|-----------|---------|
| `technical-writer` | Documentation, clear writing | Commit messages, PR descriptions |
| `system-architect` | System design, configuration | Smart setup |
| `devops-architect` | Infrastructure, validation | Setup validation |
---
## Tips
### 💡 Tip 1: Cache Results
```typescript
// Don't regenerate for same content
const cache = new Map();
const key = hashString(gitDiff);
if (cache.has(key)) {
return cache.get(key);
}
const result = await generateCommitMessage(gitDiff);
cache.set(key, result);
```
### 💡 Tip 2: Fallback Pattern
```typescript
// Always have a backup
try {
return await generateSmartCommitMessage(diff);
} catch {
return generateSimpleCommitMessage(diff);
}
```
### 💡 Tip 3: Batch Operations
```typescript
// Process multiple at once
const results = await Promise.all(
tasks.map(t => generateCommitMessage(t.diff))
);
```
### 💡 Tip 4: Add Context
```typescript
// More context = better results
await generateCommitMessage({
gitDiff: diff,
taskContext: {
taskId: 'task-123',
title: 'Add authentication',
priority: 'high',
relatedTasks: ['task-120', 'task-121']
}
});
```
---
## Performance
| Tool | Time | Quality | When to Use |
|------|------|---------|-------------|
| Commit Message | ~5s | ⭐⭐⭐⭐⭐ | Complex changes |
| PR Description | ~30s | ⭐⭐⭐⭐⭐ | Feature branches |
| Validate Setup | ~20s | ⭐⭐⭐⭐⭐ | Onboarding, issues |
| Smart Setup | ~60s | ⭐⭐⭐⭐⭐ | New projects |
---
## Troubleshooting
### Problem: Sub-agent doesn't launch
**Solution**: Check Claude Code version, restart Claude Desktop
### Problem: Results not as expected
**Solution**: Add more context, review input data quality
### Problem: Too slow
**Solution**: Use for complex tasks only, cache results
### Problem: Tool not found
**Solution**: Rebuild MCP server: `npm run build`
---
## Next Steps
1. **Read Full Docs**: [SUBAGENT_INTEGRATION.md](./SUBAGENT_INTEGRATION.md)
2. **See Examples**: [SUBAGENT_EXAMPLES.md](./SUBAGENT_EXAMPLES.md)
3. **Try It**: Start with commit message generation
4. **Integrate**: Add to your workflow gradually
---
## Cheat Sheet
```bash
# Commit Message
generate_smart_commit_message({ gitDiff })
→ technical-writer → Professional commit message
# PR Description
generate_smart_pr_description({ branchTasks, gitDiff })
→ technical-writer → Comprehensive PR description
# Validate
validate_setup({ projectPath })
→ devops-architect → Health report
# Setup
generate_smart_setup({ projectPath, projectType })
→ system-architect → Complete configuration
# Time Saved
Commits: 2-3 min → 5 sec (96% faster)
PRs: 15-20 min → 30 sec (97% faster)
Validation: 15-20 min → 30 sec (97% faster)
Setup: 30-60 min → 5 min (90% faster)
```
---
**Quick Start Complete!** → Try your first sub-agent tool now 🚀