Analysis & Troubleshooting Skill
Multi-domain code analysis with issue diagnosis and resolution capabilities.
Quick Start
# Quality analysis
/sc:analyze [target] --focus quality|security|performance|architecture
# Troubleshooting mode
/sc:analyze [issue] --troubleshoot --focus bug|build|performance|deployment
# With auto-fix
/sc:analyze "TypeScript errors" --troubleshoot --focus build --fix
Behavioral Flow
- Discover - Categorize source files, detect languages
- Scan - Apply domain-specific analysis techniques
- Evaluate - Generate prioritized findings with severity
- Recommend - Create actionable recommendations
- Report - Present comprehensive analysis with metrics
Flags
| Flag |
Type |
Default |
Description |
--focus |
string |
quality |
quality, security, performance, architecture, bug, build, deployment |
--troubleshoot |
bool |
false |
Enable issue diagnosis mode |
--trace |
bool |
false |
Detailed trace analysis for debugging |
--fix |
bool |
false |
Auto-apply safe fixes |
--depth |
string |
standard |
quick, standard, deep |
--format |
string |
text |
text, json, report |
Analysis Domains
Quality Analysis
- Code smells and maintainability issues
- Pattern violations and anti-patterns
- Technical debt assessment
Security Analysis
- Vulnerability scanning
- Compliance validation
- Authentication/authorization review
Performance Analysis
- Bottleneck identification
- Resource utilization patterns
- Optimization opportunities
Architecture Analysis
- Component coupling assessment
- Dependency analysis
- Design pattern evaluation
Troubleshooting Mode
When --troubleshoot is enabled:
| Focus |
Behavior |
| bug |
Error analysis, stack traces, code inspection |
| build |
Build logs, dependencies, config validation |
| performance |
Metrics analysis, bottleneck identification |
| deployment |
Environment analysis, service validation |
Examples
Security Deep Dive
/sc:analyze src/auth --focus security --depth deep
Build Failure Fix
/sc:analyze "compilation errors" --troubleshoot --focus build --fix
Performance Diagnosis
/sc:analyze "slow API response" --troubleshoot --focus performance --trace
MCP Integration
PAL MCP (Always Use)
| Tool |
When to Use |
Purpose |
mcp__pal__thinkdeep |
Complex issues |
Multi-stage investigation with hypothesis testing |
mcp__pal__debug |
Bug troubleshooting |
Systematic root cause analysis |
mcp__pal__codereview |
Quality analysis |
Comprehensive code quality, security, performance review |
mcp__pal__consensus |
Critical findings |
Multi-model validation of security/architecture issues |
mcp__pal__challenge |
Uncertain findings |
Force critical thinking on ambiguous issues |
mcp__pal__apilookup |
Dependency issues |
Get current API docs for version conflicts |
PAL Usage Patterns
# Deep investigation (--depth deep)
mcp__pal__thinkdeep(
step="Investigating performance bottleneck in API layer",
hypothesis="Database queries lack proper indexing",
confidence="medium",
relevant_files=["/src/api/users.py"]
)
# Security analysis (--focus security)
mcp__pal__codereview(
review_type="security",
findings="Authentication, authorization, injection vectors",
issues_found=[{"severity": "high", "description": "SQL injection risk"}]
)
# Critical finding validation
mcp__pal__consensus(
models=[
{"model": "gpt-5.2", "stance": "for"},
{"model": "gemini-3-pro", "stance": "against"}
],
step="Evaluate: Is this a critical security vulnerability?"
)
Rube MCP (When Needed)
| Tool |
When to Use |
Purpose |
mcp__rube__RUBE_SEARCH_TOOLS |
External analysis |
Find security scanners, linters |
mcp__rube__RUBE_MULTI_EXECUTE_TOOL |
Issue tracking |
Create tickets for findings |
mcp__rube__RUBE_REMOTE_WORKBENCH |
Bulk analysis |
Process large codebases |
Rube Usage Patterns
# Find and create Jira tickets for findings
mcp__rube__RUBE_SEARCH_TOOLS(queries=[
{"use_case": "create jira issue", "known_fields": "project:SECURITY"}
])
# Notify team of critical findings
mcp__rube__RUBE_MULTI_EXECUTE_TOOL(tools=[
{"tool_slug": "SLACK_SEND_MESSAGE", "arguments": {"channel": "#security", "text": "Critical finding..."}}
])
Flags (Extended)
| Flag |
Type |
Default |
Description |
--pal-deep |
bool |
false |
Use PAL thinkdeep for multi-stage analysis |
--pal-review |
bool |
false |
Use PAL codereview for comprehensive review |
--consensus |
bool |
false |
Use PAL consensus for critical findings |
--notify |
string |
- |
Notify via Rube (slack, jira, email) |
--create-tickets |
bool |
false |
Create tickets for findings via Rube |
Tool Coordination
- Glob - File discovery and structure analysis
- Grep - Pattern analysis and code search
- Read - Source inspection and config analysis
- Bash - External tool execution
- Write - Report generation
- PAL MCP - Multi-model analysis, debugging, code review
- Rube MCP - External notifications, ticket creation
1---2name: sc-analyze3description: Comprehensive code analysis, quality assessment, and issue diagnosis. Use when analyzing code quality, security vulnerabilities, performance bottlenecks, architecture reviews, or troubleshooting bugs and build failures.4---5
6# Analysis & Troubleshooting Skill
7
8Multi-domain code analysis with issue diagnosis and resolution capabilities.
9
10## Quick Start
11
12```bash
13# Quality analysis
14/sc:analyze [target] --focus quality|security|performance|architecture
15
16# Troubleshooting mode
17/sc:analyze [issue] --troubleshoot --focus bug|build|performance|deployment
18
19# With auto-fix
20/sc:analyze "TypeScript errors" --troubleshoot --focus build --fix
21```
22
23## Behavioral Flow
24
251. **Discover** - Categorize source files, detect languages
262. **Scan** - Apply domain-specific analysis techniques
273. **Evaluate** - Generate prioritized findings with severity
284. **Recommend** - Create actionable recommendations
295. **Report** - Present comprehensive analysis with metrics
30
31## Flags
32
33| Flag | Type | Default | Description |
34|------|------|---------|-------------|
35| `--focus` | string | quality | quality, security, performance, architecture, bug, build, deployment |
36| `--troubleshoot` | bool | false | Enable issue diagnosis mode |
37| `--trace` | bool | false | Detailed trace analysis for debugging |
38| `--fix` | bool | false | Auto-apply safe fixes |
39| `--depth` | string | standard | quick, standard, deep |
40| `--format` | string | text | text, json, report |
41
42## Analysis Domains
43
44### Quality Analysis
45- Code smells and maintainability issues
46- Pattern violations and anti-patterns
47- Technical debt assessment
48
49### Security Analysis
50- Vulnerability scanning
51- Compliance validation
52- Authentication/authorization review
53
54### Performance Analysis
55- Bottleneck identification
56- Resource utilization patterns
57- Optimization opportunities
58
59### Architecture Analysis
60- Component coupling assessment
61- Dependency analysis
62- Design pattern evaluation
63
64## Troubleshooting Mode
65
66When `--troubleshoot` is enabled:
67
68| Focus | Behavior |
69|-------|----------|
70| bug | Error analysis, stack traces, code inspection |
71| build | Build logs, dependencies, config validation |
72| performance | Metrics analysis, bottleneck identification |
73| deployment | Environment analysis, service validation |
74
75## Examples
76
77### Security Deep Dive
78```
79/sc:analyze src/auth --focus security --depth deep
80```
81
82### Build Failure Fix
83```
84/sc:analyze "compilation errors" --troubleshoot --focus build --fix
85```
86
87### Performance Diagnosis
88```
89/sc:analyze "slow API response" --troubleshoot --focus performance --trace
90```
91
92## MCP Integration
93
94### PAL MCP (Always Use)
95
96| Tool | When to Use | Purpose |
97|------|-------------|---------|
98| `mcp__pal__thinkdeep` | Complex issues | Multi-stage investigation with hypothesis testing |
99| `mcp__pal__debug` | Bug troubleshooting | Systematic root cause analysis |
100| `mcp__pal__codereview` | Quality analysis | Comprehensive code quality, security, performance review |
101| `mcp__pal__consensus` | Critical findings | Multi-model validation of security/architecture issues |
102| `mcp__pal__challenge` | Uncertain findings | Force critical thinking on ambiguous issues |
103| `mcp__pal__apilookup` | Dependency issues | Get current API docs for version conflicts |
104
105### PAL Usage Patterns
106
107```bash
108# Deep investigation (--depth deep)
109mcp__pal__thinkdeep(
110 step="Investigating performance bottleneck in API layer",
111 hypothesis="Database queries lack proper indexing",
112 confidence="medium",
113 relevant_files=["/src/api/users.py"]
114)
115
116# Security analysis (--focus security)
117mcp__pal__codereview(
118 review_type="security",
119 findings="Authentication, authorization, injection vectors",
120 issues_found=[{"severity": "high", "description": "SQL injection risk"}]
121)
122
123# Critical finding validation
124mcp__pal__consensus(
125 models=[
126 {"model": "gpt-5.2", "stance": "for"},
127 {"model": "gemini-3-pro", "stance": "against"}
128 ],
129 step="Evaluate: Is this a critical security vulnerability?"
130)
131```
132
133### Rube MCP (When Needed)
134
135| Tool | When to Use | Purpose |
136|------|-------------|---------|
137| `mcp__rube__RUBE_SEARCH_TOOLS` | External analysis | Find security scanners, linters |
138| `mcp__rube__RUBE_MULTI_EXECUTE_TOOL` | Issue tracking | Create tickets for findings |
139| `mcp__rube__RUBE_REMOTE_WORKBENCH` | Bulk analysis | Process large codebases |
140
141### Rube Usage Patterns
142
143```bash
144# Find and create Jira tickets for findings
145mcp__rube__RUBE_SEARCH_TOOLS(queries=[
146 {"use_case": "create jira issue", "known_fields": "project:SECURITY"}
147])
148
149# Notify team of critical findings
150mcp__rube__RUBE_MULTI_EXECUTE_TOOL(tools=[
151 {"tool_slug": "SLACK_SEND_MESSAGE", "arguments": {"channel": "#security", "text": "Critical finding..."}}
152])
153```
154
155## Flags (Extended)
156
157| Flag | Type | Default | Description |
158|------|------|---------|-------------|
159| `--pal-deep` | bool | false | Use PAL thinkdeep for multi-stage analysis |
160| `--pal-review` | bool | false | Use PAL codereview for comprehensive review |
161| `--consensus` | bool | false | Use PAL consensus for critical findings |
162| `--notify` | string | - | Notify via Rube (slack, jira, email) |
163| `--create-tickets` | bool | false | Create tickets for findings via Rube |
164
165## Tool Coordination
166
167- **Glob** - File discovery and structure analysis
168- **Grep** - Pattern analysis and code search
169- **Read** - Source inspection and config analysis
170- **Bash** - External tool execution
171- **Write** - Report generation
172- **PAL MCP** - Multi-model analysis, debugging, code review
173- **Rube MCP** - External notifications, ticket creation