Skip to content
| Marketplace
Sign in
Visual Studio Code>Linters>Codes DoctorNew to Visual Studio Code? Get it now.
Codes Doctor

Codes Doctor

masahiroid

|
4 installs
| (1) | Free
Diagnose the current workspace for God Classes, technical debt, security issues, and dependency structure.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Codes Doctor

Visual Studio Marketplace Downloads Rating OpenSSF Best Practices License

  • English: README.md
  • 日本語: README.ja.md

Codes Doctor analyzes the currently opened workspace folder and generates a structural diagnosis report — God Classes, technical debt, security issues, dependency graphs, and an SBOM — directly inside VS Code. The analysis engine runs in-process; no external server is required.

📘 New here? Read the User Guide — setup, every report tab explained, settings, and troubleshooting. 🤖 AI Integration Guide: AI_INTEGRATION.md — @codedoctor, GitHub Copilot (vscode-lm / no API key required), Claude Code, Antigravity, and Codex.

What you can do in 6.x

  • Inspect findings in the editor. Security findings and God Classes appear in Problems, underlines and hovers. Jump to source lines from the Activity Bar's Findings view, and see Security and Technical Debt scores in the status bar.
  • Focus on changed files. Analyze Git Changes filters editor diagnostics and Findings to uncommitted changes, or the latest commit when the working tree is clean. Optional analysis on save and ignore-comment Quick Fixes support everyday work.
  • Use VS Code's AI models. Select vscode-lm to generate reviews and prompts with available models supplied by GitHub Copilot or another VS Code model provider, without configuring an API key in this extension.
  • Ask questions and preview fixes. Use @codedoctor with /analyze, /security, /refactor or /fix. Inspect proposed code changes in a diff editor and choose Apply Fix to apply them.
  • Analyze larger projects. Declaration files and build artifacts are excluded, nested .gitignore files are respected, and raw AST output is bounded. Reports too large for a WebView open externally.

See the CHANGELOG for changes by version.

Your first analysis

  1. In VS Code 1.90 or newer, install Codes Doctor by masahirocom from Extensions.
  2. Open your project folder and trust the workspace.
  3. Open Codes Doctor in the Activity Bar and choose Display & Report Language if needed.
  4. Run Analyze Current Workspace. Select a folder if the workspace contains several.
  5. Read the HTML report for the overview, then inspect the relevant source through Problems / Findings.

Static analysis does not require an AI subscription or API key. Start with a full analysis, then use Analyze Git Changes during everyday work. Git changes mode still generates a whole-project HTML report and scores.

See it in action

These are real reports generated by running Codes Doctor on its own source code.

Overview & Quality — Technical Debt and Security scores at a glance, plus God Class rankings.

Overview tab

Risk & Security — the security score with each finding, its severity and remediation; traced findings show the input path.

Risk & Security tab

Dependency Graphs — an interactive module dependency map generated from the actual import graph.

Dependency graph tab

SBOM & Vulnerabilities — a full software bill of materials with direct/transitive/dev breakdowns, plus a dependency vulnerability scan (Trivy when installed, otherwise npm audit).

SBOM tab

Main commands

  • Codes Doctor: Analyze Current Workspace
  • Codes Doctor: Analyze Git Changes
  • Codes Doctor: Open Latest Report
  • Codes Doctor: Copy Analysis Summary
  • Codes Doctor: Copy Analysis Summary as JSON
  • Codes Doctor: Preview AI Fix in Diff Editor
  • Codes Doctor: Clear Editor Diagnostics
  • Codes Doctor: Set LLM API Key

Dashboard (Activity Bar)

After installation, a Codes Doctor icon appears in the Activity Bar. From the Dashboard you can:

  • Choose the language mode (auto, or any single supported language)
  • Choose how reports open (external browser / VS Code WebView / VS Code URI open)
  • Run the analysis
  • Choose an LLM provider, set its API key, fetch its live model list, and run an optional AI structural review

