mcpField
C
codefmt

codefmt

github.com/amplicodeDevelopment134253 installsUpdated 7w ago
Repository

About codefmt

codefmt is a skill for formatting source files to a project’s code style. It uses the IntelliJ formatter when the repository is available through the IDE, or falls back to the project’s external formatter in the console.

Key features

  1. 01Selects IDE or CLI formatting path
  2. 02Uses IntelliJ’s formatter when available
  3. 03Falls back to project external formatters
  4. 04Supports block formatting through IDE
  5. 05Reports changed files with git diff

Use cases

  1. 01Format files in a project repository
  2. 02Format a selected block through the IDE
  3. 03Apply external formatting when IDE is unavailable

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/amplicode/spring-skills --skill codefmt

After installing, type/codefmtin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
fallback.md
ide.md
scripts/
format-code-block.kts
format-file-group.kts
format-single-file.kts
format-uncommitted.kts

Details

From the project README

Format source files with the project's code style

Two paths reach the same code style: the IDE applies it through IntelliJ's own formatter (highest fidelity, keeps the IDE's VFS/PSI caches consistent); the CLI fallback applies it through the project's own external formatter (Spotless / google-java-format / palantir-java-format) when the IDE isn't reachable.

Pick the path

Probe FIRST, here, before loading either reference — so you read only the one you need. Call steroid_list_projects (via ToolSearch("steroid list projects execute code") if the tool schema isn't loaded):

  • It returns the repo you're in → IDE path: note that entry's project_name (the opaque routing key, not the human-readable name) and follow references/ide.md. Its recipes start already knowing the project_name — don't re-probe.
  • It fails, or the repo isn't listed → CLI fallback path: follow references/fallback.md (detects Spotless / java-format and runs it in the console) and tell the user up front you're using the external-formatter fallback because the IDE wasn't reachable.

Block / line-range formatting (IDE recipe 2) is IDE-only — there's no faithful CLI equivalent. If the user asked for a block and the IDE is unreachable, say so rather than silently reformatting the whole file.

Both paths end the same way: run git diff --stat <paths> and report what actually changed. A reformat that produces no diff is a valid outcome — the files already conform to the style; say so plainly rather than implying work was done.

Comments

Markdown supported