Command Palette

Search for a command to run...

Back to skills
skill № 62619

Format Code

Format Python sources in the repository with ruff and apply its safe lint fixes (pre-commit enforced).

FreeNo executable scripts
CERTCCby CERTCC★ 22 GitHub stars

Install Format Code in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

About this skill

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

  1. From the repository root, run:

    uv run ruff check --fix
    uv run ruff format
    
  2. Inspect the output and stage changes if any files were rewritten.

Constraints / Rules

  • Do not pass paths. Scope is declared in [tool.ruff] in pyproject.toml (IMPLTS-07-021); ruff format excludes Markdown there, so fenced Python in docs, notes and plan/history/ is never rewritten.
  • Use markdownlint-cli2 for Markdown.
  • Formatting can rewrap a line and strand an inline pragma. run-linters runs ruff check and pyright-changed after formatting; use it before committing. A stranded # pyright: ignore[...] in a changed file is reported there, and in any other file by CI's whole-project pyright job (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-0221).

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

FAQ

What does the Format Code skill do?

Format Python sources in the repository with ruff and apply its safe lint fixes (pre-commit enforced).

How do I install the Format Code skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the Format Code skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare Format Code with