How It Works

  1. Run Analyze Current Workspace (from the Dashboard button or the command palette)
  2. If the workspace has multiple folders, pick one
  3. The bundled analysis engine analyzes that folder directly — no server process involved
  4. The generated HTML report opens according to the codeDoctor.reportOpenMode setting

Optional: LLM Structural Review

Codes Doctor can ask an LLM (OpenAI, Anthropic, or a model supplied through VS Code) to review the analysis and write a structural assessment into the report.

Using VS Code AI: select VS Code Built-in AI, fetch and select an available model, then run the review. You need a model provider extension/account; access and authentication follow that provider's requirements.

Using OpenAI / Anthropic:

  1. Pick a provider in the Dashboard's LLM Provider dropdown
  2. Click Set API Key and paste your API key — it's stored in VS Code's secret storage (OS keychain), never in settings.json or anywhere in your workspace
  3. Click Fetch to pull the live list of models your key can access, then pick one
  4. After running an analysis, click Run LLM Review — the result is written back into the generated report

AI coding agent prompt mode

Set Output Mode to AI coding agent prompt and click Generate AI Coding Prompt. Instead of a report for people to read, the LLM writes a task prompt you can paste unchanged into an AI coding agent (Claude Code, Cursor, GitHub Copilot, Codex). It contains the goal, the supporting metrics, up to five prioritized tasks (each with target, evidence, what to inspect first, the change, what not to change, and acceptance checks), items to leave as-is, and the report the agent should give back. The prompt only names files and symbols that appear in the analysis; anything uncertain is phrased as an inspection step. It appears in its own box on the report's LLM tab with a copy button, alongside — not replacing — the review.

The model list is fetched live from the provider's API each time, so you're never stuck with a hardcoded, possibly outdated model name.

Security rule sets (emergency checks)

Codes Doctor can load the rule packs published at masahiroid/security-rules (NICT A2B alert, OWASP Top 10:2025) and mark code that needs a manual check.

  • The Security Rules section of the Codes Doctor panel (Activity Bar) does all of this in one place: sync, tick the packs to check, scan, and click a result to jump to the code. Each rule lists its check steps and management-sheet column.
  • Codes Doctor: Sync Security Rules downloads manifest.json and each pack, checks every file against the SHA-256 in the manifest, and keeps a verified copy in the extension's own storage. If the download fails (offline, closed network), the cached copy is used. The copy is not kept in the workspace, and sourceUrl is a user setting only, so the repository under review cannot choose the rules it is checked with.
  • Opened and saved TypeScript, JavaScript, PHP and JSON files are scanned with the loaded rules. Matches appear in Problems with the rule ID; hovering shows the pack, source documents, check steps and the management-sheet column.
  • Codes Doctor: Scan Workspace with Security Rules scans the whole workspace. Codes Doctor: Export Security Audit Report writes JSON and CSV (UTF-8 with BOM, for Excel) to .codes-doctor/security-audit/, plus a management sheet for submitting an advisory check as CSV (-sheet.csv) and Excel (.xlsx), labelled in the display language.
  • After a sync, changed rules are announced: how many were added, changed and removed, and a warning for each rule whose advisory fix was released (fix_status: released), so those items are checked again. Reviews of changed rules no longer count as evidence. The CLI (codesdoctor audit) runs the same rules from a terminal or CI and also creates and verifies review evidence (evidence.json).
  • Nothing is downloaded until you run a sync, unless you turn on codeDoctor.securityRules.autoSync (startup and every syncIntervalHours). codeDoctor.securityRules.sourceUrl can point at an internal mirror.

Rules that carry a detect block are checked by data-flow analysis instead of a regular expression: only untrusted input that reaches a SQL, command, code-execution or SSRF call is reported, with the path from source to sink. A workspace scan first summarizes every function, so values are followed through calls into other files (relative import / require, and project functions and methods with a unique name). A flow into another file is reported on the call that passes the input, and the path shows the other file's lines. The analysis also recognizes validation in if conditions and guard clauses (is_numeric, anchored preg_match, filter_var, Number.isInteger, allowlists), and knows that SQL escaping only helps inside quotes. Calls into packages and ambiguous names are not followed, so "No flow found" is not proof of safety. Test code is excluded.

