analyze-code

Deep code analysis using consultant agent. Identifies technical debt, risks, and improvement opportunities.

16 stars

Best use case

analyze-code is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Deep code analysis using consultant agent. Identifies technical debt, risks, and improvement opportunities.

Teams using analyze-code should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/analyze-code/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/development/analyze-code/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/analyze-code/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How analyze-code Compares

Feature / Agentanalyze-codeStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Deep code analysis using consultant agent. Identifies technical debt, risks, and improvement opportunities.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

Analyze code: $ARGUMENTS

---

Use the Task tool with `subagent_type='consultant:consultant'`. The agent gathers code files, invokes the consultant CLI with the prompt below, and reports findings.

# Consultant Prompt

You are an expert code analyst. Examine existing code to identify improvement opportunities, technical debt, and potential issues. Provide actionable recommendations prioritized by impact.

## Core Principles (P1-P10)

| # | Principle |
|---|-----------|
| **P1** | **Correctness Above All** - Working code > elegant code |
| **P2** | **Diagnostics & Observability** - Errors must be visible, logged, traceable |
| **P3** | **Make Illegal States Unrepresentable** - Types prevent bugs at compile-time |
| **P4** | **Single Responsibility** - One job per unit |
| **P5** | **Explicit Over Implicit** - Clarity beats cleverness |
| **P6** | **Minimal Surface Area** - YAGNI |
| **P7** | **Prove It With Tests** - Untested = unverified |
| **P8** | **Safe Evolution** - Public API changes need migration paths |
| **P9** | **Fault Containment** - One bad input shouldn't crash the system |
| **P10** | **Comments Tell Why** - Not mechanics |

## Analysis Categories (Priority Order)

1. **Latent Bugs & Logic Risks** (P1) - Boundary conditions, state management, async hazards
2. **Type Safety & Invariant Gaps** (P3) - Illegal states, primitive obsession, unvalidated boundaries
3. **Observability & Diagnostics Gaps** (P2) - Silent failures, broad catches, logging gaps
4. **Resilience & Fault Tolerance** (P9) - Timeouts, retries, resource leaks, transaction gaps
5. **Clarity & Explicitness Issues** (P5) - Naming, magic values, hidden dependencies
6. **Modularity & Cohesion Issues** (P4, P6) - God functions, over-engineering, tight coupling
7. **Test Quality & Coverage Gaps** (P7) - Critical path gaps, boundary tests, flaky tests
8. **Documentation Issues** (P10) - Stale comments, missing "why", TODO graveyard
9. **Evolution & Maintainability Risks** (P8) - API evolution risks, schema rigidity
10. **Security & Performance** - Auth gaps, injection risks, N+1 queries (escalate only if causes data loss/downtime)

## Priority Levels

- **CRITICAL**: Latent bug likely to cause production incident, data corruption risk → Address immediately
- **HIGH**: Bug waiting to happen, missing critical test coverage → Address in current sprint
- **MEDIUM**: Technical debt accumulating, maintainability degrading → Plan for upcoming work
- **LOW**: Minor improvements, performance optimizations → Address opportunistically
- **INFO**: Observations, positive patterns worth noting → No action needed

## Output Format

```markdown
## Executive Summary
[2-3 sentences: overall health assessment and key risk areas]

## Health Scores

| Category | Score | Notes |
|----------|-------|-------|
| Correctness Risk | X/10 | [Brief assessment] |
| Type Safety | X/10 | [Brief assessment] |
| Observability | X/10 | [Brief assessment] |
| Test Coverage | X/10 | [Brief assessment] |
| Maintainability | X/10 | [Brief assessment] |

## Recommendations by Priority

### CRITICAL / HIGH / MEDIUM / LOW
- **[Category]** `file.ts:123`
  - **Issue**: [What's the risk]
  - **Impact**: [Why it matters]
  - **Recommendation**: [Specific improvement]

## Technical Debt Inventory
[Items with effort estimates: S/M/L/XL]

## Quick Wins
[High impact, low effort improvements]

## Strengths
[What's done well - preserve good patterns]
```

Without specific targets, analyze most critical code paths in the current working directory.

Related Skills

analyze-rust-optimizations

16
from diegosouzapw/awesome-omni-skill

This skill performs thorough analysis of Rust libraries to find optimization opportunities. It should be used when reviewing Rust code for performance improvements, memory efficiency, or when profiling indicates bottlenecks. Focuses on runtime performance and memory usage through dynamic profiling tools and static code analysis.

analyze-project-architecture

16
from diegosouzapw/awesome-omni-skill

LLM-based architectural analysis that transforms raw project data into meaningful structure

analyze-pr-performance

16
from diegosouzapw/awesome-omni-skill

Analyze code review pipeline performance for a specific PR. Use when investigating slow PRs, identifying bottlenecks, or debugging performance issues in code reviews.

analyze

16
from diegosouzapw/awesome-omni-skill

Deep analysis and investigation

analyze-m1-module-for-migration

16
from diegosouzapw/awesome-omni-skill

Systematically analyze a Magento 1 module to determine its purpose, usage, and migration requirements for Magento 2. Use when you need to decide whether to migrate a M1 module, find alternatives, or skip it.

analyze-function

16
from diegosouzapw/awesome-omni-skill

Deep line-by-line analysis of a function or method. Explains what each line does, why it's written that way, performance implications, edge cases, and design patterns. Use when user says "analyze-function", "analyze {function}", "deep dive on {function}", or "explain {function} line by line".

analyze-friction

16
from diegosouzapw/awesome-omni-skill

Orchestrate 3-stage friction analysis workflow across conversations. Extracts raw friction, abstracts patterns, and presents for approval. Use when user wants to analyze conversation history for improvement opportunities.

analyze-codebase

16
from diegosouzapw/awesome-omni-skill

Analyze a codebase to generate a comprehensive architecture and structure report. Use when user wants to understand a codebase, explore project structure, or generate analysis.

analyze-code-structure

16
from diegosouzapw/awesome-omni-skill

Examine code organization and identify structural patterns. Use when reviewing module design.

analyze-architecture

16
from diegosouzapw/awesome-omni-skill

Comprehensive brownfield architecture analysis for existing codebases. Discovers structure, identifies patterns, assesses quality, calculates production readiness, and provides actionable recommendations. Use when analyzing existing codebases to understand architecture, assess quality, or prepare for modernization.

acc-analyze-solid-violations

16
from diegosouzapw/awesome-omni-skill

Analyzes PHP codebase for SOLID principle violations. Detects God classes (SRP), type switches (OCP), broken contracts (LSP), fat interfaces (ISP), and concrete dependencies (DIP). Generates actionable reports with severity levels and remediation recommendations.

30-analyze-impact-150

16
from diegosouzapw/awesome-omni-skill

[30] ANALYZE. Understand how changes impact the system — what's the core, what's affected, what depends on what. Use when planning changes, analyzing systems, debugging issues, or anytime you need to see the full picture of cause and effect. Triggers on "what's affected", "impact analysis", "dependencies", "scope mapping", or when you need to understand ripple effects.