godoctor gives coding agents and Go engineers safe code edits, build checks, test queries, and mutation tests. You can run it as a Model Context Protocol (MCP) server, call its tools from your shell, or install the bundled @godoctor agent skill.
Download the release build, add the MCP server, and unpack the @godoctor skill:
# Global install (default: ~/.gemini/config)
curl -fsSL https://raw.githubusercontent.com/danicat/godoctor/main/install.sh | bash
# Workspace install (.agents/)
curl -fsSL https://raw.githubusercontent.com/danicat/godoctor/main/install.sh | bash -s -- -wOr build from source with go install:
go install github.com/danicat/godoctor/cmd/godoctor@latest
godoctor installVerify that your Go tools and helper binaries are ready:
godoctor checkgodoctor exposes six tools through both the MCP server and the godoctor call command. All file and folder paths (filename and dir) must be full paths starting from the root directory.
| MCP tool | CLI command | What it does |
|---|---|---|
smart_edit |
godoctor call edit |
Matches code blocks with fuzzy search, formats imports, and runs go vet ./.... If the check fails, it rolls back the edit and suggests close symbol names. |
smart_build |
godoctor call build |
Runs go mod tidy, modernize, gofmt, go build, unit tests with coverage, golangci-lint, and deadcode. |
smart_test |
godoctor call test |
Runs Go tests and benchmarks across four levels (fast, basic, benchmark, and complete) and logs results to .godoctor/testquery.db. |
test_query |
godoctor call tq |
Runs SQL queries against test history and line coverage stored in .godoctor/testquery.db. |
selene |
godoctor call selene |
Runs Selene Abstract Syntax Tree (AST) mutation tests to find weak or missing test checks. |
read_docs |
godoctor call docs |
Reads Go package and symbol docs, bundles return type structs, and fetches remote modules in a temporary folder when needed. |
Pick a test level based on your loop speed:
fast: Runsgo test -vwithout coverage tracking or SQLite indexing. Best for quick edits.basic(default): Runs unit tests, measures statement coverage, and saves test data to.godoctor/testquery.db.benchmark: Runs Go benchmarks (-benchmem -run=NONE) and prints a Markdown table of speed and memory use.complete: Runsbasictests and coverage, then runsselenemutation tests across your packages.
When working in a terminal or a shell agent without MCP, pass JSON arguments to godoctor call:
# List all tools
godoctor list
# Edit a file with go vet rollback protection
godoctor call edit '{"filename": "/path/to/main.go", "old_content": "fmt.Println(\"old\")", "new_content": "fmt.Println(\"new\")"}'
# Build, lint, and test a project
godoctor call build '{"dir": "/path/to/project"}'
# Run fast unit tests
godoctor call test '{"dir": "/path/to/project", "level": "fast"}'
# Read package or symbol docs
godoctor call docs '{"import_path": "net/http", "symbol_name": "Client"}'
# Run AST mutation tests
godoctor call selene '{"dir": "/path/to/project"}'
# Query failed tests with SQL
godoctor call tq '{"dir": "/path/to/project", "query": "SELECT package, test, elapsed FROM all_tests WHERE action = '\''fail'\''"}'By default (with no flags or --all), godoctor install runs four steps:
- Picks the target folder: Uses
$GEMINI_CONFIG_DIRor~/.gemini/configfor global installs, or./.agentswhen you pass-w(--workspace). You can override these paths with--config(-c) and--skills-dir(-s). - Registers the MCP server: Adds a
"godoctor"entry (godoctor mcp) under"mcpServers"inmcp_config.json. Ifmcp_config.jsonhas broken JSON, it saves a backup tomcp_config.json.bakbefore writing a clean file. - Unpacks the
@godoctorskill: Writes the embedded skill and reference guides into<target>/skills/godoctor/. If you edited any skill files on disk, it skips them unless you pass--force(-f):skills/godoctor/SKILL.md: Go style rules, flat package design, and tool workflows.skills/godoctor/references/selene.md: Guide to Selene mutation rules, mutant states (KILLED,SURVIVED,UNCOVERED), and fixing test gaps.skills/godoctor/references/testquery.md: SQLite schema (all_tests,all_coverage,test_coverage,all_code) and SQL recipes for.godoctor/testquery.db.
- Cleans up old files: On global installs, it deletes old
plugins/godoctorandagents/godoctor.mdpaths from earlier releases.
You can also run each step on its own or remove the setup:
godoctor install --mcp # Register MCP server only
godoctor install --skills # Unpack @godoctor skill only
godoctor install -w # Install into current workspace (./.agents/)
godoctor install -f # Overwrite modified skill files on disk
godoctor uninstall # Remove global MCP entry and skill files
godoctor uninstall -w # Remove workspace MCP entry and skill filesgodoctor works out of the box with sensible defaults. To customize timeouts, linter rules, or helper binary paths, create a .godoctor.yaml file in your project root:
# Create a full .godoctor.yaml config
godoctor init
# Create a short .godoctor.yaml config
godoctor init --minimalgodoctor runs helper tools like golangci-lint, modernize, deadcode, selene, and testquery straight from your $PATH. It never falls back to slow go run calls. Use godoctor check to inspect tool versions, or pass --json for script output.
Build the binary and run the test suite from source:
make build
make testApache-2.0