---
title: "Format all code with one tool · Agent Wranglers"
url: https://agentwranglers.se/playbook/architecture/structure/one-formatter
updated: 2026-10-20
licence: "All rights reserved"
---

# Format all code with one tool

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Required
- Chapter: [Structure](https://agentwranglers.se/playbook/architecture/structure)
- Rule: Format every file with one automatic formatter, with its settings in the repository. Nobody formats by hand, and reviews never discuss layout.
- How: Pick the standard formatter for each language, such as Prettier for JavaScript, Ruff or Black for Python, gofmt for Go and PHP-CS-Fixer for PHP. Commit its settings file. Run it on save, in a pre-commit hook and in the build. Agents then see and copy one style.
- Check: The build runs the formatter in check mode and fails when it would change a file. Note that `gofmt -l` only lists files, so test that its output is empty.

Example:

```sh
npx prettier --check .
ruff format --check .
vendor/bin/php-cs-fixer fix --dry-run --diff
test -z "$(gofmt -l .)"
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers architecture playbook: https://agentwranglers.se/playbook/architecture/structure/one-formatter`.

- Previous: [Name files after what they hold](https://agentwranglers.se/playbook/architecture/structure/consistent-file-names)
- [Structure](https://agentwranglers.se/playbook/architecture/structure)
