Agent skill
code-analysis
Provides methodologies, metrics, and best practices for analyzing code structure, complexity, and quality
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/code-analysis
SKILL.md
Overview
This skill provides comprehensive knowledge for code analysis including complexity metrics, anti-pattern detection, refactoring strategies, and code quality assessment across multiple programming languages.
Complexity Metrics
Cyclomatic Complexity
- Low: 1-10 (simple, easy to test)
- Medium: 11-20 (moderate complexity, acceptable)
- High: 21-50 (complex, needs refactoring)
- Very High: 51+ (critical, must refactor)
Cognitive Complexity
Measures how difficult code is to understand based on nesting, control flow breaks, and recursion.
Code Smells to Detect
- Long Methods: >50 lines
- Large Classes: >300 lines
- Duplicate Code: Repeated blocks
- Long Parameter Lists: >5 parameters
- Deep Nesting: >4 levels
- God Objects: Classes doing too much
- Dead Code: Unused functions/variables
Refactoring Strategies
- Extract Method: Break long methods into smaller ones
- Extract Class: Split large classes by responsibility
- Replace Conditional with Polymorphism
- Simplify Conditional Expressions
- Remove Duplicate Code
When to Apply
Use when analyzing codebase structure, identifying refactoring opportunities, or assessing code quality.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?