Black
$ black Foundation Low RiskThe Python Software Foundation's deterministic Python code formatter enforcing a single uniform style across teams. Provides --check, --diff, and --quiet flags so coding agents can verify or preview formatting before writing.
brew install black Formats local Python files offline; no MCP server is appropriate.
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
Deterministic exit codes (0 clean, 1 would reformat, 123 internal error), --check, --diff, and --quiet, though no --json output.
--check --diffoffers safe dry-run previews- Plain-text diagnostics only (no
--jsonflag)
Validates AST equivalence before writing formatted files and stays read-only under --check.
- Built-in AST equivalence verification unless
--fastis passed
Available across Homebrew, PyPI, and uvx, requiring a Python runtime.
- Standard
pip/uvx/brewavailability on macOS, Linux, and Windows
Canonical Python formatting standard, though slower than ruff format on large codebases.
- Zero-config style consistency across Python projects
Hosted under the Python Software Foundation (psf/black) with MIT licensing.
- Official PSF project (
psf/black)
Detailed ReadTheDocs documentation covering CLI flags and pyproject.toml options.
- Official docs at black.readthedocs.io
Security, Auth & Guardrails
Purely local Python formatter; no credentials stored or required.
MIT open-source Python package; completely free.
# Black (black) Agent Rules - Always run `black --check --diff` before rewriting files. - Never pass `--fast` on untrusted changes; Black's AST safety check protects against parse regressions.
Agent-Ready Command Recipes
Safe Read-Only Queries
black --check --diff --quiet .
Previews proposed formatting diffs and exits non-zero if changes are needed without editing files.
Controlled Writes & Previews
black --quiet src/app.py
Reformats the target file deterministically using pyproject.toml [tool.black] settings.
Strengths for Agents
- + Built-in AST equivalence check prevents formatting from altering program behavior.
- + Distinct exit code
1with--check --diffgives agents a reliable dry-run gate.
Caveats & Pitfalls
- ! No
--jsonoutput format; parses and formats more slowly thanruff format. - ! Running
black .without--checkimmediately rewrites files in place.