Broken object level authorization (BOLA / IDOR)

Rules with detect: { type: object_access } check every request handler that uses a requested ID (any path parameter, or a query or body field named like an ID) to read, change or delete a stored object. Each handler gets one status:

Status Meaning
No ownership check The ID selects the object and none of the evidence below was found. Reported in Problems.
Filtered by an owner field — check where its value comes from The lookup also filters on an owner column (UserId, user_id, owner_id …) whose value is not recognizably the signed-in user, for example one filled in by middleware.
Ownership check found The lookup is scoped to the signed-in user, an if compares something with the signed-in user (not with a literal), or an authorization call (authorize, Gate::allows, can …) is made. The panel shows the line.

The signed-in user is req.user, req.session, $_SESSION, auth(), Auth::, $request->user(), names such as currentUser, and variables assigned from them; cookies are not, because the client sets them. Converting or validating an ID is not evidence. Whether an object may be public cannot be judged from code, so lookups of public data (products, public reviews) are reported too. A rule can add project-specific expressions for the signed-in user (owner_references) and authorization calls (authorization_calls).

Measured on intentionally vulnerable apps pinned to a commit (test code excluded). Every finding is labeled by hand, and CI fails when a true positive disappears or an unlabeled finding appears (benchmark).

Project Check True positives False positives Known misses
OWASP Juice Shop (TypeScript) SQL, command, code execution, SSRF 13 0 1: input passed to a vm sandbox through an object
BOLA 10 15: public data (8), an owner set by middleware the analysis does not see (5), a role check in middleware (1), an unguessable tracking ID (1) —
DVWA (PHP) SQL, command, code execution, SSRF 25 0 2: input stored in the session on another page (second order)
BOLA 18 0 —

7.0 found 34 true positives with 6 false positives and 7 known misses for SQL, command, code execution and SSRF on the same code. NoSQL injection is not covered yet. In this repository (a VS Code extension, not a web API) the scan reports nothing.

A pattern match is a review candidate, never a pass or a fail. Every rule is a manual check, so "no match" does not mean compliant, and the report states compliance: unverified. The hash detects tampering or mix-ups in transit; it is not a signature from the publisher, so protect write access to the rules repository. Source code never leaves your machine.

Settings

Choose Display & Report Language in the Dashboard: English (default) or 日本語. The dashboard, notifications, new HTML reports, and AI reviews use that language. Existing reports retain their original language; reviews added to a historical report match that report. Run a new analysis after switching languages to generate a report in the new language.

  • codeDoctor.displayLanguage (default: en) — en / ja, saved as an application-wide user preference. The selection persists across workspace changes and restarts until you change it again, independently of the programming language being analyzed.

  • codeDoctor.analysisLanguage (default: auto) — auto / typescript / javascript / php / dart / python / go / swift / csharp / java / kotlin / rust / cpp

  • codeDoctor.reportOpenMode (default: external)

    • external: open in your default browser
    • webview: open in a VS Code WebView panel
    • vscode: open via VS Code's own URI handler
  • codeDoctor.llmProvider (default: openai) — openai / anthropic / vscode-lm

  • codeDoctor.llmOutputMode (default: review) — review (structural review report) / agentPrompt (AI coding agent prompt)

  • codeDoctor.llmModel (default: empty) — set from the Dashboard's model dropdown after fetching

  • codeDoctor.llmMaxOutputTokens (default: 16000) — upper limit on AI output tokens (200–1,000,000)

  • codeDoctor.minSecurity / codeDoctor.minTechnicalDebt (default: 0) — warning thresholds from 0 to 100; 0 disables the threshold. Notify when a score falls below it.

  • codeDoctor.outputDirectory (default: empty) — report destination; empty uses extension storage.

  • codeDoctor.analyzeOnSave (default: false) — enable background analysis on save.

