Format Code
Format Python sources in the repository with ruff and apply its safe lint fixes (pre-commit enforced).
by 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
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
From the repository root, run:
uv run ruff check --fix uv run ruff formatInspect 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 formatexcludes Markdown there, so fenced Python in docs, notes andplan/history/is never rewritten. - Use
markdownlint-cli2for Markdown. - Formatting can rewrap a line and strand an inline pragma.
run-lintersrunsruff checkandpyright-changedafter 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
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…