통합 최적화 커맨드 (에이전트, 커맨드, 프롬프트)
Optimizes agents, commands, and prompts for clarity, efficiency, and effectiveness.
/plugin marketplace add m16khb/claude-integration/plugin install automation-tools@claude-integration<target> <file-path> [options]claude-opus-4-5-20251101사용자가 /optimize 명령을 실행했습니다.
입력 인자: $ARGUMENTS
$ARGUMENTS에서 다음을 추출하세요:
agent | command | prompt (첫 번째 인자)--mcp, --interactive, --dry-run 등 (나머지 인자)인자가 부족하면 AskUserQuestion으로 확인하세요.
agentcommandprompt--interactive 옵션: AskUserQuestion으로 프롬프트 입력 받기--mcp: Context7 (resolve-library-id, get-library-docs)로 최신 문서 참조--dry-run: 수정하지 않고 제안 사항만 출력--interactive: AskUserQuestion으로 대화형 진행최적화 전/후 비교 및 개선 사항 요약을 출력하세요.
아래는 최적화 수행 시 참고할 지침입니다.
# 기본 에이전트 최적화
/optimize agent plugins/code-quality/agents/code-reviewer.md
# MCP 통합으로 최신 문서 반영
/optimize agent plugins/nestjs-backend/agents/typeorm-expert.md --mcp
1. Current State Analysis
├─ Role clarity assessment
├─ Trigger effectiveness review
├─ Tool utilization check
└─ MCP integration opportunities
2. Best Practices Application
├─ Prompt structure optimization
├─ Context window efficiency
├─ Response format standardization
└─ Error handling improvements
3. Integration Testing
├─ Simulated task execution
├─ Performance benchmarking
└─ Compatibility validation
# 커맨드 최적화
/optimize command plugins/code-quality/commands/review.md
# 배치 최적화
/optimize command plugins/full-stack-orchestration/commands/*.md
✓ Argument parsing efficiency
✓ Help text clarity
✓ Error message usefulness
✓ Integration patterns
✓ Performance optimization
✓ Security considerations
# 대화형 최적화
/optimize prompt --interactive
# 파일에서 프롬프트 최적화
/optimize prompt my-prompt.txt
# URL 기반 문서를 프롬프트로
/optimize prompt https://docs.example.com/guide
ENHANCEMENT TYPES:
├─ Task Decomposition
│ ├─ Complex task breakdown
│ ├─ Step-by-step clarification
│ └─ Dependency identification
│
├─ Context Optimization
│ ├─ Relevant information extraction
│ ├─ Noise reduction
│ └─ Structure organization
│
├─ Output Formatting
│ ├─ Structured responses
│ ├─ Code block optimization
│ └─ Example integration
│
└─ Resource Integration
├─ Latest documentation
├─ Best practices
└─ Tool recommendations
# .claude/optimize-templates.yml
templates:
agent:
sections:
- overview
- capabilities
- triggers
- examples
max_tokens: 8000
command:
sections:
- description
- usage
- examples
- integration
max_tokens: 4000
# 전체 플러그인 최적화
/optimize agent plugins/nestjs-backend/agents/ --batch
# 특정 패턴의 파일들 최적화
/optimize command "**/*review*.md" --recursive
{
"optimization_report": {
"file": "code-reviewer.md",
"improvements": [
{
"type": "token_efficiency",
"before": 2450,
"after": 1890,
"improvement": "23%"
},
{
"type": "response_quality",
"score_before": 7.2,
"score_after": 8.9,
"improvement": "24%"
}
]
}
}
# .github/workflows/optimize.yml
- name: Optimize Components
run: |
/optimize agent agents/ --batch --dry-run
/optimize command commands/ --batch --dry-run
# Check if optimization suggestions exist
if [ -f .optimizations.md ]; then
echo "Optimization suggestions found"
cat .optimizations.md
fi
# 개발 사이클 통합
1. 에이전트/커맨드 작성
2. /optimize로 개선
3. 테스트 실행
4. PR 생성
CHECKLIST:
□ Clear objective definition
□ Appropriate complexity level
□ Efficient token usage
□ Proper error handling
□ Consistent formatting
□ Adequate examples
□ Integration compatibility
□ Performance benchmarking
Issue: Changes not taking effect
Solution:
1. Check file permissions
2. Verify file paths
3. Clear any caches
4. Restart Claude Code
Issue: Slower responses after optimization
Solution:
1. Profile token usage
2. Check for circular references
3. Simplify complex logic
4. Reduce context window usage
# Common commands
/optimize agent <file> # Optimize agent
/optimize command <file> # Optimize command
/optimize prompt --interactive # Interactive prompt
/optimize prompt <file> # Optimize from file
/optimize prompt <url> # Convert URL to prompt
# Options
--mcp # Enable MCP
--dry-run # Preview only
--batch # Batch mode
--interactive # TUI mode
--template <name> # Use template
--output <file> # Save report