code-doctor
Skill2 starsChanged 8 months agoMITView on GitHub
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.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- julweber/ai_agent_skillsword for word, first seen Mar 20, 2026
Other versions1 project uses a version of this.
Word for word · 1
- julweber/ai_agent_skills★ 2100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository51 other files it gives its agents.
- AGENTS.mdAGENTS.md
- ai-agent-skills-assistantSkill
- ansibleSkill
- artificial-analysisSkill
- cavemanSkill
- claude-cliSkill
- code-summarizerSkill
- codex-cliSkill
- concourse-ciSkill
- dev-brainstormingSkill
- docker-cliSkill
- file-organizerSkill
- frontend-web-developerSkill
- github-actions-cicdSkill
- github-cliSkill
- gitlab-ci-cdSkill
- grill-meSkill
- gtd-assistantSkill
- herdr-cliSkill
- hf-cliSkill
- karpathy-guidelinesSkill
- kestraSkill
- list-large-filesSkill
- list-most-intensive-processesSkill
- llama-cppSkill
- llm-wikiSkill
- mermaidSkill
- morning-ritualSkill
- obsidian-masterSkill
- obsidian-open-loops-collectorSkill
- opencode-agent-creatorSkill
- opencode-cliSkill
- pi-cliSkill
- pi-subagents-masterSkill
- planka-development-flowSkill
- plnk-cliSkill
- ponytailSkill
- product-prd-brainstormingSkill
- python-api-developerSkill
- ralph-prd-converterSkill
- ralph-prd-generatorSkill
- release-managementSkill
- rest-testsuite-skillSkill
- skill-loaderSkill
- design-taste-frontendSkill
- terraformSkill
- tmux-coderSkill
- tmux-specialistSkill
- trello-cliSkill
- tts-conversationSkill
- uvSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 41
If no dependency file is found, check for source file extensions.
- Distinctive: line 99
After the report, ask the user if they want to fix issues:
- Distinctive: line 109
If the user chooses to fix:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
/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 patternsWorkflow
Step 1: Detect Project (Subagent)
Spawn a subagent to detect the project language by scanning for language indicators:
requirements.txtorpyproject.toml→ Pythonpackage.json→ JavaScript/TypeScriptgo.mod→ Gopom.xmlorbuild.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.jsonStep 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 firstIf the user chooses to fix:
- Create a new branch —
git checkout -b code-doctor-fix-YYYYMMDDso fixes are not done directly on the main or current feature branch - 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-20260623Thresholds
| 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 |
| Max inheritance depth | 3 | 2 | 2 | 3 |
Output Format
Console Output
Markdown summary with severity indicators and top issues.
File Output
findings.json — machine-readable, agent-actionable:
{
"finding_id": "god-class-001",
"severity": "ERROR",
"type": "god-class",
"file": "src/services/user_service.py",
"line": 1,
"class_name": "UserService",
"code_context": "class UserService:\n def __init__(...):\n ...",
"violation_reason": "UserService has 23 methods mixing data access, business logic, and formatting concerns",
"recommended_fix": "Extract into: (1) UserRepository (data access), (2) UserService (business logic), (3) UserFormatter (formatting)",
"example_diff": "--- a/src/services/user_service.py\n+++ b/src/services/user_service.py\n@@ -1,50 +1,30 @@\nclass UserRepository:\n ...",
"metrics": {
"method_count": 23,
"line_count": 450,
"dependency_count": 12
}
}Findings Priority Order
- Circular dependencies — structural blockers
- God classes — biggest structural issues
- Long methods — easier to refactor
- Other structural issues — feature envy, deep inheritance, etc.
- Lint issues — cosmetic
Severity Levels
- ERROR — Must fix (structural violations, circular dependencies, god classes)
- WARNING — Should fix (potential issues, complexity violations)
- INFO — Nice-to-have (minor issues, lint warnings)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

