Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

SwiftFormat

$ swiftformat Community Low Risk
Nick Lockwood · Code & DevOps · MIT · macos / linux / windows

Fast standalone Swift code formatter and style linter supporting .swiftformat configuration, non-mutating --lint and --dryrun verification modes, and structured CI reporters including --reporter json.

FCRS-1.0 Score
89 /100
Good
Medium Confidence
Zero-Friction Install
brew install swiftformat
CLI vs MCP Decision CLI Only

Local Swift formatting and --lint --reporter json checks run directly on source files without MCP.

Agent-Readiness Checklist

✓ JSON Output
— Field Filtering
✓ Non-Interactive
✓ Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 21 / 25

Supports --lint --reporter json, --dryrun, --quiet, and --swift-version, though default invocation without --lint/--dryrun writes files in place.

  • --lint --reporter json outputs structured JSON
  • --dryrun previews changes without disk writes
Trust & Safety 22 / 25

Provides --lint and --dryrun guards, though agents must remember not to omit those flags because formatting in place is the default behavior.

  • Supports --lint and --dryrun read-only modes
  • Default command without flags modifies files in place
Setup & Portability 14 / 15

Standalone binary without SourceKit dependency, available via Homebrew and GitHub Releases on macOS, Linux, and Windows.

  • Zero SourceKit runtime dependency
Utility & Efficiency 14 / 15

Fast, deterministic Swift formatting and rule enforcement in a single tool.

  • Handles both formatting and lint-style rule checks
Maintenance & Lineage 9 / 10

Long-maintained MIT open-source project (nicklockwood/SwiftFormat) with active releases.

  • Established nicklockwood/SwiftFormat repo under MIT
Docs & Verifiability 9 / 10

Clear README.md, Rules.md, and --options / --rules CLI introspection.

  • Comprehensive Rules.md and --help reference

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

Purely local Swift source formatter; no credentials stored or required.

Side Effects
Read-Only Local Write
Cost & Quotas

MIT open-source Swift tool; completely free.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# 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

Lint Swift formatting with JSON reporter
swiftformat . --lint --reporter json --quiet

Verifies formatting compliance without modifying files and outputs structured JSON diagnostics.

Preview which files would be formatted
swiftformat . --dryrun

Scans the project and reports files that would change without writing to disk.

Controlled Writes & Previews

Format Swift files in place
swiftformat . --quiet

Applies configured .swiftformat rules directly to Swift files in the workspace.

Strengths for Agents

  • + --lint --reporter json and --dryrun support clean non-mutating CI and agent checks.
  • + Self-contained Swift parser requiring no Xcode or SourceKit daemon.

Caveats & Pitfalls

  • ! Running swiftformat . without --lint or --dryrun immediately modifies files on disk.
  • ! Always check .swift-version or pass --swift-version to prevent version-dependent syntax rewrites.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI