Code Engineering
Run a code formatter; auto-detects prettier / black / ruff format / gofmt / cargo fmt / rubocop / spotless.
formatCompanion to lint. Lint flags semantic problems; format normalises whitespace, quoting, and line length per the repo's chosen style.
Detection: .prettierrc* → prettier · pyproject.toml [tool.black] → black · pyproject.toml [tool.ruff.format] → ruff format · go.mod → gofmt · Cargo.toml → cargo fmt · .rubocop.yml → rubocop · pom.xml → spotless.
When a user asks:
Would any files change if I ran the formatter?
the agent calls the tool:
format()and gets back: prettier: 3 files would change — src/api/handlers.ts, src/api/router.ts, src/utils/dates.ts
Real scenarios where agents put this tool to work.
Implementation lives at swarmai-tools/src/main/java/ai/intelliswarm/swarmai/tool/code/build/FormatterTool.java in the swarm-ai repository.