SwiftFormat
$ swiftformat Community Low RiskFast standalone Swift code formatter and style linter supporting .swiftformat configuration, non-mutating --lint and --dryrun verification modes, and structured CI reporters including --reporter json.
brew install swiftformat Local Swift formatting and --lint --reporter json checks run directly on source files without MCP.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Supports --lint --reporter json, --dryrun, --quiet, and --swift-version, though default invocation without --lint/--dryrun writes files in place.
--lint --reporter jsonoutputs structured JSON--dryrunpreviews changes without disk writes
Provides --lint and --dryrun guards, though agents must remember not to omit those flags because formatting in place is the default behavior.
- Supports
--lintand--dryrunread-only modes - Default command without flags modifies files in place
Standalone binary without SourceKit dependency, available via Homebrew and GitHub Releases on macOS, Linux, and Windows.
- Zero SourceKit runtime dependency
Fast, deterministic Swift formatting and rule enforcement in a single tool.
- Handles both formatting and lint-style rule checks
Long-maintained MIT open-source project (nicklockwood/SwiftFormat) with active releases.
- Established
nicklockwood/SwiftFormatrepo under MIT
Clear README.md, Rules.md, and --options / --rules CLI introspection.
- Comprehensive
Rules.mdand--helpreference
Security, Auth & Guardrails
Purely local Swift source formatter; no credentials stored or required.
MIT open-source Swift tool; completely free.
# SwiftFormat Agent Rules - Remember `swiftformat <path>` formats files in place BY DEFAULT — always pass `--lint` or `--dryrun` for read-only checks. - Use `--lint --reporter json --quiet` when capturing machine-readable formatting issues.
Agent-Ready Command Recipes
Safe Read-Only Queries
swiftformat . --lint --reporter json --quiet
Verifies formatting compliance without modifying files and outputs structured JSON diagnostics.
swiftformat . --dryrun
Scans the project and reports files that would change without writing to disk.
Controlled Writes & Previews
swiftformat . --quiet
Applies configured .swiftformat rules directly to Swift files in the workspace.
Strengths for Agents
- +
--lint --reporter jsonand--dryrunsupport clean non-mutating CI and agent checks. - + Self-contained Swift parser requiring no Xcode or SourceKit daemon.
Caveats & Pitfalls
- ! Running
swiftformat .without--lintor--dryrunimmediately modifies files on disk. - ! Always check
.swift-versionor pass--swift-versionto prevent version-dependent syntax rewrites.