import-hygiene

Detect dead, forbidden, and duplicate imports in Python code.

Updated Oct 9, 2025
One-click install
npx skills add https://github.com/Siamese001/Agentic-Workflow --skill import-hygiene
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: import-hygiene
Source: https://github.com/Siamese001/Agentic-Workflow/tree/main/.windsurf/skills/import-hygiene
Command: npx skills add https://github.com/Siamese001/Agentic-Workflow --skill import-hygiene

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and scripts (resource) components.

What problem does it solve?

This Skill prevents common import errors like dead imports, forbidden module usage, and duplicate imports, ensuring code maintainability and adherence to project standards before changes are committed.

Core Features & Use Cases

  • Dead Import Detection: Automatically flags and prevents unused imports (ruff F401).
  • Forbidden Import Blocking: Enforces a strict list of disallowed import patterns and paths.
  • Use Case: Before committing a refactor that moves code between modules, run this skill to ensure all new imports are canonical and none of the newly forbidden patterns are introduced.

Quick Start

Run the import-hygiene skill to check all Python files modified in the current commit for import violations.

Frequently Asked Questions about import-hygiene

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

FAQPage Schema
How do I prevent dead and unused Python imports before committing code?

Prevent unused Python imports before committing by running AST analysis and Ruff F401 checks through pre-commit hooks to automatically flag and block dead module references in modified files.

How do I enforce a strict list of forbidden import patterns in a Python codebase?

Enforce forbidden import patterns in Python by defining disallowed module paths in project-specific rules, which the skill checks against during AST analysis to block non-compliant imports before commits.

Does this import linting skill work with Ruff and pre-commit hooks?

Yes, this import linting skill integrates directly with Ruff and pre-commit hooks, leveraging Ruff F401 checks and AST analysis to automatically enforce import compliance on Python files modified in the current commit.

What is the best way to detect duplicate imports in Python modules?

Detect duplicate imports in Python modules by running AST analysis to parse import statements and identify redundant module references. This skill automatically flags duplicates alongside dead and forbidden imports before code commits.

Can I check only modified Python files for import violations instead of the whole project?

Yes, you can check only modified Python files for import violations. The skill specifically targets Python files modified in the current commit, running AST analysis and Ruff checks to enforce compliance without scanning the entire project.