managing-python-dependencies
Ensures proper Python dependency management, avoiding global `pip install` and adhering to project-specific tooling. Use this skill if any of the following are true: 1. Attempting to run `pip install {package_name}`. 2. Python packages or dependencies need to be added or modified. 3. Initiating a new Python project. 4. Installing missing packages inside a notebook or Python project. 5. Generating Python code that includes `import` statements for third-party libraries. 6. Before executing Python scripts via the terminal to ensure the correct virtual environment is active.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-15
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- managing-python-dependencies
- license
- Apache-2.0
- metadata
- { "version": "v3", "publisher": "google" }
- description
- Ensures proper Python dependency management, avoiding global `pip install` and adhering to project-specific tooling. Use this skill if any of the following are true: 1. Attempting to run `pip install {package_name}`. 2. Python packages or dependencies need to be added or modified. 3. Initiating a new Python project. 4. Installing missing packages inside a notebook or Python project. 5. Generating Python code that includes `import` statements for third-party libraries. 6. Before executing Python scripts via the terminal to ensure the correct virtual environment is active.
03 SKILL.md 正文
Python Dependency Management Rule
[!CAUTION]
BEFORE any
pip install: You MUST first detect the project's existing dependency manager and use it correctly. Do NOT override the project's established tooling.
[!NOTE]
Reactive Environment Check Bundling (Only When Installing): Do NOT run environment or package availability checks (
importlib.util.find_spec,pip list,ls uv.lock...) proactively before writing code or creating a notebook. Only probe the environment when a package actually needs to be installed (for example, onModuleNotFoundError/ImportErroror an explicit user request to install dependencies).
- In Notebooks: When a notebook cell execution tool (
execute_cell/notebook_execute_cell) is available, check package availability (import <pkg>or%pip list) and install missing packages (%pip install) inside notebook cells, never viapython3 -corpipin the shell.- In the Shell (Only When Installing): When a shell check is required before installing a missing package for a local script or project, you MUST NOT run multiple sequential 1-line shell check commands. Combine all environment and package availability probes into a single composite python one-liner or shell check step:
python3 -c "import sys, importlib.util; print(f'Python {sys.version.split()[0]}'); [(print(f'{pkg}: {__import__(pkg).__version__}') if importlib.util.find_spec(pkg) else print(f'{pkg}: not found')) for pkg in ['pyspark', 'google.cloud.bigquery']]"This bundling also applies to dependency manager detection; when an install is needed, use a single
lsorfindcommand to check for all potential dependency manager configuration and lock files at once (e.g.ls uv.lock poetry.lock Pipfile.lock requirements.txt pyproject.toml).
Dependency Manager Detection (Only When Installing)
Only run dependency manager detection when a package actually needs to be
installed (e.g., on ModuleNotFoundError / ImportError or when setting up a
missing local project environment)—never as an upfront pre-flight check before
creating or running a notebook. Before installing ANY Python package, check the
workspace for these files in priority order:
- Signal:
uv.lockorpyproject.tomlwith[tool.uv]- Tool: uv
- Install:
uv add <package> - Setup:
uv sync
- Signal:
pyproject.tomlwith[tool.poetry]- Tool: Poetry
- Install:
poetry add <package> - Setup:
poetry install
- Signal:
Pipfile- Tool: Pipenv
- Install:
pipenv install <package> - Setup:
pipenv install
- Signal:
environment.yml- Tool: Conda
- Install:
conda install <package> - Setup:
conda env create -f environment.yml
- Signal:
requirements.txtonly- Tool: venv + pip
- Install:
.venv/bin/pip install <package> - Setup:
.venv/bin/pip install -r requirements.txt
- Signal: None of the above
- Tool: venv + pip (default)
- Install:
.venv/bin/pip install <package> - Setup:
.venv/bin/pip install -r requirements.txt
Default: venv + pip
If no dependency manager is detected, use venv + pip + requirements.txt as the default:
# Initialize environment
python3 -m venv .venv
# Add dependencies
.venv/bin/pip install <package>
# Preserve state
.venv/bin/pip freeze > requirements.txt
Rules for venv + pip workflow:
- Always use
.venv/bin/pipor.venv/bin/python(explicit path). - After installing, run:
.venv/bin/pip freeze > requirements.txt. - When setting up:
.venv/bin/pip install -r requirements.txt.
Prohibited
- NEVER run
pip installglobally - NEVER override an existing dependency manager with a different one
04 同仓库更多 Skills
rag-architect-agent
Agente Arquiteto de RAG, Embeddings & Busca Vetorial. Especialista em design e implementação de pipelines de Retrieval-Augmented Generation de alta fidelidade: chunking semântico, modelagem pgvector no PostgreSQL (Neon/Supabase), busca híbrida (cosseno + BM25), reranking, validação via TypeSafe AI e filosofia Ponytail (anti-overengineering).
rag-architecture-patterns
Padrões arquiteturais e implementação de pipelines RAG (Retrieval-Augmented Generation) de alta fidelidade para qualquer projeto ou sistema. Cobre chunking semântico, embeddings, busca híbrida (pgvector + BM25), reranking, validação via TypeSafe AI e filosofia Ponytail (anti-overengineering).
skill-repair
Use this to fix and re-install agent skills that have failed installation. This skill provides the necessary context and permissions to surgically update the `manifest.json` after a fix has been applied.
security-scan
Scan your Claude Code configuration (.claude/ directory) for security vulnerabilities, misconfigurations, and injection risks using AgentShield. Checks CLAUDE.md, settings.json, MCP servers, hooks, and agent definitions.
security-review
Use this skill when adding authentication, handling user input, working with secrets, creating API endpoints, or implementing payment/sensitive features. Provides comprehensive security checklist and patterns.
security-bounty-hunter
Hunt for exploitable, bounty-worthy security issues in repositories. Focuses on remotely reachable vulnerabilities that qualify for real reports instead of noisy local-only findings.