Skip to content

Extract Python Environment Variables

Declare a Python recipe's env vars in .env.example and wire up dotenv loading

Stars
10,568
Licence
Apache-2.0
Files
2 files

What it does

When installed, the agent can audit a Python recipe for every environment variable it reads, including hidden defaults set with os.environ.setdefault. It then adds missing variables to a .env.example file, injects a load_dotenv() call into the package __init__.py, makes sure python-dotenv is listed in pyproject.toml, and replaces hardcoded model-name strings with os.getenv lookups. It is designed to avoid overwriting lines the author wrote by hand.

Great for

  • Maintainers of Python agent recipes who want a consistent .env.example
  • Developers converting hardcoded model names into configurable environment variables
  • Teams upgrading older recipes that still have placeholder TODO entries in .env.example

Skip it if

  • Projects that are not Python, since the scanner targets Python source files
  • Recipes where you want to hand-control every config value; the script writes values and rewrites some Python lines, so review the diff before committing
  • Production secrets handling: the skill manages declarations and defaults, not credential storage

Try asking

  • “Extract env vars from this recipe and update .env.example”
  • “Add load_dotenv to the package __init__.py and make sure python-dotenv is in pyproject.toml”
  • “Replace hardcoded model names like gemini-3.5-flash in agent.py with environment variables”
  • “Upgrade stale TODO entries in .env.example where the source now has a real default”
Step-by-step guide: how to use Extract Python Environment VariablesInstall, first run, examples, tips and FAQs

Install in 3 steps

  1. 1

    Download the skill

    The ZIP contains the 2 original files, the Apache-2.0 licence and an attribution note.

    extract-python-environment-variables.zip
  2. 2

    Add it to your agent

    Claude Code (all projects)

    mkdir -p ~/.claude/skills && unzip extract-python-environment-variables.zip -d ~/.claude/skills/

    Claude Code / Agent SDK (this project only)

    mkdir -p .claude/skills && unzip extract-python-environment-variables.zip -d .claude/skills/

    Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.

  3. 3

    Ask for the task

    No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.

Get better results

  • Review the git diff after running, especially changes to __init__.py and model-name replacements in Python files
  • Keep hand-written .env.example lines; the skill is documented to leave user-authored lines untouched, but verify this on your recipe
  • Run the recipe's tests after the rewrite to confirm the os.getenv changes behave as expected

What's inside

  • SKILL.md
  • tests/conftest.py

Redistributed unmodified from google/adk-recipes under the Apache-2.0 licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.