Find your next open-source project

Search by name, purpose, or keyword, or paste a GitHub URL. Start with / to search agent skills (e.g. /pdf)
All skills

extract-python-environment-variables

Scans a Python recipe and updates .env.example, __init__.py, and pyproject.toml with every environment variable it uses.

When to use it

You have a Python recipe that reads env vars or hardcodes model names, but .env.example is missing entries or still has stale TODOs.

For example

You say

Use extract-python-environment-variables on contrib/python/my-recipe. It calls os.environ.setdefault("PROJECT_ID", "my-project-id") and hardcodes model="gemini-3.5-flash" in agent.py.

You get
  • Updated .env.example
  • load_dotenv() in __init__.py
  • python-dotenv in pyproject.toml

How it works

  • Existing .env.example lines it can't prove it wrote are left untouched, and it fails closed on ambiguous formatting.
  • Hardcoded model strings become os.getenv() calls, except in dict keys, list items, subscripts, and comparisons.
  • A --dry-run flag previews every change without writing files.

Before installing

The script needs Python 3.11+ (run it via uv) because it uses the stdlib tomllib module.

This skill includes 3 scripts your assistant may run on your computer.