auto-import-rules

Enforce Python import ordering and relative import restrictions in dlt projects.

5.7k|578|Updated Jan 26, 2022
One-click install
npx skills add https://github.com/dlt-hub/dlt --skill auto-import-rules-dlt-hub
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: auto-import-rules
Source: https://github.com/dlt-hub/dlt/tree/main/.claude/skills/auto-import-rules
Command: npx skills add https://github.com/dlt-hub/dlt --skill auto-import-rules-dlt-hub

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enforces import conventions and ordering for Python code in the dlt project and tests, reducing import-related issues and improving maintainability.

Core Features & Use Cases

  • Import order enforcement: standard library, third-party, then local imports.
  • Relative import restrictions: disallow or warn on relative imports to encourage explicit module boundaries.
  • TYPE_CHECKING guidance: promote safe typing imports and avoid runtime overhead.

Quick Start

Run the linter to enforce import conventions in your dlt project.

Frequently Asked Questions about auto-import-rules

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce Python import ordering and conventions in my project?

Apply static-analysis checks to enforce Python import conventions and ordering, validating that standard library, third-party, and local imports are grouped and sorted correctly. This maintains clean import structures and improves code maintainability.

Why should I disallow relative imports in Python code?

Disallowing relative imports encourages explicit module boundaries and prevents import-related issues during development. Static-analysis checks can warn on or restrict relative imports to maintain clear dependency graphs across your project.

What is the best way to handle TYPE_CHECKING imports to avoid runtime overhead?

Follow TYPE_CHECKING guidance to promote safe typing imports and avoid runtime overhead. Document recommended patterns for placing typing imports inside TYPE_CHECKING blocks so they are only evaluated during static analysis, not at runtime.

Can I use static analysis to validate import placement for optional dependencies?

Yes, static-analysis checks can validate import placement and document recommended patterns for optional dependencies. This ensures optional packages are imported safely without breaking the core application when they are not installed.

Does import linting work with test code as well as the main package?

Import linting targets code in both the main package and tests. It guides the organization of stdlib, third-party, and local imports during development across your entire project to reduce import-related issues.