python-code-style

Runs ruff lint and format checks on edited Python files and enforces numpydoc docstrings.

1|Updated Jun 22, 2026
One-click install
npx skills add https://github.com/probabl-ai/ibm-workshop --skill python-code-style-probabl-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-code-style
Source: https://github.com/probabl-ai/ibm-workshop/tree/main/.bob/skills/python-code-style
Command: npx skills add https://github.com/probabl-ai/ibm-workshop --skill python-code-style-probabl-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ruff.

What problem does it solve? Python files generated or edited during a data-science workflow often ship with inconsistent formatting, lint violations, missing docstrings, and leftover template or workflow commentary. This Skill standardizes style enforcement with ruff and numpydoc so committed files read like a colleague wrote them. ## Core Features & Use Cases - Ruff lint and format pipeline: Runs ruff format, ruff check --fix, and ruff check in order on every Python file touched in a turn, with a one-fix-per-file rule that caps retries and surfaces persistent diagnostics. - Project ruff.toml setup: Drops a bundled ruff.toml template (line length 88, numpy pydocstyle convention, per-file ignores for experiments/, audit/, and data/eda.py) into fresh projects, always read verbatim from the template rather than authored from memory. - Comment contextualization: Rewrites leftover template and workflow prose in touched files into problem-specific documentation grounded in the dataset and experiment context. - Use Case: After generating an experiment script for a breast-cancer classifier, invoke this Skill to format the file, fix import ordering, add numpydoc docstrings to public functions, and strip scaffolding comments before committing. ## Quick Start Run ruff format and check on the Python files you just edited and rewrite their comments to describe the data-science problem.

Frequently Asked Questions about python-code-style

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I lint and format Python files with ruff?

Run three commands in order inside the project environment: ruff format, then ruff check --fix, then a final ruff check. The first formats code, the second auto-fixes imports and syntax, and the third reports remaining issues like missing docstrings.

Should I use ruff or black and isort for Python formatting?

Ruff replaces black, isort, flake8, and pydocstyle in this stack as the single canonical linter and formatter. It handles line formatting, import sorting, and docstring convention checks in one tool configured through a project-root ruff.toml.

What docstring format does ruff enforce with the numpy convention?

The numpy convention requires a one-line imperative summary, a blank line, then Parameters and Returns sections with types and shapes. Public functions must include full sections; only private underscore-prefixed helpers may omit docstrings.

Why does ruff report D100 and D103 warnings in experiment scripts?

Those warnings appear when the project-root ruff.toml is missing or not loaded. The bundled template per-file-ignores D100, D103, E402, and B018 for experiments, audit, and data/eda.py because cell-style scripts legitimately violate those rules.

Can ruff linting be automated with a hook on every file edit?

This Skill is intentionally manual and forbids configuring PostToolUse hooks, since hooks trigger fix cycles on every micro-edit and can stall on partial files. Ruff is run deliberately on touched files with a maximum of two fix passes per warning.