compose-doctor

Write. Score. Repeat. Your agent learns Compose the hard way, fast.

A deterministic 0-100 health score for Android Jetpack Compose - powered by detekt + compose-rules. Gives a coding agent a structured fix loop, and gates your PRs.

Inspired by React Doctor.

01 · INSTALL

Add the Gradle plugin

Apply it to any module with Compose source, then run the task. It applies detekt + the compose-rules ruleset, scores the findings, and writes a machine-readable report.

// build.gradle.kts
plugins {
    id("dev.composedoctor") version "0.1.0"
}

// then:
$ ./gradlew composeDoctor
→ build/reports/compose-doctor/score.json   (score, byRule plan, findings)
→ build/reports/detekt/detekt.sarif         (precise locations, code-scanning)

Live on the Gradle Plugin Portal. Run Gradle on JDK 17-21 (detekt can't analyze under JDK 22+). New to it? The playground walkthrough runs the whole thing against a deliberately-broken app.

02 · AGENT SKILL

Run the /compose-doctor skill

Drop the skill into your agent, then invoke it - it knows how to run the task, read the report, and fix the highest-value rule first. One skill, packaged for every major agent.

# Claude Code - install from the marketplace
/plugin marketplace add rotemmiz/compose-doctor
/plugin install compose-doctor@compose-doctor

# Gemini CLI - install as an extension
gemini extensions install https://github.com/rotemmiz/compose-doctor

# Codex · OpenCode · Antigravity · Cursor - zero install
# they auto-read AGENTS.md at the repo root

# then, in any Compose project:
/compose-doctor

SKILL.md is the single source of truth; each agent gets a thin wrapper around it. Full install matrix in skills/README.md.

03 · AUTONOMOUS AGENT

Let an agent raise the score

The score is deterministic and unique-rule based, so it's a clean reward signal. Point an agent at it and let it close the loop.

# prompt your agent:
"Run compose-doctor and raise the score by fixing the findings,
 one rule at a time. Verify the build still compiles, and don't
 suppress anything - fix the cause."

① Run

./gradlew composeDoctor → read score.json.

② Fix

Take byRule[0] (best score-per-fix), clear every instance.

③ Re-run

Watch delta.fixedRules and the score climb. Repeat.

The full loop, the score.json contract, and the fix-don't-suppress rule are in AGENT-HARNESS.md.

04 · PR GATE

Reliable Pull Request Gates

Integrates natively into GitHub Actions. Generates an automated markdown table to notify authors of remaining compose-rules violations and gate PR merges on a threshold.

🤖 github-actions bot commented 2 minutes ago
❌ PR Gate Failed (85 / 100)

compose-doctor evaluated this PR's Compose health score.

Metric Score Gate Threshold
Compose Health 85 / 100 (+13 delta) 90 / 100
1 outstanding issue:
  • MutableStateParam in FeedScreen.kt:3 - Do not pass raw MutableState parameters.