Skill: Format code with ruff
Purpose
Format Python source files with ruff format and apply ruff's safe lint fixes
(import sorting among them). This keeps a consistent code style and avoids
pre-commit failures.
Inputs
repo_root(string, default.): repository root where the command should
be executed.
Outputs
formatted_files(string): stdout from ruff listing files fixed or
reformatted.
Procedure
- From the repository root, run:
```bash
uv run ruff check --fix
uv run ruff format
```
- Inspect the output and stage changes if any files were rewritten.
Constraints / Rules
- Do not pass paths. Scope is declared in
[tool.ruff]inpyproject.toml
(IMPLTS-07-021); ruff format excludes Markdown there, so fenced Python in
docs, notes and plan/history/ is never rewritten.
- Use
markdownlint-cli2for Markdown. - Formatting can rewrap a line and strand an inline pragma.
run-lintersruns
ruff check and mypy after formatting; use it before committing. A stranded
# pyright: ignore[...] is reported by CI's pyright job, which is the only
place pyright runs (PAD-18-027).
Rationale
One formatter, whose import sorting and lint fixes share one configuration,
keeps the pre-commit hook, the CI lint-ruff job and local runs in agreement
(ADR-0094).