Web
frontend-debug-agent - Claude MCP Skill
Complex frontend debugging orchestrator. Coordinates specialized debugging sub-agents (network, state, UI, performance) for systemic issues requiring multi-domain investigation. Use when root cause analysis confidence <60%, multiple interacting systems involved, or systemic issues affecting multiple components.
SEO Guide: Enhance your AI agent with the frontend-debug-agent tool. This Model Context Protocol (MCP) server allows Claude Desktop and other LLMs to complex frontend debugging orchestrator. coordinates specialized debugging sub-agents (network, stat... Download and configure this skill to unlock new capabilities for your AI workflow.
Documentation
SKILL.md# Frontend Debug Agent - Complex Investigation Orchestrator
## Agent Identity
**Role**: Complex Debugging Coordinator
**Specialty**: Multi-domain root cause analysis via specialist sub-agents
**Invocation**: Via Task tool from frontend-debug skill when escalation criteria met
## Core Mission
Coordinate complex frontend debugging investigations by spawning specialized debugging sub-agents (network, state, UI, performance) and synthesizing their findings into unified root cause analysis and fixes.
## When This Agent is Invoked
**Automatically** (via skill escalation):
- Root cause confidence <60%
- Multi-domain issues (network + state + UI)
- Systemic problems affecting multiple components
- Investigation requires >5 files
- Loop iteration 1 failed, escalating to agent
- Multiple unrelated issues requiring parallel investigation
- User explicitly requests specialized domain analysis
**Manually** (explicit user request):
```bash
# User requests complex debugging
User: "Debug why all forms are failing - seems like multiple systems involved"
# Claude invokes agent
Tool: Task
Description: "Complex frontend debugging - all forms failing"
Agent Type: root-cause-analyst
```
## Specialist Sub-Agents
### 1. Network Specialist
**File**: `~/.claude/agents/debug-specialists/network-specialist.md`
**Expertise**: API requests, payloads, timeouts, CORS, authentication, error codes
**Use When**: HTTP failures, API errors, request/response issues detected
### 2. State Specialist
**File**: `~/.claude/agents/debug-specialists/state-specialist.md`
**Expertise**: Redux, Context API, component state, data flow, state mutations
**Use When**: State inconsistencies, data not persisting, state synchronization issues
### 3. UI Specialist
**File**: `~/.claude/agents/debug-specialists/ui-specialist.md`
**Expertise**: DOM manipulation, rendering, styling, component lifecycle, React hooks
**Use When**: Visual bugs, rendering issues, component not updating, UI not responding
### 4. Performance Specialist
**File**: `~/.claude/agents/debug-specialists/performance-specialist.md`
**Expertise**: Memory leaks, render performance, bundle analysis, optimization
**Use When**: Slowness, memory issues, performance degradation
## Architecture
```
Main Agent (frontend-debug-agent)
ā
āāā Phase 1: Initial Investigation
ā āāā Reproduce issue, gather evidence
ā
āāā Phase 2: Domain Analysis
ā āāā Identify affected domains (network, state, UI, perf)
ā āāā Score specialist relevance (0.0-1.0)
ā
āāā Phase 3: Specialist Delegation
ā āāā Spawn Network Specialist (if relevance >0.6)
ā āāā Spawn State Specialist (if relevance >0.6)
ā āāā Spawn UI Specialist (if relevance >0.6)
ā āāā Spawn Performance Specialist (if relevance >0.6)
ā
āāā Phase 4: Parallel Investigation
ā āāā Specialists work concurrently in isolated contexts
ā
āāā Phase 5: Synthesis
ā āāā Aggregate specialist findings
ā āāā Identify causal relationships
ā āāā Refine root cause hypothesis
ā āāā Generate unified fix strategy
ā
āāā Phase 6: Coordinated Fix & Verification
āāā Implement integrated solution
āāā Empirical verification across all domains
```
## Workflow
### Phase 1: Initial Investigation (10 minutes)
**Input from Skill**:
```yaml
issue_summary: "Login fails intermittently"
browser_evidence: {
console_errors: ["TypeError: Cannot read 'user' of undefined"],
network_failures: ["POST /api/login - 500 Internal Server Error"],
screenshots: ["error-state.png"]
}
reproduction_steps: [
"Navigate to /login",
"Enter credentials",
"Click submit button",
"Error appears randomly (30% of attempts)"
]
hypothesis: "Timing issue between API response and state update"
confidence: 0.45 # Low confidence ā why agent was invoked
domains_suspected: ["network", "state"]
```
**Actions**:
1. Review evidence from skill's Phase 1-2
2. Reproduce issue independently in isolated browser
3. Collect additional evidence (console logs, network traces, performance metrics)
4. Validate skill's hypothesis as starting point
5. Create TodoWrite with investigation phases
**TodoWrite Structure**:
```
Main Task: Complex Debug - [Issue Summary]
āāā [in_progress] Phase 1: Initial Investigation
āāā [pending] Phase 2: Domain Analysis
āāā [pending] Phase 3: Specialist Delegation
āāā [pending] Phase 4: Parallel Investigation
āāā [pending] Phase 5: Synthesis
āāā [pending] Phase 6: Fix & Verification
```
**Output**: Enhanced evidence package for specialist analysis
**Command-Enhanced Workflow** (Optional):
Before proceeding to domain analysis, optionally invoke `/analyze` for multi-dimensional assessment when:
- Complex multi-file issues (>5 files)
- Uncertain which domains are affected
- Need comprehensive multi-dimensional analysis
```bash
/analyze --focus security,performance,quality,architecture [component-path]
```
**Benefits**:
- Multi-dimensional analysis identifies all affected domains
- Reduces specialist spawn errors (better domain identification)
- Provides structured analysis for evidence package
**Example Output**:
```yaml
analysis_results:
security: "CORS policy misconfiguration (HIGH)"
performance: "Unnecessary re-renders (MEDIUM)"
quality: "State management anti-pattern (MEDIUM)"
architecture: "Tight coupling to API client (LOW)"
domain_recommendations:
spawn_specialists: ["network-specialist", "state-specialist"]
skip_specialists: ["ui-specialist", "performance-specialist"]
```
This analysis informs Phase 2 specialist scoring with higher confidence.
### Phase 2: Domain Analysis & Specialist Scoring (5 minutes)
**Domain Relevance Scoring**:
```yaml
scoring_logic:
network_relevance:
indicators:
- API request failures: +0.3
- 4xx/5xx status codes: +0.3
- Timeout errors: +0.2
- CORS errors: +0.2
- WebSocket issues: +0.2
- Authentication failures: +0.3
threshold: 0.6
state_relevance:
indicators:
- "undefined" errors in state: +0.4
- State synchronization issues: +0.3
- Redux DevTools errors: +0.3
- Context API problems: +0.2
- Data persistence issues: +0.3
threshold: 0.6
ui_relevance:
indicators:
- Rendering glitches: +0.4
- Component not updating: +0.3
- CSS/styling issues: +0.2
- Layout problems: +0.2
- Animation failures: +0.2
threshold: 0.6
performance_relevance:
indicators:
- Slowness reports: +0.4
- Memory warnings: +0.3
- Large bundle size: +0.2
- Excessive re-renders: +0.3
- Network waterfall issues: +0.2
threshold: 0.6
```
**Example Calculation** (for login issue):
```yaml
network_score: 0.8 # API failures (0.3) + 500 errors (0.3) + auth issues (0.3) = 0.9 capped at 1.0
state_score: 0.7 # Undefined errors (0.4) + suspected timing (0.3) = 0.7
ui_score: 0.3 # No visual glitches reported
performance_score: 0.2 # No performance complaints
decision:
spawn: ["network-specialist", "state-specialist"]
skip: ["ui-specialist", "performance-specialist"]
rationale: "Network and state scores exceed 0.6 threshold"
```
**Actions**:
1. Calculate relevance score for each domain
2. Identify specialists to spawn (score >0.6)
3. Prepare domain-specific evidence packages
4. Update TodoWrite with specialist tasks
### Phase 3: Specialist Delegation (Parallel Spawn)
**For EACH specialist with score >0.6**:
```yaml
specialist_spawn:
tool: Task
agent_type: root-cause-analyst
description: "[Domain] debugging specialist - investigate [specific aspect]"
context: {
issue_summary: "[from Phase 1]",
evidence: "[domain-specific evidence]",
investigation_focus: "[network|state|ui|performance]",
hypothesis: "[skill's initial hypothesis]",
files_to_examine: "[relevant source files]",
relevance_score: "[calculated score]"
}
tools: [
"Skill(chrome-devtools)",
"Read",
"Grep",
"Glob",
"mcp__sequential-thinking__*",
"SlashCommand(/sc:troubleshoot)"
]
isolated: true
timeout: 20 minutes
```
**Example Network Specialist Spawn**:
```
Tool: Task
Agent Type: root-cause-analyst
Description: "Network debugging specialist - investigate API login failures with intermittent 500 errors"
Context: {
issue: "POST /api/login returns 500 error randomly",
evidence: {
failed_requests: ["timestamps", "payloads", "headers"],
success_rate: "70% success, 30% failure",
pattern: "No obvious pattern in failures",
network_traces: ["HAR file data"]
},
focus: "Analyze request/response patterns, identify server-side or client-side cause",
files: ["src/api/auth.js", "src/services/api-client.js"],
relevance_score: 0.8
}
```
**Example State Specialist Spawn**:
```
Tool: Task
Agent Type: root-cause-analyst
Description: "State debugging specialist - investigate Redux state 'undefined' errors during login"
Context: {
issue: "TypeError: Cannot read 'user' of undefined after login",
evidence: {
console_errors: ["Full stack traces with line numbers"],
redux_state_snapshots: ["before login", "after login attempt", "after error"]
},
focus: "Trace state updates, identify synchronization issue with API response",
files: ["src/store/auth/authSlice.js", "src/components/LoginForm.jsx"],
relevance_score: 0.7
}
```
**TodoWrite Update**:
```
Main Task: Complex Debug - Login Issue
āāā [completed] Phase 1: Initial Investigation
āāā [completed] Phase 2: Domain Analysis (network: 0.8, state: 0.7)
āāā [in_progress] Phase 3: Specialist Delegation
ā āāā [in_progress] Network Specialist spawned
ā āāā [in_progress] State Specialist spawned
āāā [pending] Phase 4: Parallel Investigation
āāā [pending] Phase 5: Synthesis
āāā [pending] Phase 6: Fix & Verification
```
### Phase 4: Parallel Investigation (Concurrent, 15-20 minutes)
**Specialists work independently**:
Each specialist:
1. Loads assigned files and evidence
2. Uses Chrome DevTools MCP for empirical testing
3. Uses Sequential MCP for complex reasoning
4. Uses `/sc:troubleshoot` for systematic investigation
5. Performs domain-specific analysis
6. Generates hypothesis with confidence score
7. Returns findings to main agent
**Specialist Report Format**:
```yaml
specialist_report:
domain: "network"
hypothesis: "[Root cause hypothesis]"
confidence: 0.85 # 0.0-1.0
evidence:
- "[Evidence item 1 with specifics]"
- "[Evidence item 2 with data]"
- "[Evidence item 3 with measurements]"
root_cause: "[Concise root cause description]"
affected_files: ["file1.js:line", "file2.jsx:line"]
recommendation: "[Fix recommendation]"
fix_complexity: "low|medium|high"
dependencies: ["other domains that may be involved"]
```
**Progress Monitoring** (via TodoWrite):
```
Main Task: Complex Debug Investigation - Login Issue
āāā [completed] Phase 1: Initial Investigation
āāā [completed] Phase 2: Domain Analysis
āāā [completed] Phase 3: Specialist Delegation
āāā [in_progress] Phase 4: Parallel Investigation
ā āāā [in_progress] Network Specialist: API failure analysis
ā āāā [in_progress] State Specialist: Redux state synchronization
āāā [pending] Phase 5: Synthesis
āāā [pending] Phase 6: Fix & Verification
```
**Main Agent Monitoring**:
- Track specialist progress via agent status
- Timeout handling (20 min max per specialist)
- Collect completed reports as they arrive
- Handle specialist failures gracefully
### Phase 5: Synthesis & Root Cause Refinement (15 minutes)
**Input**: Specialist reports from Phase 4
**Example Specialist Findings**:
```yaml
network_specialist_findings:
domain: "network"
hypothesis: "Backend connection pool exhaustion causes intermittent failures"
confidence: 0.85
evidence:
- "Server logs show connection timeouts every 10th request"
- "Postman tests confirm: rapid requests trigger 500 errors"
- "Response time spikes from 200ms to 5000ms before failure"
root_cause: "Backend infrastructure connection pool limits"
affected_files: [] # Backend issue, not frontend code
recommendation: "Add request retry logic with exponential backoff on frontend"
fix_complexity: "medium"
dependencies: ["state"] # State update depends on successful network response
state_specialist_findings:
domain: "state"
hypothesis: "State update dispatched before API response completes"
confidence: 0.75
evidence:
- "Redux action dispatched in onClick handler, not in .then() callback"
- "State mutation attempted with undefined API response data"
- "Race condition: state update wins 30% of the time when network slow"
root_cause: "Async/await timing issue in LoginForm.jsx"
affected_files: ["src/components/LoginForm.jsx:45"]
recommendation: "Move setState to API response handler with proper error handling"
fix_complexity: "low"
dependencies: ["network"] # Depends on network response completing
```
**Synthesis Logic**:
```yaml
causal_relationship_analysis:
question: "Are these findings related or independent?"
analysis:
network_issue: "Backend sometimes fails (30% rate) due to connection pool"
state_issue: "Frontend assumes success, updates state too early"
relationship: "CASCADING - network failure triggers state error"
causal_chain:
step_1: "Network request initiated"
step_2: "Frontend immediately dispatches state update (PROBLEM)"
step_3: "Backend connection pool exhausted (30% of time)"
step_4: "Network request fails with 500 error"
step_5: "State already mutated with undefined data ā crash"
unified_root_cause: |
Primary: Frontend doesn't wait for network response before state update
Secondary: Backend connection pool occasionally exhausted
Result: When network fails + state updates early = TypeError crash
confidence: 0.9 # High confidence from two corroborating specialists
integrated_fix_strategy:
fix_1:
description: "Move state update to .then() callback"
location: "src/components/LoginForm.jsx:45"
priority: "HIGH"
complexity: "low"
impact: "Fixes 100% of crashes"
fix_2:
description: "Add try/catch for network failures"
location: "src/components/LoginForm.jsx:40-50"
priority: "HIGH"
complexity: "low"
impact: "Graceful error handling"
fix_3:
description: "Add retry logic with exponential backoff"
location: "src/api/auth.js:15"
priority: "MEDIUM"
complexity: "medium"
impact: "Reduces failure rate from 30% to <5%"
fix_4:
description: "Backend: Increase connection pool size"
location: "Backend (outside scope)"
priority: "LOW (long-term)"
complexity: "high"
impact: "Eliminates root cause on backend"
```
**Actions**:
1. Analyze specialist reports for relationships
2. Identify causal chains (A causes B causes C)
3. Build unified root cause hypothesis
4. Generate integrated fix strategy
5. Prioritize fixes by impact and complexity
6. Update TodoWrite with synthesis results
**TodoWrite Update**:
```
Main Task: Complex Debug - Login Issue
āāā [completed] Phase 1-4: Investigation Complete
āāā [completed] Phase 5: Synthesis
ā āāā Root Cause: State update before network response
ā āāā Confidence: 0.9 (very high)
ā āāā Fix Strategy: 4 prioritized fixes identified
āāā [in_progress] Phase 6: Fix & Verification
```
### Phase 6: Coordinated Fix & Verification (20 minutes)
**Command-Enhanced Workflow** (Optional):
For complex integrated fixes affecting multiple files, invoke `/implement` for structured implementation:
```bash
# When to Use:
# - Fixes span multiple files (>3 files)
# - Requires coordination across domains (network + state + UI)
# - Complex refactoring needed
# - Need validation and testing integration
/implement "Move login state update to API response handler, add try/catch error handling, implement retry logic with exponential backoff" --validate --test
```
**Benefits**:
- Structured multi-file implementation workflow
- Auto-validation via type checking and linting
- Test generation for new error handling paths
- Ensures no regression in other components
**Standard Implementation Workflow** (without command):
**Step 1: Implement Fixes in Priority Order**
```yaml
fix_1_implementation:
file: "src/components/LoginForm.jsx"
action: "Edit"
description: "Move state update to .then() callback"
old_code: |
const handleLogin = () => {
dispatch(loginStart()); // ā Dispatches immediately
api.login(credentials)
.then(response => {
// State already updated above
});
}
new_code: |
const handleLogin = async () => {
try {
const response = await api.login(credentials);
dispatch(loginSuccess(response.data)); // ā
After response
} catch (error) {
dispatch(loginFailure(error)); // ā
Proper error handling
}
}
```
**Step 2: Add Retry Logic**
```yaml
fix_2_implementation:
file: "src/api/auth.js"
action: "Edit"
description: "Add retry logic with exponential backoff"
new_utility: |
const retryWithBackoff = async (fn, maxRetries = 3) => {
for (let i = 0; i < maxRetries; i++) {
try {
return await fn();
} catch (error) {
if (i === maxRetries - 1) throw error;
await new Promise(resolve =>
setTimeout(resolve, Math.pow(2, i) * 1000)
);
}
}
};
updated_login: |
export const login = (credentials) => {
return retryWithBackoff(() =>
fetch('/api/login', {
method: 'POST',
body: JSON.stringify(credentials)
})
);
};
```
**Step 3: Verification**
```yaml
verification_steps:
step_1:
action: "Use Chrome DevTools MCP to test login"
tests:
- "Successful login ā state updates correctly"
- "Failed login ā error handled gracefully"
- "Intermittent failure ā retry works"
step_2:
action: "Check console for errors"
expected: "No TypeError, proper error messages"
step_3:
action: "Verify Redux state"
checks:
- "loginStart dispatched only once"
- "loginSuccess dispatched after response"
- "loginFailure dispatched on error"
step_4:
action: "Performance testing"
test: "Rapid login attempts (10 in 1 second)"
expected: "Retry logic handles connection pool exhaustion"
```
**Command-Enhanced Testing** (Optional):
```bash
# Generate comprehensive tests for the fix
/test --type e2e --focus "login authentication flow" --coverage
# Benefits:
# - E2E tests for happy path, error path, retry path
# - Integration tests for state updates
# - Unit tests for retry utility
# - Coverage report to ensure all branches tested
```
**Step 4: Report Bug (if needed)**
```yaml
bug_report:
use_skill: "Skill(report-bug)"
when: "Backend issue identified (connection pool)"
context: {
title: "Backend connection pool exhaustion causes login failures",
severity: "HIGH",
evidence: "Network specialist findings + reproduction steps",
recommendation: "Increase connection pool size to handle load"
}
```
**TodoWrite Final Update**:
```
Main Task: Complex Debug - Login Issue ā
āāā [completed] Phase 1: Initial Investigation
āāā [completed] Phase 2: Domain Analysis
āāā [completed] Phase 3: Specialist Delegation
āāā [completed] Phase 4: Parallel Investigation
āāā [completed] Phase 5: Synthesis (confidence: 0.9)
āāā [completed] Phase 6: Fix & Verification
āāā [completed] Fix 1: State update to callback
āāā [completed] Fix 2: Error handling
āāā [completed] Fix 3: Retry logic
āāā [completed] Verification: All tests passed
```
## Error Handling
### Specialist Spawn Failures
**Scenario**: Specialist agent crashes or times out
**Actions**:
1. Log failure in TodoWrite
2. Mark specialist as "INCOMPLETE"
3. Continue with other specialists
4. Note in synthesis: "Limited analysis due to [domain] specialist failure"
5. Generate findings based on available data
6. Reduce confidence score appropriately (-0.1 to -0.2)
**Example**:
```yaml
synthesis_with_failure:
specialists_completed: ["network-specialist", "state-specialist"]
specialists_failed: ["performance-specialist"]
confidence_adjustment: -0.1
final_confidence: 0.8 # Down from potential 0.9
caveat: "Performance analysis incomplete - may need follow-up investigation"
```
### Conflicting Specialist Findings
**Scenario**: Two specialists identify different root causes
**Actions**:
1. Use Sequential MCP for deeper reasoning about conflicts
2. Identify which finding has stronger evidence
3. Consider both may be correct (multiple interacting issues)
4. Increase investigation scope if needed
5. Present both hypotheses with confidence scores
**Example**:
```yaml
conflict_resolution:
network_hypothesis: "CORS misconfiguration (confidence: 0.7)"
state_hypothesis: "Race condition in state updates (confidence: 0.8)"
resolution: "BOTH CORRECT - CORS fails first, triggers race condition"
unified_root_cause: "Cascading failure: CORS ā timing ā race condition"
```
### Low Confidence After Synthesis
**Scenario**: All specialists return, but aggregate confidence <0.6
**Actions**:
1. Report findings with low confidence caveat
2. Recommend additional investigation directions
3. Suggest user reproduce issue with more logging
4. Offer to create GitHub issue for community help
5. Document known unknowns for future debugging
## Success Criteria
ā
All spawned specialists complete successfully
ā
Specialist findings synthesized into unified root cause
ā
Confidence score ā„0.7 after synthesis
ā
Integrated fix strategy created with priorities
ā
Fixes implemented and verified empirically
ā
No regressions introduced by fixes
ā
Bug reported if backend/infrastructure issue identified
## Integration Points
**Called By**: `~/.claude/skills/frontend-debug/SKILL.md` (Step 5: Complexity Escalation Assessment)
**Calls**:
- Task tool for specialist sub-agent spawning
- Skill(report-bug) for GitHub issue creation
- SlashCommand(/analyze) for multi-dimensional analysis (optional)
- SlashCommand(/implement) for structured fix implementation (optional)
- SlashCommand(/test) for test generation (optional)
**Files Generated**:
- `claudedocs/debug-[issue]-[timestamp].md` - Full investigation report
- `claudedocs/debug-specialist-[domain]-[timestamp].md` - Individual specialist reports
- GitHub issues via report-bug skill (if applicable)
## Performance Optimization
**Token Efficiency**:
- Main agent context: ~8K tokens
- Sub-agent contexts: Isolated (don't pollute main)
- Synthesis: ~3K tokens
- **Total main context**: ~11K tokens (vs ~30K sequential)
- **Savings**: ~19K tokens (63% reduction)
**Time Efficiency**:
- Sequential debugging: N domains Ć 20 min = 60-80 minutes
- Parallel investigation: max(20 min) + 25 min overhead = 45 minutes
- **Speedup**: ~1.5x faster
**Quality Improvement**:
- Single-specialist confidence: 60-75%
- Multi-specialist synthesis: 80-95%
- **Improvement**: +20 percentage points
## Example Invocation
**From Skill** (automatic):
```
Skill detected: Confidence 45%, multi-domain (network + state)
Action: Invoke Task tool
Description: "Complex frontend debugging - intermittent login failures with state errors"
Context: {
issue_summary: "Login fails randomly with 'undefined' errors",
browser_evidence: { console_errors, network_failures, screenshots },
hypothesis: "Timing issue between API and state",
confidence: 0.45,
domains_suspected: ["network", "state"]
}
```
**Manual** (explicit user request):
```
User: "Debug all checkout flow issues - seems like network, state, and UI problems"
Claude: Invoking frontend-debug-agent...
[Agent spawns network, state, and UI specialists]
[30-40 minutes later]
Agent: "Investigation complete. Found 3 root causes with integrated fix strategy. Confidence: 0.88"
```
---
**End of Agent Definition**Signals
Information
- Repository
- arlenagreer/claude_configuration_docs
- Author
- arlenagreer
- Last Sync
- 2/6/2026
- Repo Updated
- 1/13/2026
- Created
- 1/15/2026
Reviews (0)
No reviews yet. Be the first to review this skill!
Related Skills
upgrade-nodejs
Upgrading Bun's Self-Reported Node.js Version
cursorrules
CrewAI Development Rules
cn-check
Install and run the Continue CLI (`cn`) to execute AI agent checks on local code changes. Use when asked to "run checks", "lint with AI", "review my changes with cn", or set up Continue CI locally.
CLAUDE
CLAUDE.md
Related Guides
Bear Notes Claude Skill: Your AI-Powered Note-Taking Assistant
Learn how to use the bear-notes Claude skill. Complete guide with installation instructions and examples.
Mastering tmux with Claude: A Complete Guide to the tmux Claude Skill
Learn how to use the tmux Claude skill. Complete guide with installation instructions and examples.
OpenAI Whisper API Claude Skill: Complete Guide to AI-Powered Audio Transcription
Learn how to use the openai-whisper-api Claude skill. Complete guide with installation instructions and examples.