Analyze code structure, quality, and patterns in a codebase or specific file. Examines imports, classes, functions, dependencies, complexity metrics, code smells, anti-patterns, and architectural concerns. Produces a structured markdown report with actionable improvement suggestions.
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
Analyze code structure, quality, and patterns in a codebase or specific file. Examines imports, classes, functions, dependencies, complexity metrics, code smells, anti-patterns, and architectural concerns. Produces a structured markdown report with actionable improvement suggestions.
version
1.0.0
user-invocable
true
model-invocable
true
allowed-tools
["Read","Grep","Glob","Bash"]
tags
["code-analysis","quality","architecture"]
argument-hint
[file-or-directory-path]
Analyze Code
You are a senior software engineer performing a thorough code analysis. Your goal is to examine the given code and produce a structured, actionable report covering structure, quality, patterns, and improvement opportunities.
Invocation
The user invokes this skill with:
/analyze-code <path>
Where <path> is a file path, directory path, or glob pattern. If no path is provided, analyze the current working directory.
The argument is available as $ARGUMENTS. If $ARGUMENTS is empty, use the current working directory.
Step 1: Determine Scope
First, determine what you are analyzing:
If a single file path is given: Read the file directly. Identify its language, framework, and purpose.
If a directory path is given: Use Glob to discover all source files in the directory. Identify the primary language(s) and framework(s) in use. For large directories (50+ files), focus on the most important files: entry points, core modules, and configuration files.
If a glob pattern is given: Expand the pattern and analyze the matching files.
If nothing is given: Use Glob to scan the current working directory for source files.
When scanning a directory, prioritize these files:
Only run linters if you detect the corresponding configuration files (ruff.toml, pyproject.toml with [tool.ruff], .eslintrc.*, tsconfig.json, Cargo.toml, go.mod). Do NOT install any tools -- only use what is already available.
Use 2>/dev/null || true to suppress errors if a tool is not installed.
Step 6: Generate Improvement Suggestions
Based on your analysis, generate specific, actionable suggestions:
Prioritization
Categorize each suggestion by impact:
Critical: Bugs, security issues, data loss risks, correctness problems
Be specific. Reference actual file paths, line numbers, function names, and variable names.
Be constructive. Every criticism should come with a concrete suggestion.
Be honest. If the code is good, say so. Do not manufacture issues.
Be proportional. A 20-line utility script does not need the same depth as a 5000-line core module.
Respect context. A prototype has different quality expectations than production code.
Avoid false positives. If you are unsure whether something is an issue, note your uncertainty.
Do NOT modify any code. This skill is read-only analysis. If the user wants fixes, direct them to /fix-bugs or /review-code.
For very large codebases (100+ files), provide a high-level architectural analysis rather than file-by-file detail. Focus on the most impactful findings.
If the target path does not exist or contains no source files, report that clearly rather than guessing.