azure/azure-sdk-for-python/fix-mypy
- community
Checking that the SKILL.md file is still in the repository.
Automatically fix mypy type checking issues in azure-ai-ml package following Azure SDK Python patterns. Expects GitHub issue URL and optional virtual env path in the request. Format "fix mypy issue <issue-url> [using venv <path>]"
Install
npx vskill@latest install azure/azure-sdk-for-python/fix-mypySKILL.md
Fix MyPy Issues Skill
This skill automatically fixes mypy type checking errors in the azure-ai-ml package by analyzing existing code patterns and applying fixes with 100% confidence based on GitHub issues.
Scope: Fix only mandatory/blocking issues — type errors that will cause CI to fail. Leave optional/informational warnings as-is.
Overview
Intelligently fixes mypy issues by:
- Getting the GitHub issue URL from the user
- Reading and analyzing the issue details
- Setting up or using existing virtual environment
- Installing required dependencies
- Running mypy on the specific files/areas mentioned in the issue
- Analyzing the mypy output to identify type errors
- Searching codebase for existing type annotation patterns
- Applying fixes only with 100% confidence
- Re-running mypy to verify fixes
- Providing a summary of what was fixed
Running MyPy
Command:
Note:azpysdkruns at the package level only. To focus on specific files, run the full check and filter the output by file path.
Reference Documentation
Fixing Strategy
Step 0: Get GitHub Issue Details
Check if user provided in their request:
- GitHub issue URL (look for
https://github.com/Azure/azure-sdk-for-python/issues/...in user's message) - Virtual environment path (look for phrases like "using venv", "use env", "virtual environment at", or just the venv name)
If GitHub issue URL is missing: Ask: "Please provide the GitHub issue URL for the mypy type checking problems you want to fix."
If virtual environment is missing: Ask: "Do you have an existing virtual environment path, or should I create 'env'?"
Once you have the issue URL: Read the issue to understand which files/modules and specific error codes to fix.
Step 1: CRITICAL - Activate Virtual Environment FIRST
IMMEDIATELY activate the virtual environment before ANY other command:
⚠️ IMPORTANT: ALL subsequent commands MUST run within the activated virtual environment. Never run commands outside the venv.
Step 2: Install Dependencies (within activated venv)
Important: Use Python 3.10 compatible environment for mypy checks.
Step 3: Identify Target Files (within activated venv)
Based on the GitHub issue details, determine which files to check:
Option A - Run mypy on the package and filter output:
Option B - Check modified files (if no specific target):
Step 4: Run MyPy (within activated venv)
⚠️ Ensure virtual environment is still activated before running:
Step 5: Analyze Type Errors
Parse the mypy output to identify:
- Error type and code (e.g., [arg-type], [return-value], [assignment])
- File path and line number
- Specific error description
- Expected vs actual types
- Cross-reference with the GitHub issue to ensure you're fixing the right problems
Step 6: Search for Existing Type Annotation Patterns
Before fixing, search the codebase for how similar types are annotated:
Use the existing type annotation patterns to ensure consistency.
Step 7: Apply Fixes (ONLY if 100% confident)
Fix only mandatory/blocking issues. Skip optional or informational warnings that do not cause CI failure.
ALLOWED ACTIONS: Fix type errors with 100% confidence Use existing type annotation patterns as reference Follow Azure SDK Python type checking guidelines Add missing type hints Fix incorrect type annotations Make minimal, targeted changes
FORBIDDEN ACTIONS: Fix errors without complete confidence Create new files for solutions Import non-existent types or modules Add new dependencies or imports outside typing module Use # type: ignore without clear justification Change code logic to avoid type errors Delete code without clear justification
Step 8: Verify Fixes
Re-run mypy to ensure:
- The type error is resolved
- No new errors were introduced
- The code still functions correctly
Step 9: Summary
Provide a summary:
- GitHub issue being addressed
- Number of type errors fixed
- Number of errors remaining
- Types of fixes applied (e.g., added type hints, fixed return types)
- Any errors that need manual review
Common MyPy Issues and Fixes
Missing Type Hints
Error: Function is missing a type annotation
Fix: Add proper type hints:
Argument Type Mismatch
Error: Argument 1 to "function" has incompatible type "X"; expected "Y"
Fix: Ensure the argument matches the expected type or add proper type conversion:
Return Type Mismatch
Error: Incompatible return value type (got "X", expected "Y")
Fix: Ensure the return type matches the annotation:
Type Annotation with Optional
Error: Item "None" of "Optional[X]" has no attribute "Y"
Fix: Add None check before accessing attributes:
Union Types
Error: Argument has incompatible type
Fix: Use Union for multiple acceptable types:
List/Dict Type Annotations
Error: Need type annotation for variable
Fix: Add specific type annotations for collections:
Example Workflow
Notes
- Always read the existing code to understand type annotation patterns before making changes
- Prefer following existing patterns over adding new complex types
- Use Python 3.10+ compatible type hints (use
Optional[X]instead ofX | None) - If unsure about a fix, mark it for manual review
- Some errors may require architectural changes - don't force fixes
- Test the code after fixing to ensure functionality is preserved
- Avoid using
# type: ignoreunless absolutely necessary and document why
Security
- Security scanPassed, 98 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.github/skills/ml/fix-mypy/SKILL.md
Popularity
- Repository stars
- 5,504
- Repository forks
- 3,255
- 7-day trend score
- 43
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 18 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/azure/azure-sdk-for-python/fix-mypy)