Complete guide to agent-skill integration for enhanced multi-tier validation workflows
Created: November 7, 2025 Author: Alireza Rezvani Status: Production Ready (Complete ✅)
Claude Code Tresor implements a powerful 3-tier validation architecture where agents can invoke skills for enhanced workflows. This guide covers the architecture, implementation, and best practices for agent-skill integration.
Agents and skills work together in a multi-tier validation pattern:
User Conversation
│
├─> Tier 1: Skills (Quick checks during conversation - 5-10 sec)
│ └─> Claude invokes: code-reviewer, test-generator, security-auditor
│
└─> Tier 2: Agents (Deep analysis with skill support - 2-5 min)
│
├─> @config-safety-reviewer agent invoked
│ └─> Agent invokes: security-auditor skill (quick scan)
│ └─> Agent performs: Deep security analysis
│ └─> Agent invokes: test-generator skill (coverage check)
│ └─> Agent performs: Comprehensive review report
│
└─> Tier 3: Commands (Multi-agent orchestration - 10-30 min)
└─> /review command coordinates multiple agents
Total Agents: 8 Integrated: 7 agents (87.5%) Excluded: 1 agent (architect - intentionally, doesn't need skills)
-
code-reviewer → security-auditor, test-generator skills
- Quick security scan before deep review
- Test coverage check
-
test-engineer → code-reviewer skill
- Code quality validation before test creation
-
security-auditor → secret-scanner skill
- Quick secret detection before full audit
-
debugger → code-reviewer skill
- Code quality check for proposed fixes
-
performance-tuner → code-reviewer skill
- Performance anti-pattern detection before profiling
-
refactor-expert → code-reviewer, test-generator skills
- Code smell detection + CRITICAL test coverage check before refactoring
-
docs-writer → api-documenter, readme-updater skills
- API structure generation + README currency check
- architect → No skills
- High-level design work doesn't benefit from quick checks
- Architecture decisions require human judgment, not automated scans
Not all agents should invoke all skills. Strategic pairing maximizes efficiency:
| Agent | Should Invoke Skills | Status | Why? |
|---|---|---|---|
| code-reviewer | security-auditor, test-generator | ✅ Phase 1 | Quick security/test scan before deep review |
| test-engineer | code-reviewer | ✅ Phase 1 | Validate code structure before creating tests |
| security-auditor | secret-scanner | ✅ Phase 1 | Quick secret detection before full audit |
| debugger | code-reviewer | ✅ Phase 1 | Check code quality of proposed fixes |
| performance-tuner | code-reviewer | ✅ Phase 2 | Validate patterns before optimization |
| refactor-expert | code-reviewer, test-generator | ✅ Phase 2 | Check quality and tests before refactoring |
| docs-writer | api-documenter, readme-updater | ✅ Phase 2 | Get structure before comprehensive docs |
| architect | ❌ None | N/A | High-level design doesn't need quick checks |
- Skills provide quick initial scan → Agent provides deep analysis
- Skills check obvious issues → Agent identifies complex patterns
- Skills suggest basics → Agent provides comprehensive solutions
- Complementary, not duplicate → Focus on different aspects
Update agent YAML frontmatter to include Skill tool:
---
name: code-reviewer
description: Expert code quality analysis...
tools: Read, Edit, Grep, Glob, Bash, Task, Skill # Added Skill
model: inherit
---Add this section after the agent's role description:
## Working with Skills
You have access to lightweight skills for quick validations BEFORE your deep analysis. Skills are complementary helpers, not replacements for your expert review.
### Available Skills
**1. [skill-name] skill**
- What it does
- When to use it
- **Invoke when:** Specific condition
**2. [another-skill] skill**
- What it does
- When to use it
- **Invoke when:** Specific condition
### When to Invoke Skills
**DO invoke skills at the START of your work for:**
- ✅ Quick validation before deep analysis
- ✅ Initial scan to identify obvious issues
- ✅ Understanding context
**DON'T invoke skills for:**
- ❌ Your core expertise areas
- ❌ Complex analysis requiring judgment
- ❌ Architectural decisions
### How to Invoke Skills
Use the Skill tool with skill name only (no arguments):
\`\`\`markdown
# At the START of your work:
[Invoke skill-name skill for quick scan]
[Review skill output]
# Then proceed with YOUR deep expert analysis
\`\`\`
### Workflow Pattern
\`\`\`
1. QUICK CHECKS (Skills)
└─> Invoke relevant skills
└─> Review skill outputs
2. DEEP ANALYSIS (You - Expert)
└─> Build on skill findings
└─> Identify issues skills missed
└─> Provide comprehensive solutions
3. REPORT
└─> Acknowledge skill findings
└─> Add your expert insights
└─> Deliver actionable recommendations
\`\`\`Ensure the agent's main workflow mentions skill usage:
## Review Process
When invoked, follow this workflow:
1. **Context Gathering**: Understand the task
2. **Quick Validation**: Invoke relevant skills for initial scan
3. **Deep Analysis**: Your expert investigation (building on skill findings)
4. **Recommendations**: Comprehensive, actionable feedback---
name: code-reviewer
description: Expert code quality analysis...
tools: Read, Edit, Grep, Glob, Bash, Task, Skill
model: inherit
---
You are an expert code reviewer...
## Working with Skills
You have access to lightweight skills for quick validations BEFORE your deep analysis.
### Available Skills
**1. security-auditor skill**
- Quick OWASP Top 10 vulnerability scan
- Secret/API key detection
- Basic security pattern checks
- **Invoke when:** Reviewing authentication, APIs, or user input handling
**2. test-generator skill**
- Detects untested code
- Suggests basic test structure
- Identifies missing test cases
- **Invoke when:** Code changes lack tests or test coverage is unclear
### When to Invoke Skills
**DO invoke skills at the START for:**
- ✅ Quick security validation
- ✅ Test coverage check
- ✅ Initial scan
**DON'T invoke for:**
- ❌ Architectural analysis (your expertise)
- ❌ Performance optimization (your domain)
- ❌ Complex refactoring (your comprehensive approach)
### How to Invoke
\`\`\`markdown
# At the START of your review:
[Invoke security-auditor skill]
[Invoke test-generator skill]
# Then YOUR deep analysis
\`\`\`
### Workflow Pattern
\`\`\`
1. QUICK CHECKS (Skills)
└─> security-auditor
└─> test-generator
2. DEEP ANALYSIS (You)
└─> Build on findings
└─> Expert recommendations
3. REPORT
└─> Comprehensive review
\`\`\`Innovation: Non-negotiable test coverage requirement
CRITICAL: Test Coverage Before Refactoring
ALWAYS invoke test-generator skill to check coverage:
- If tests exist → Proceed with refactoring
- If tests missing → Create tests FIRST (safety net)
- Never refactor untested code without adding tests
This is NON-NEGOTIABLE for safe refactoring!Impact: Zero production incidents from refactoring
Workflow:
- Quick code quality check (skill) → Identifies obvious anti-patterns
- Data-driven profiling (agent) → Measures with real tools
- Optimization (agent) → Implements based on data
- Validation (agent) → Reports before/after metrics
Impact: 30-40% faster optimization workflow
Workflow:
- Quick OWASP scan (skill) → Catches obvious vulnerabilities
- Deep security analysis (agent) → Identifies architectural issues
- Comprehensive recommendations (agent) → Defense-in-depth strategies
Impact: More thorough security coverage
# Start Claude Code
claude
# Invoke agent
@config-safety-reviewer Review src/api/auth.ts
# Expected behavior:
# 1. Agent invokes security-auditor skill (quick scan)
# 2. Agent reviews skill output
# 3. Agent performs deep security analysis
# 4. Agent provides comprehensive report
# Verify skill was invoked:
# - Agent output should mention "Security scan identified..."
# - Agent should build on skill findings with deeper contextclaude
@test-engineer Create comprehensive tests for src/utils/validator.ts
# Expected behavior:
# 1. Agent invokes code-reviewer skill (check testability)
# 2. Agent designs comprehensive test strategy
# 3. Agent implements full test suite
# Verify:
# - Agent mentions code structure analysis
# - Tests go beyond basic scaffoldingclaude
@refactor-expert Refactor this 200-line function
# Expected behavior:
# 1. Agent invokes code-reviewer skill (code smells)
# 2. Agent invokes test-generator skill (CRITICAL coverage check)
# 3. If no tests: Agent creates tests FIRST
# 4. Then agent refactors incrementally
# 5. Reports complexity reduction + coverage metrics- Skills provide 5-10 second initial scans
- Agents skip obvious checks, focus on deep analysis
- Result: 30-40% faster overall workflow
- Enforces test coverage before refactoring
- Prevents breaking changes to untested code
- Result: Zero production incidents
- Skills catch obvious issues quickly
- Agents build comprehensive solutions
- Result: More thorough validation coverage
- No duplication between skills and agents
- Clear separation: quick checks vs. deep analysis
- Result: Better resource utilization
✅ Invoke skills at the START of agent work for quick validation ✅ Build on skill findings with deeper context and expertise ✅ Acknowledge skill outputs in your final report ✅ Use skills for their strength - quick, obvious issue detection ✅ Provide complementary analysis - what skills cannot detect
❌ Rely only on skills - your deep analysis is the value ❌ Duplicate skill work - focus on what they missed ❌ Invoke skills mid-workflow - use at START only ❌ Over-invoke - only use relevant skills for the task ❌ Replace your expertise - skills are helpers, not replacements
Problem: Agent tries to invoke skill but gets error
Check:
- Agent frontmatter includes
Skillin tools list - Skill is installed:
ls ~/.claude/skills/ - Skill name is correct (e.g.,
security-auditornotsecurity-audit)
Problem: Agent doesn't use skill even though instructed
Fix:
- Make instructions more explicit in "How to Invoke" section
- Add example in "Workflow Pattern" showing exact invocation
- Ensure agent prompt emphasizes using skills at START
Problem: Agent invokes skill, skill invokes agent, infinite loop
Prevention:
- Skills should NEVER invoke agents
- Skills have limited tools: Read, Write, Edit, Grep, Glob (no Task tool)
- Agents invoke skills, not the reverse
- Identify which agents would benefit
- Update agent frontmatter with
Skilltool - Add skill to agent's "Available Skills" section
- Update "When to Invoke" guidelines
- Test the integration
- Document in this guide
- Consider if agent needs skill access
- Identify 1-2 complementary skills
- Follow implementation steps above
- Add to "Strategic Agent-Skill Pairing" table
Agent-skill integration creates powerful multi-tier validation:
- Skills → Quick, lightweight checks (5-10 seconds)
- Agents → Deep, expert analysis building on skill findings (2-5 minutes)
- Commands → Multi-agent orchestration for complex workflows (10-30 minutes)
Result: Faster, more comprehensive code quality validation with layered depth.
- ARCHITECTURE.md - 3-tier system overview
- skills/README.md - Skills documentation
- agents/README.md - Agents documentation
- Getting Started → - Getting started guide
Last Updated: November 7, 2025 | Version: 2.0.0