Coding.fix bloated imports

From causify-ai/helpers · View interactive version

Coding.fix bloated imports is an AI agent skill from the GitHub repository causify-ai/helpers. Fix Python imports of large packages needed only for few functions in a module

How to use this skill

Skill file

are usually large to import (e.g., ipython, pandas) and are needed only in

few functions in the files

for <PACKAGES>

```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

...

```

not for the including

```python

"Tuple[Union[ipywidgets.FloatSlider, ipywidgets.IntSlider], ipywidgets.HBox]"

```

```python

Tuple[Union["ipywidgets.FloatSlider", "ipywidgets.IntSlider"], "ipywidgets.HBox"]

```

<PACKAGES>, you might suggest to not do this transform

Verification

functions that use it

expressions

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.