This is a methodical approach to fixing Python type errors with mypy. It runs the type checker, groups errors into logical buckets, and then walks through each fix one at a time with you before applying it. The interaction model is the key here: it explains what it wants to do and waits for your approval before making changes. The skill bakes in some opinionated best practices like preferring cast() over type: ignore comments, using proper exceptions instead of assertions for null checks, and handling Django's lazy translation strings properly. If you're tired of batch fixing type errors only to realize half the changes went in the wrong direction, the step by step confirmation flow might save you some cleanup work.

skills.sh installs
285
GitHub stars
32
last updated
Aug 21, 2026

Install

$ npx -y skills add saaspegasus/django-skills --skill fix-types --agent claude-code

Installs into .claude/skills of the current project.

Files

Your task

To fix types, do the following.

  1. First run the type checker to see what the issues are:
    uv run mypy .
    
  2. Group the errors you find in to logical buckets.
  3. For each bucket of errors, go through the errors one at a time, tell me the fix you want to apply, and then ask if I have any questions or suggestions before proceeding.
  4. Only once I approve, apply the fix and move onto the next error in the bucket.
  5. Once you've completed a bucket, ask me if I'd like to move on to the next bucket.
Prefer cast() over type: ignore

When mypy can't infer the correct type, prefer using cast() over # type: ignore:

# Preferred - documents the expected type
choices = cast(list[tuple[str, str]], field.choices)

# Avoid when cast is possible - just silences the error
choices = list(field.choices)  # type: ignore[arg-type]

Why: cast() explicitly documents what type you expect, making the code more readable and maintainable. It also doesn't silence other potential errors on the same line.

Prefer proper errors over assertions for null checks

Sponsors

Details

Repository
github.com/saaspegasus/django-skills
Categories
Debugging, Python
First seen
Jun 3, 2026

More from saaspegasus/django-skills

All 2

Recommended

More Debugging
1charleswiltgen avataraxiom-xcode-debuggingcharleswiltgen/axiomUse when encountering BUILD FAILED, test crashes, simulator hangs, stale builds, zombie xcodebuild processes, "Unable to boot simulator", "No such module" after269skills.sh installs
2octagonai avatarindustry-performance-snapshotoctagonai/skillsRetrieve a daily overview of industry performance using Octagon MCP. Use when analyzing daily price movements, average changes, and performance trends for speci264skills.sh installs
3sickn33 avatarperformance-testing-review-multi-agent-reviewsickn33/antigravity-awesome-skillsperformance testing review multi agent review263skills.sh installs
4octagonai avatarstock-performanceoctagonai/skillsRetrieve stock price data and performance metrics using Octagon MCP. Use when analyzing daily closing prices, trading volume, price trends, historical performan262skills.sh installs
5pproenca avatarbug-reviewpproenca/dot-skillsUse this skill when a user asks to review a pull request for bugs, wants AI code review focused on correctness issues, or runs /bug-review. Trigger on PR review256skills.sh installs
6octagonai avatarsector-performance-snapshotoctagonai/skillsRetrieve a snapshot of market sector performance using Octagon MCP. Use when analyzing sector-wide metrics including revenue, EBITDA, net income, market cap, an254skills.sh installs