ruff-jupyter-diff-inflation

Configure Ruff to exclude Jupyter notebooks during lint fixes.

Updated Nov 18, 2025
One-click install
npx skills add https://github.com/cajias/claude-skills --skill ruff-jupyter-diff-inflation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ruff-jupyter-diff-inflation
Source: https://github.com/cajias/claude-skills/tree/main/plugins/python-tooling/skills/ruff-jupyter-diff-inflation
Command: npx skills add https://github.com/cajias/claude-skills --skill ruff-jupyter-diff-inflation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you diagnose and prevent huge, review-unfriendly diffs caused by Ruff rewriting Jupyter notebook structure when you only intended to make a small lint or import fix.

Core Features & Use Cases

  • Notebook Diff Diagnosis: Identifies when a ruff check --fix or related lint command is normalizing notebook cell source fields and inflating the patch size.
  • Project Configuration Fix: Recommends excluding .ipynb files in Ruff configuration so notebook formatting is not touched during Python lint cleanup.
  • Practical Recovery Guidance: Explains how to revert already modified notebooks and verify that the lint scope is limited to the intended Python files.
  • Use Case: A small unused-import cleanup in a mixed Python and notebook repository suddenly turns into a massive PR with hundreds of notebook lines changed; this Skill shows how to contain the diff.

Quick Start

Ask me to inspect your Ruff lint setup and tell me how to exclude Jupyter notebooks so a fix run does not rewrite their JSON structure.

Frequently Asked Questions about ruff-jupyter-diff-inflation

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

FAQPage Schema
Why does Ruff create massive diffs when linting Jupyter notebooks?

Ruff inflates Jupyter notebook diffs because running `ruff check --fix` rewrites the internal JSON cell source fields, causing structural notebook churn that turns a small unused-import cleanup into a massive pull request with hundreds of changed lines.

How do I exclude .ipynb files from Ruff lint fixes?

To exclude .ipynb files from Ruff lint fixes, update your Ruff configuration by adding Jupyter notebooks to the `extend-exclude` setting. This skips notebooks entirely, ensuring the lint scope is limited to your intended Python files and preventing structural notebook churn.

How do I revert Jupyter notebooks modified by Ruff formatting?

To revert Jupyter notebooks modified by Ruff formatting, perform a git rollback of the already modified notebook files. This undoes the structural JSON changes and verifies that your future lint scope remains limited to the intended Python files.

Can I run Ruff lint cleanup on a Python repository without touching committed Jupyter notebooks?

Yes, you can run Ruff lint cleanup without touching committed Jupyter notebooks by configuring the `extend-exclude` setting in Ruff. This skips notebooks entirely, allowing focused Python lint cleanup in mixed repositories without causing structural notebook churn.

What causes notebook diff inflation when using Ruff in mixed Python and notebook repositories?

Notebook diff inflation occurs when Ruff rewrites Jupyter notebook cell source fields during a standard lint fix. Applying Ruff configuration changes to exclude `.ipynb` files prevents the tool from normalizing the notebook JSON structure and inflating the patch size.