codefmt

Reformat Java, Kotlin, and XML source files using the project's configured code style.

Updated May 4, 2026
One-click install
npx skills add https://github.com/studenkov/FinanceTracker --skill codefmt-studenkov
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: codefmt
Source: https://github.com/studenkov/FinanceTracker/tree/main/.agents/skills/codefmt
Command: npx skills add https://github.com/studenkov/FinanceTracker --skill codefmt-studenkov

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? After editing code, files often drift from the project's configured code style, causing noisy diffs and inconsistent formatting. This Skill reformats source files using the project's own style settings, either through the running IntelliJ IDE or through the project's configured external formatter when the IDE is unreachable. ## Core Features & Use Cases - IDE-driven formatting: Routes formatting through IntelliJ's ReformatCodeProcessor via the Steroid MCP tools, keeping the IDE's VFS/PSI caches consistent and matching exactly what developers see in the editor. - CLI fallback: When the IDE is unreachable, detects and runs the project's own formatter (Spotless via Gradle/Maven, or a google-java-format / palantir-java-format JAR) so output still follows the committed style configuration. - Flexible scopes: Formats a single named file, a specific line range or code block (IDE only), a group of named files, or all uncommitted git-changed files, then reports the actual diff. - Use Case: After an AI assistant edits several Java files, invoke this Skill to reformat just those changed files so the result conforms to the project's Spotless configuration before committing. ## Quick Start Reformat all my uncommitted files using the project's code style and show me what changed.

Frequently Asked Questions about codefmt

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I format Java code with the project's code style?

Run the formatting through the IntelliJ IDE when it is open, which applies the project's configured code style via ReformatCodeProcessor. If the IDE is unreachable, the fallback detects Spotless or a java-format JAR from the build files and runs it from the command line.

How to format only changed files with Spotless?

Resolve the changed set with git status --porcelain, then run ./gradlew spotlessApply with -PspotlessFiles='<regex>' matching those paths, or mvn spotless:apply with -DspotlessFiles for Maven. For large change sets, run the whole-project spotlessApply and note that in the report.

Can I format a specific line range or code block from the command line?

Block and line-range formatting is IDE-only because there is no faithful CLI equivalent. If the IDE is unreachable, the Skill tells you so rather than silently reformatting the whole file.

Does Spotless formatting work for Kotlin and XML files?

It depends on what the project's Spotless configuration covers. If only the java block is configured, Kotlin or XML files are reported as not formatted by the fallback, whereas the IDE path would have formatted them.

What happens if no formatter is configured in the project?

The Skill does not silently no-op. It reports that the IDE is unreachable and no Spotless or java-format formatter is configured, then asks whether to start the IDE or point at a formatter command to use.