Everyday review and AI fixes

After analysis, click a Findings entry to open its source. Hover a finding for its explanation, remediation and traced path. Use the lightbulb menu to insert an ignore comment; saving re-evaluates it. Supported directives are code-doctor-ignore-next-line, code-doctor-ignore and code-doctor-ignore-file.

Once AI is configured, use a code lightbulb action or Preview AI Fix in Diff Editor. Inspect the proposed diff, then choose Apply Fix or Discard. Applying saves the file; re-run analysis and your project's tests to check the change.

In VS Code Chat, use @codedoctor /analyze for a summary, /security for security explanations, /refactor for an improvement plan, or /fix for a fix preview. These features require VS Code with the Chat and model APIs available.

AI reviews send analysis information to the selected model; fix previews also send the target file's content. Check the selected provider's data handling terms.

Supported Languages

Language God Class Technical Debt Security Call Graph
TypeScript / JavaScript ✅ ✅ ✅ ✅
PHP ✅ ✅ ✅ ✅
Python ✅ ✅ ✅ —
Go ✅ ✅ ✅ —
Swift ✅ ✅ ✅ —
C# ✅ ✅ ✅ —
Java ✅ ✅ ✅ —
Kotlin ✅ ✅ ✅ —
Rust ✅ ✅ ✅ —
C++ ✅ ✅ ✅ —
Dart ✅ ✅ — —

TypeScript/JavaScript and PHP use dedicated full parsers; Python, Go, Java, C#, Rust and C++ are parsed with Tree-sitter; Swift, Kotlin and Dart use a lightweight structural scan. Dependency graphs, circular dependency detection, layer analysis, and SBOM/vulnerability scanning run across all supported files regardless of language.

Accuracy by language. TypeScript/JavaScript and PHP are the primary languages: they are parsed by dedicated full parsers and are the most thoroughly tested. Python, Go, Java, C#, Rust and C++ are parsed into a syntax tree with Tree-sitter, so their structure (classes, methods, functions, imports) is reliable, and the security scan ignores comments, plain strings and calls made only with constant arguments. In these languages and in TypeScript/JavaScript and PHP, the engine also follows user input within each function to dangerous calls: findings with a traced path are labelled "Input reaches", and pattern matches without one are lowered to Low and labelled "Needs review". Input passed through other functions is not followed yet, so some findings are still missed or only marked for review. Swift, Kotlin and Dart still use a lightweight structural scan and produce more false positives and missed findings. Findings in test code are listed with a "Test code" label and do not lower the security score. Treat results as leads to review, not verdicts.

C++ analysis covers .cpp, .cc, .cxx, .hpp, and .hh files. Plain .h/.c files (which may be C, not C++) are not analyzed.

Development

The extension lives in the codes-doctor-vscode monorepo next to its analysis engine (packages/engine) and the CLI (packages/cli). Use Node.js 24 or newer:

npm ci --prefix packages/engine
cd packages/vscode
npm ci                # exactly what package-lock.json lists
npm run vendor:csap   # builds packages/engine and copies it into vendor/
npm test              # bilingual UI, reports, review prompts
npm run package       # produces codes-doctor-<version>.vsix

Packaging refuses to run when node_modules does not match package-lock.json. To release-check dependencies, run npm run verify:deps at the repository root.

The engine build produces the Japanese (vendor/csap) and English (vendor/csap-en) engines and the report's browser libraries (vendor/assets); the extension uses them unchanged.

License

Apache License 2.0 — see LICENSE.

Security and report interpretation

Markdown HTML is sanitized before rendering. Reports opened through the extension use bundled browser libraries. Webviews restrict script execution and block network connections.

Security findings are static candidates that require review. Comments, literal code examples and literal RegExp .exec() calls are excluded; executable template expressions remain checked. Type-only imports are excluded from runtime dependency graphs. Repositories containing both generated JavaScript and TypeScript may count both.

See CHANGELOG for version history and docs/architecture.md for how the extension and engine fit together.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft