---
name: analyze
description: Comprehensive code analysis for quality, security, and performance
---

# /analyze - Code Analysis

Comprehensive code analysis across quality, security, performance, and architecture domains.

## When to Use

- Code quality assessment for projects or components
- Security vulnerability scanning
- Performance bottleneck identification
- Architecture review and technical debt assessment

## Usage

```
/skill analyze [target] [--focus quality|security|performance|architecture] [--depth quick|deep]
```

## Workflow

### 1. Discover
- Categorize source files using language detection
- Map project structure and dependencies
- Identify analysis scope

### 2. Scan
- Apply domain-specific analysis techniques
- Pattern matching for common issues
- Static analysis where applicable

### 3. Evaluate
- Generate prioritized findings
- Assign severity ratings
- Assess impact of each issue

### 4. Recommend
- Create actionable recommendations
- Provide implementation guidance
- Prioritize by impact and effort

### 5. Report
- Present comprehensive analysis
- Include metrics and trends
- Provide improvement roadmap

## Focus Areas

### Quality
- Code smells and anti-patterns
- Complexity metrics (cyclomatic, cognitive)
- Duplication detection
- Maintainability assessment

### Security
- OWASP Top 10 vulnerabilities
- Hardcoded secrets detection
- Input validation gaps
- Authentication/authorization issues

### Performance
- Algorithm complexity issues
- N+1 query patterns
- Memory leak indicators
- Resource utilization concerns

### Architecture
- Coupling and cohesion analysis
- Dependency management
- Layer violations
- Technical debt assessment

## Severity Levels

| Level | Description | Action |
|-------|-------------|--------|
| CRITICAL | Security vulnerability, data loss risk | Immediate fix |
| HIGH | Bug, major code smell | Fix before release |
| MEDIUM | Minor issue, performance concern | Fix when possible |
| LOW | Style, suggestion | Consider fixing |

## Output Format

```markdown
# Analysis Report: [Target]

## Summary
- Files analyzed: X
- Total issues: Y
- Critical: N, High: N, Medium: N, Low: N

## Critical Issues
[Details with file:line and fix guidance]

## High Priority Issues
[Details with file:line and fix guidance]

## Recommendations
1. [Prioritized recommendation]
2. [Prioritized recommendation]

## Metrics
- Complexity: [score]
- Maintainability: [score]
- Test coverage: [percentage]
```

## Examples

```
/skill analyze
# Full project analysis across all domains

/skill analyze src/auth --focus security --depth deep
# Deep security analysis of auth module

/skill analyze --focus performance
# Performance bottleneck identification
```

## Boundaries

**Will:**
- Perform comprehensive static analysis
- Generate severity-rated findings
- Provide actionable recommendations

**Will Not:**
- Execute dynamic analysis (runtime testing)
- Modify source code without consent
- Analyze external dependencies deeply
