원클릭으로
fix-backend-type-errors
Systematic Python type error resolution (mypy/pyright). Load when fixing backend type check failures
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Systematic Python type error resolution (mypy/pyright). Load when fixing backend type check failures
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
External API evaluation and MCP server wrapper generation. Load when integrating a REST/GraphQL API as a workspace tool
Capability-based provider system patterns. Load when creating providers or wiring module-provider integration
Full-stack WebSocket subscription development. Load when adding WS routes, topic services, or debugging WS data flows
Type-first Python with Pydantic, Protocol, and discriminated unions. Load when writing models or enforcing typing
Systematic type error resolution for Python (mypy/pyright) and TypeScript (vue-tsc). Use when fixing type errors, resolving type check failures, or optimizing type imports.
Terminal command safety, delegation routing, and guarded execution. Load when running shell commands or delegating to Bash subagents
| name | fix-backend-type-errors |
| description | Systematic Python type error resolution (mypy/pyright). Load when fixing backend type check failures |
| user-invocable | false |
Systematic workflow to resolve Python static type checker errors while preserving runtime behavior.
Applies when:
backend/TYPE_CHECKING)# type: ignore suppressions| Principle | Description |
|---|---|
| Behavior Preservation | Fixes must NOT change runtime logic. Only annotations, imports, and casts. |
| Zero Suppressions | # type: ignore is forbidden. Resolve properly or escalate. |
| Import Optimization | Use TYPE_CHECKING for type-only imports to avoid circular dependencies. |
| Minimal Surface | One error → one minimal fix. Avoid broad refactors. |
| Priority | Command | Use Case |
|---|---|---|
| 1. Makefile | make -C backend type-check | Full check (black, isort, flake8, mypy, pyright) |
| 2. Direct | cd backend && poetry run pyright src/ tests/ | Pyright only |
| 3. Single-file | cd backend && poetry run pyright path/to/file.py | Fast iteration |
[file:line] error_code: message| Category | Examples | Action |
|---|---|---|
| A: Direct Fix | Missing annotation, wrong type | Fix immediately |
| B: Import Optimization | Circular import, runtime-only import | Move to TYPE_CHECKING |
| C: Structural | Generic variance, protocol mismatch | Analyze deeply |
| D: External | Untyped library, upstream bug | Escalate |
For each error, apply decision tree:
*_generated/) → SkipAfter fixes, run validation (all from project root, fail-fast && chains):
| Change Type | Commands |
|---|---|
| Pure annotations | make -C backend format && make -C backend type-check |
| Added cast/assert | make -C backend clean-cache && make -C backend format && make -C backend type-check && make -C backend test |
| Changed runtime imports | make -C backend clean-cache && make -C backend format && make -C backend type-check && make -C backend test |
Why clean-cache: mypy/pyright cache symbols by name. After adding casts or changing imports, stale cache can mask errors that CI (cold cache) would catch.
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from expensive_module import ExpensiveType
def func(param: "ExpensiveType") -> None:
...
from typing import cast
result = cast(ExpectedType, untyped_call()) # Document why safe
Only after exhausting all fix approaches:
# pyright: ignore[reportAssignmentType]SUPPRESSION REQUIRED (External Issue)
File: path/to/file.py:42
Error: [reportAssignmentType] Type "X" is not assignable to "Y"
Root Cause: [Library/framework limitation]
Proposed: __tablename__ = cast(Any, "users")
Validation: Tested — resolves error
DO NOT apply suppressions without user acknowledgment.
# type: ignore without exhausting fixes*_generated/ directories)