Skip to content
Back to skills

Coding.Fix Bloated Imports

ASecurity

Fix Python imports of large packages needed only for few functions in a module

  • 158 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 7, 2026
developmentpythongoexpress

Security analysis

A100/100

Scanned November 7, 2026

npx -y skills add gpsaggese/helpers --skill coding.fix_bloated_imports --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Coding.Fix Bloated Imports?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Coding.Fix Bloated Imports
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gpsaggese-coding-fix-bloated-imports/badge)](https://www.skillsdirectory.com/skills/gpsaggese-coding-fix-bloated-imports)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
description: Fix Python imports of large packages needed only for few functions in a module
model: haiku
---

- I pass you one or more files `<FILES>` and one or more packages `<PACKAGES>` that
  are large to import (e.g., `ipython`, `pandas`) and needed in only a few functions

- In `<FILES>`, use a conditional import for type checking and lazy imports for
  `<PACKAGES>`
  - E.g., transform
    ```python
    def make_slider() -> "ipywidgets.IntSlider":
        import ipywidgets
        ...
    ```
    into
    ```python
    from typing import TYPE_CHECKING

    if TYPE_CHECKING:
        import ipywidgets

    def make_slider() -> "ipywidgets.IntSlider":
        import ipywidgets
        ...
    ```

- Use forward references only for the package types, not for the whole expression
  - **Bad** (quotes the whole expression as one string)
    ```python
    "Tuple[Union[ipywidgets.FloatSlider, ipywidgets.IntSlider], ipywidgets.HBox]"
    ```
  - **Good** (quotes only the package types)
    ```python
    Tuple[Union["ipywidgets.FloatSlider", "ipywidgets.IntSlider"], "ipywidgets.HBox"]
    ```

- If most functions in `<FILES>` need `<PACKAGES>`, suggest not doing this transform

# Verification
- [ ] Confirm `<PACKAGES>` is imported only under `TYPE_CHECKING` or inside the
      functions that use it
- [ ] Confirm forward references quote only the package types, not full
      expressions

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.