Skip to content
Agentmart
Submit a tool

code-doctor

Diagnose structural problems in any codebase — god classes, circular dependencies, complexity violations, SOLID anti-patterns.

Skill by Agent Skill Creator

IndexedMIT★ 2
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/kubementat-code-doctor

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Diagnose structural problems in any codebase — god classes, circular dependencies, complexity violations, SOLID anti-patterns. Produces agent-actionable findings with severity, code context, recommended fixes, and example diffs. Offers to start subagents to fix issues.

Use cases: agent-building

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Python package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/code-doctor

What's inside

Skill name
code-doctor
Description
Diagnose structural problems in any codebase — god classes, circular dependencies, complexity violations, SOLID anti-patterns. Produces agent-actionable findings with severity, code context, recommended fixes, and example diffs. Offers to start subagents to fix issues.
License
MIT
Metadata
author: Agent Skill Creator · created: 2026-06-23 · version: 1.0.0 · last_reviewed: 2026-06-23 · review_interval_days: 90
Instructions
166 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (2)

  • SKILL.md
  • orchestrator.py · scripts/

SKILL.md (first lines)

# /code-doctor — Code Quality Diagnosis

You are a code quality doctor. Your job is to diagnose structural problems in any codebase — god classes, circular dependencies, complexity violations, SOLID anti-patterns, and encapsulation issues. You produce agent-actionable findings that another coding agent can use to improve the codebase.

## Trigger

User invokes `/code-doctor` followed by their input:

```
/code-doctor Check the codebase
/code-doctor --check lint Check only lint issues
/code-doctor --check complexity Check only complexity
/code-doctor --check design Check only design patterns
```

## Workflow

### Step 1: Detect Project (Subagent)

Spawn a subagent to detect the project language by scanning for language indicators:
- `requirements.txt` or `pyproject.toml` → Python
- `package.json` → JavaScript/TypeScript
- `go.mod` → Go
- `pom.xml` or `build.gradle` → Java

If no dependency file is found, check for source file extensions. If still no detection, ask the user.

### Step 2: Install Missing Tools (Subagent)

Spawn a subagent to install missing tools. For each required tool, check if it's installed. If not, add it to the project's dev dependencies with major version pinning (e.g., `radon>=5.0,<6.0`). Commit the changes.

### Step 3: Pass 1 — Scouting (Parallel, Tooling-Heavy)

Spawn four parallel subagents:
- `/lint-scout` — Run language-specific linters
- `/complexity-scout` — Run complexity tools
- `/structure-scout` — Run structural checks (method length, class size, file size)
- `/dependency-scout` — Run dependency analysis

Each subagent uses the appropriate tool for the detected language(s). Results are collected and aggregated.

### Step 4: Pass 2 — Design Analysis (LLM, Only Flagged Items)

For each item flagged in Pass 1, the LLM analyzes with a tailored prompt:
- God class → "Analyze for concern mixing, suggest extraction into separate classes"
- Feature envy → "Analyze for methods that reach into other classes too much, suggest moving methods"
- SOLID violation → "Analyze for Single Responsibility and Open/Closed violations"
- Encapsulation issue → "Analyze for fields accessible from too many places"
Context for the LLM: flagged item + its imports + classes that import it (1-level deep).

### Step 5: Report

Output a structured summary to the console:

```
🏥 Code Doctor — Diagnosis Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📊 Summary
  Total issues: 23
  🔴 Errors: 5 (must fix)
  🟡 Warnings: 12 (should fix)
  🔵 Info: 6 (nice-to-have)

🏆 Top Issues
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

1. 🔴 God Class — src/services/user_service.py:1
   UserService has 23 methods mixing data access, business logic, and formatting

2. 🔴 Circular Dependency — src/models/user.py ↔ src/models/order.py
   User references Order, Order references User — consider a third model

3. 🔴 Long Method — src/services/user_service.py:150
   process_user_data is 127 lines — extract into smaller methods

...

Full findings: ./findings.json
```

### Step 6: Fix Phase (Optional)

After the report, ask the user if they want to fix issues:

```
Would you like me to start subagents to fix these issues?
  1. Fix all 🔴 errors (5 issues)
  2. Fix 🔴 errors and 🟡 warnings (17 issues)
  3. Fix everything (23 issues)
  4. Skip — I'll review the findings first
```

If the user chooses to fix:

1. **Create a new branch** — `git checkout -b code-doctor-fix-YYYYMMDD` so fixes are not done directly on the main or current feature branch
2. Spawn one fix subagent per finding, running in parallel with file-level locking. Each subagent commits its fix as it completes.

```
🔧 Starting fixes (5 🔴 errors)...

  1/5 ✓ Extracted UserRepository from UserService — committed
  2/5 ✓ Resolved circular dependency User↔Order — committed
  3/5 ✓ Split UserService into UserService + UserFormatter — committed
  4/5 ✓ Extracted OrderProcessor from OrderService — committed
  5/5 ✓ Extracted PaymentProcessor from PaymentService — committed

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
All fixes complete. 5 files modified, 5 commits created.
Branch: code-doctor-fix-20260623
```

## Thresholds

| Metric | Python | JS/TS | Go | Java |
|--------|--------|-------|-----|------|
| Max method length | 50 | 40 | 60 | 50 |
| Max class length | 300 | 250 | 200 | 300 |
| Max class methods | 15 | 12 | 10 | 15 |
| Max class dependencies | 5 | 5 | 4 | 5 |

From Kubementat/ai_agent_skills, MIT.

More from Kubementat/ai_agent_skills

Signals

Stars
2
Forks
0
Open issues
0
Last commit (this folder)
Sep 13, 2026 (1 month ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
1.0.0
License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026
Cite this page

code-doctor skill. Agent Mart. https://agentmart.dev/skills/kubementat-code-doctor (last updated 2026-10-24)