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

Black

$ black Foundation Low Risk
PSF · Code & DevOps · MIT · macos / linux / windows

The 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.

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

Formats local Python files offline; no MCP server is appropriate.

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 19 / 25

Deterministic exit codes (0 clean, 1 would reformat, 123 internal error), --check, --diff, and --quiet, though no --json output.

  • --check --diff offers safe dry-run previews
  • Plain-text diagnostics only (no --json flag)
Trust & Safety 23 / 25

Validates AST equivalence before writing formatted files and stays read-only under --check.

  • Built-in AST equivalence verification unless --fast is passed
Setup & Portability 13 / 15

Available across Homebrew, PyPI, and uvx, requiring a Python runtime.

  • Standard pip/uvx/brew availability on macOS, Linux, and Windows
Utility & Efficiency 12 / 15

Canonical Python formatting standard, though slower than ruff format on large codebases.

  • Zero-config style consistency across Python projects
Maintenance & Lineage 9 / 10

Hosted under the Python Software Foundation (psf/black) with MIT licensing.

  • Official PSF project (psf/black)
Docs & Verifiability 8 / 10

Detailed ReadTheDocs documentation covering CLI flags and pyproject.toml options.

  • Official docs at black.readthedocs.io

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

Purely local Python formatter; no credentials stored or required.

Side Effects
Read-Only Local Write
Cost & Quotas

MIT open-source Python package; completely free.

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

Check Python formatting with unified diff preview
black --check --diff --quiet .

Previews proposed formatting diffs and exits non-zero if changes are needed without editing files.

Controlled Writes & Previews

Format targeted Python files in place
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 1 with --check --diff gives agents a reliable dry-run gate.

Caveats & Pitfalls

  • ! No --json output format; parses and formats more slowly than ruff format.
  • ! Running black . without --check immediately rewrites files in place.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI