
Code Analyzer
- 135 installs
- 36 repo stars
- Updated July 14, 2026
- oimiragieo/agent-studio
Inspect diffs or modules for smells, complexity, and consistency before merge or release when you need fast, structured feedback beyond manual reading.
About
code-analyzer guides agents to systematically evaluate source for duplication, complexity hotspots, naming drift, and risky patterns. It accelerates pre-ship review by turning large changesets into prioritized findings, helping teams catch regressions and maintain standards before code reaches production.
- Automated smell and complexity scans
- Diff-focused review assistance
- Consistency checks across modules
- Pre-merge quality signal
- Reduces manual review load
Code Analyzer by the numbers
- 135 all-time installs (skills.sh)
- +2 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #392 of 1,352 Code Review & Quality skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/oimiragieo/agent-studio --skill code-analyzerAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 135 |
|---|---|
| repo stars | ★ 36 |
| Last updated | July 14, 2026 |
| Repository | oimiragieo/agent-studio ↗ |
What it does
Inspect diffs or modules for smells, complexity, and consistency before merge or release when you need fast, structured feedback beyond manual reading.
Files
Code Analyzer Skill
Installation
No separate download: the skill runs the in-repo tool .claude/tools/analysis/project-analyzer/analyzer.mjs.
- Ensure Node.js (v18+) is installed: nodejs.org or
winget install OpenJS.NodeJS.LTS(Windows),brew install node(macOS). - From the project root, the script is invoked automatically; no extra install steps.
Cheat Sheet & Best Practices
Metrics: Focus on cyclomatic complexity (decision paths), LOC, maintainability index, and duplicate blocks. Use ESLint complexity rule (e.g. "complexity": ["error", 15]) for JS/TS; optional chaining and default params add branches.
Process: Analyze before refactoring; run project-wide then drill into hotspots. Track trends over time (not one-off). Use max-depth, max-lines, max-nested-callbacks, max-params, max-statements alongside complexity.
Hacks: Start with project-analyzer output; filter by file type and threshold. Prioritize files with high complexity and high churn. Disable complexity rule only if you cannot set a sensible limit; prefer lowering the threshold over disabling.
Certifications & Training
No single cert; aligns with static analysis and ESLint complexity. ESLint: complexity rule, max-depth, max-lines, max-params. Skill data: Cyclomatic complexity, LOC, maintainability, duplicates; analyze before refactor; track hotspots and trends.
Hooks & Workflows
Suggested hooks: Pre-commit or CI: run project-analyzer/doctor for health; optional complexity gate. Use with developer (secondary), qa (secondary), code-reviewer (primary).
Workflows: Use with code-reviewer (primary), developer/ qa (secondary), c4-code (primary). Flow: run analyzer → filter hotspots → refactor or add tests. See code-review-workflow.md.
Overview
Static code analysis and metrics. 90%+ context savings.
Tools (Progressive Disclosure)
Analysis
| Tool | Description |
|---|---|
| analyze-file | Analyze single file |
| analyze-project | Analyze entire project |
| complexity | Calculate complexity metrics |
Metrics
| Tool | Description |
|---|---|
| loc | Lines of code |
| cyclomatic | Cyclomatic complexity |
| maintainability | Maintainability index |
| duplicates | Find duplicate code |
Reporting
| Tool | Description |
|---|---|
| summary | Get analysis summary |
| hotspots | Find complexity hotspots |
| trends | Analyze metric trends |
Agent Integration
- code-reviewer (primary): Code review
- refactoring-specialist (primary): Tech debt analysis
- architect (secondary): Architecture assessment
Iron Laws
1. ALWAYS run project-wide analysis before drilling into individual files — local analysis without context misses which files are actually the highest-priority hotspots; start broad, then focus. 2. ALWAYS focus on high-complexity AND high-churn files — a complex but rarely-changed file is lower priority than a moderately complex but frequently-changed one; intersection matters most. 3. NEVER set complexity thresholds above 20 — cyclomatic complexity >20 is demonstrably correlated with defects; teams that allow >20 accumulate unmaintainable code without noticing. 4. ALWAYS track metrics over time, not just once — a single analysis snapshot is meaningless; track trends weekly to detect gradual degradation before it becomes a crisis. 5. NEVER report metrics without actionable next steps — complexity numbers without refactoring targets provide no value; every high-complexity finding must include a specific suggested improvement.
Anti-Patterns
| Anti-Pattern | Why It Fails | Correct Approach |
|---|---|---|
| Analyzing only changed files | Misses cross-file complexity accumulation | Run project-wide then filter to changed hot spots |
| Ignoring high-complexity files over time | Gradual degradation invisible in point-in-time analysis | Track weekly trends; alert on any increase |
| Complexity threshold >20 | Research shows defect rate spikes sharply above 20 | Set ESLint complexity rule to ≤15 for enforcement |
| Reporting metrics without action items | Metrics without remediation don't reduce complexity | Attach specific refactoring suggestion per hotspot |
| Running analysis once and ignoring results | Technical debt silently accumulates | Schedule automated weekly analysis with trend reports |
Memory Protocol (MANDATORY)
Before starting: Read .claude/context/memory/learnings.md
After completing:
- New pattern ->
.claude/context/memory/learnings.md - Issue found ->
.claude/context/memory/issues.md - Decision made ->
.claude/context/memory/decisions.md
ASSUME INTERRUPTION: If it's not in memory, it didn't happen.
Invoke the code-analyzer skill and follow it exactly as presented to you
#!/usr/bin/env node
/**
* code-analyzer - Post-Execute Hook
* Runs after the skill executes for cleanup, logging, or follow-up actions.
*/
const fs = require('fs');
const path = require('path');
const { safeParseJSON } = require('../../../lib/utils/safe-json.cjs');
// Parse hook input
const result = safeParseJSON(process.argv[2] || '{}');
console.log('📝 [CODE-ANALYZER] Post-execute processing...');
/**
* Process execution result
*/
function processResult(_result) {
// TODO: Add your post-processing logic here
return { success: true };
}
// Run post-processing
const outcome = processResult(result);
if (outcome.success) {
console.log('✅ [CODE-ANALYZER] Post-processing complete');
process.exit(0);
} else {
console.error('⚠️ [CODE-ANALYZER] Post-processing had issues');
process.exit(0);
}
#!/usr/bin/env node
/**
* code-analyzer - Pre-Execute Hook
* Runs before the skill executes to validate input or prepare context.
*/
const fs = require('fs');
const path = require('path');
const { safeParseJSON } = require('../../../lib/utils/safe-json.cjs');
// Parse hook input
const input = safeParseJSON(process.argv[2] || '{}');
console.log('🔍 [CODE-ANALYZER] Pre-execute validation...');
/**
* Validate input before execution
*/
function validateInput(_input) {
const errors = [];
// TODO: Add your validation logic here
return errors;
}
// Run validation
const errors = validateInput(input);
if (errors.length > 0) {
console.error('❌ Validation failed:');
errors.forEach(e => console.error(' - ' + e));
process.exit(1);
}
console.log('✅ [CODE-ANALYZER] Validation passed');
process.exit(0);
code-analyzer Research Requirements
Generated: 2026-02-28
Skill Description
Static code analysis and complexity metrics
Research Areas
- Current best practices for code-analyzer
- Industry standards and tooling
- Integration patterns
Source References
- To be populated by skill-updater research phase
code-analyzer Rules
Purpose
Static code analysis and complexity metrics
Best Practices
- Analyze before refactoring
- Track complexity over time
- Focus on hotspots first
Integration Points
See SKILL.md for complete documentation.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "code-analyzer Input Schema",
"description": "Input validation schema for code-analyzer skill",
"type": "object",
"required": [],
"properties": {},
"additionalProperties": true
}
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "code-analyzer Output Schema",
"description": "Output validation schema for code-analyzer skill",
"type": "object",
"required": ["success"],
"properties": {
"success": {
"type": "boolean",
"description": "Whether the skill executed successfully"
},
"result": {
"type": "object",
"description": "The skill execution result",
"additionalProperties": true
},
"error": {
"type": "string",
"description": "Error message if execution failed"
}
},
"additionalProperties": true
}
#!/usr/bin/env node
/**
* Code Analyzer - Main Script
* Static code analysis and complexity metrics
*
* Usage:
* node main.cjs [options]
*
* Options:
* --help Show this help message
*/
const fs = require('fs');
const path = require('path');
// Find project root
function findProjectRoot() {
let dir = __dirname;
while (dir !== path.parse(dir).root) {
if (fs.existsSync(path.join(dir, '.claude'))) {
return dir;
}
dir = path.dirname(dir);
}
return process.cwd();
}
const PROJECT_ROOT = findProjectRoot();
// Parse command line arguments
const args = process.argv.slice(2);
const options = {};
for (let i = 0; i < args.length; i++) {
if (args[i].startsWith('--')) {
const key = args[i].slice(2);
const value = args[i + 1] && !args[i + 1].startsWith('--') ? args[++i] : true;
options[key] = value;
}
}
/**
* Main execution
*/
function main() {
if (options.help) {
console.log(`
Code Analyzer - Main Script
Usage:
node main.cjs [options]
Options:
--help Show this help message
`);
process.exit(0);
}
const { spawn } = require('child_process');
const analyzerPath = path.join(
PROJECT_ROOT,
'.claude',
'tools',
'analysis',
'project-analyzer',
'analyzer.mjs'
);
if (!fs.existsSync(analyzerPath)) {
console.error('Project analyzer not found:', analyzerPath);
process.exit(1);
}
const child = spawn(process.execPath, [analyzerPath, ...args.filter(a => a !== '--help')], {
stdio: 'inherit',
cwd: PROJECT_ROOT,
windowsHide: true,
});
child.on('close', code => process.exit(code !== null && code !== undefined ? code : 1));
}
main();
code-analyzer Implementation Template
Goal
- Define target outcome and acceptance criteria.
TDD
1. Red 2. Green 3. Refactor
Verification
- lint
- format
- targeted tests