lint
Installation
SKILL.md
Lint and Type-Check
Run the full static-analysis suite on the project and fix any issues found.
uv run ruff check src— lint the codeuv run ruff format --check src— verify formattinguv run pyrefly check src— static type analysis
Fix every issue reported (re-run until clean) and report a short summary of what changed when done. If a failure is not auto-fixable, explain what needs human judgement rather than silencing it.
Pyrefly + Django gotchas
Pyrefly has built-in Django support (via django-stubs), but a few things aren't covered yet. Recognize these before reaching for # type: ignore:
- Reverse relations (
user.order_set,author.article_set) are not supported. This is a known pyrefly limitation, not a real bug. The right fix is to query the child model directly from its repository (OrderRepository().list_for_user(user_id)) — push the access down into the repo layer rather than suppressing it. Only if that's impossible, narrow it with# type: ignore[attr-defined]at a single call site. ManyRelatedManageris generic over[Parent, Model], not the concrete child. Don't rely on pyrefly to catch a mistyped M2M target — cover it with a test instead.- Chained QuerySet methods beyond
.all()are thinly typed. Keep chains inside the repository where the return type is an annotatedlist[SomeDTO]; don't let querysets leak out into services.
See pyrefly.org/en/docs/django for the current support matrix. Pyrefly's Django support is actively evolving — re-check when upgrading.