
Fix Types
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-codeInstalls into .claude/skills of the current project.
Files
Your task
To fix types, do the following.
- First run the type checker to see what the issues are:
uv run mypy . - Group the errors you find in to logical buckets.
- 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.
- Only once I approve, apply the fix and move onto the next error in the bucket.
- 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