python-venv

python-venv is a skill for Claude Code, Codex from mir-am/skills-agents-ai-coding. It costs 28 tokens per session (1,694 once invoked), scanned A, original, MIT.

A project setup workflow for creating or reusing a Python virtual environment named .venv. A virtual environment keeps a project's Python packages separate from other projects.

In plain words
What is it for?
Use it to prepare a Python project-local environment, verify its interpreter, and ensure the repository's .gitignore excludes .venv/.
Why use it?
It prevents the environment directory from being committed to Git and avoids replacing a working environment or its packages. It does not install project dependencies.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to prepare a Python project-local environment, verify its interpreter, and ensure the repository's .gitignore excludes .venv/.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/mir-am/skills-agents-ai-coding/python-venv
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add mir-am/skills-agents-ai-coding --skill python-venv
Clone the repo
git clone --depth 1 https://github.com/mir-am/skills-agents-ai-coding

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for python-venv

README.md
[![agentmods](https://agentmods.dev/badge/skills/mir-am/skills-agents-ai-coding/python-venv/github.svg)](https://agentmods.dev/skills/mir-am/skills-agents-ai-coding/python-venv)
Your own site
<a href="https://agentmods.dev/skills/mir-am/skills-agents-ai-coding/python-venv"><img src="https://agentmods.dev/badge/skills/mir-am/skills-agents-ai-coding/python-venv/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for python-venv

Your own site · 80×15
<a href="https://agentmods.dev/skills/mir-am/skills-agents-ai-coding/python-venv"><img src="https://agentmods.dev/badge/skills/mir-am/skills-agents-ai-coding/python-venv.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,694 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00028 $0.01694
Opus 5.5 $0.00011 $0.00678
Sonnet 5.5 $0.00006 $0.00339
Haiku 4.5 $0.00003 $0.00169

Measured 14d ago against content hash 85730ddc950b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

python-venv scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 14d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Runs shell commandslowCapability

Expected in a hook, worth knowing in a rule or an instructions file.

result = subprocess.run(
skills/python-venv/SKILL.md · 133 lines

How it starts

The opening of the file, as written. The whole thing — 133 lines — stays where its author put it; the contents beside it link to each section on GitHub.

What I do

  • Create .venv in the project root using an available Python 3 interpreter
  • Reuse a working environment without recreating it or changing its packages
  • Preserve existing files when .venv is not a valid virtual environment
  • Ensure the root .gitignore excludes .venv/, preserving existing content
  • Verify the environment's interpreter and Git ignore behavior

When to use me

Use when setting up a project-local Python virtual environment or ensuring an existing .venv stays out of Git. This workflow requires Git and a Bash-compatible POSIX environment with Python 3; it does not install project dependencies or commit changes.

Workflow

1. Locate the project and interpreter

Read project instructions and any Python version requirements first. Use the Git working-tree root as the project root, including when invoked from a subdirectory. For an explicitly selected nested project, resolve its location before adapting the paths below. If there is no Git working tree, report that prerequisite instead of initializing a repository.

For a new environment, prefer a user-specified or project-required interpreter when available. The command below tries python3, then python, accepting only Python 3 with the standard-library venv module. Adjust the candidate list for a required version or a discovered versioned executable such as python3.12; do not silently substitute an incompatible version. Reuse an existing valid environment even if no separate Python executable is on PATH; report any conflict with the project's Python requirement.

2. Create or reuse, exclude, and verify

Run this block with Bash. It stops before changing an invalid .venv, a symlink at .venv or .gitignore, or an environment already tracked by Git. Normal interpreter symlinks inside a virtual environment are supported.

(
set -e
venv_project_root=$(git rev-parse --show-toplevel)
cd "$venv_project_root"

if [ -L .venv ] || [ -L .gitignore ]; then
  echo 'Stop: .venv or .gitignore is a symlink; preserve it and resolve the target first.' >&2
  exit 1
fi
if [ -e .gitignore ] && [ ! -f .gitignore ]; then
  echo 'Stop: .gitignore is not a regular file; leaving it unchanged.' >&2
  exit 1
fi
venv_tracked=$(git ls-files -- .venv)
if [ -n "$venv_tracked" ]; then
  echo 'Stop: .venv has tracked files; ignore rules cannot untrack them.' >&2
  exit 1
fi

verify_venv() {
  [ -f .venv/pyvenv.cfg ] && [ -x .venv/bin/python ] &&
    .venv/bin/python -I -c 'import pathlib, sys; expected = pathlib.Path(".venv").resolve(); sys.exit(0 if sys.version_info.major == 3 and sys.prefix != sys.base_prefix and pathlib.Path(sys.prefix).resolve() == expected else 1)'
}

if [ -e .venv ]; then
  if ! verify_venv; then
    echo 'Stop: existing .venv is not a working Python 3 virtual environment; preserved unchanged.' >&2
    exit 1
  fi
  echo 'Reusing .venv'
else
  venv_python=''
  for venv_candidate in python3 python; do
    if command -v "$venv_candidate" >/dev/null 2>&1 &&
       "$venv_candidate" -I -c 'import sys, venv; sys.exit(0 if sys.version_info.major == 3 else 1)' >/dev/null 2>&1; then
      venv_python="$venv_candidate"
      break
    fi
  done
  if [ -z "$venv_python" ]; then
    echo 'Stop: no usable Python 3 with the venv module found.' >&2
    exit 1
  fi
  "$venv_python" -m venv .venv
  verify_venv
  echo 'Created .venv'
fi

.venv/bin/python -I - <<'PY'
from pathlib import Path
import subprocess

def ignored_by_root():
    result = subprocess.run(
        ["git", "check-ignore", "--no-index", "-v", "-z", "--stdin"],
        input=b".venv/\0", stdout=subprocess.PIPE, check=False,
    )
    if result.returncode not in (0, 1):
        raise SystemExit("Stop: git check-ignore failed.")
    fields = result.stdout.split(b"\0")
    return (len(fields) == 5 and fields[0] == b".gitignore"
            and bool(fields[2]) and not fields[2].startswith(b"!"))

ignore = Path(".gitignore")
if not ignored_by_root():
    content = ignore.read_bytes() if ignore.exists() else b""
    newline = b"\r\n" if b"\r\n" in content else b"\n"
    separator = b"" if not content or content.endswith(b"\n") else newline
    with ignore.open("ab") as stream:
        stream.write(separator + b".venv/" + newline)
    print("Added .venv/ to root .gitignore")
else:
    print("Root .gitignore already excludes .venv/")
if not ignored_by_root():
    raise SystemExit("Stop: root .gitignore does not exclude .venv/.")
PY

verify_venv
.venv/bin/python -I -c 'import sys; print("Interpreter:", sys.executable); print("Version:", sys.version.split()[0]); print("Environment:", sys.prefix)'
git check-ignore -q -- .venv/pyvenv.cfg
git check-ignore -v -- .venv/ .venv/pyvenv.cfg
)

Read the full file on GitHub · 133 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 14d ago First seen · 133 lines · 28 tokens per session scan A 85730ddc950b

Subscribe to this mod's changes

python-venv is a skill published in the GitHub repository mir-am/skills-agents-ai-coding (2 stars, last pushed 15d ago), licensed MIT. It adds 28 tokens to every session and 1,694 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 1 finding (runs shell commands). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-02.

Related

Other skills, from other repositories

python-release

Handle Python SDK release, build, bump, packaging metadata, PyPI client pin, uv.lock, nox/build workflow, and publish verification changes. Use for Python release process work or dependency pin bumps; do not use for ordinary Python feature implementation.

ComposioHQ/composio · 53 tokens

writing-friday-python-agents

Authoring guide for Python user agents (type:"user") on the Friday platform via the friday-agent-sdk. Covers the @agent decorator, AgentContext capabilities (ctx.llm, ctx.http, ctx.tools, ctx.stream), structured input parsing, result types, and the NATS subprocess execution model. Load when an agent.py exists in…

friday-platform/friday-studio · 131 tokens

performant-python

Strategies for high-performance Python systems (FastAPI, Asyncio, UVloop, Memory Optimization).

andreibesleaga/GABBE · 23 tokens

project-graveyard

Scans the developer's machine for dead side projects, autopsies each one from its git history (died at the payments wall, killed by a newer project, finished but never shipped), surfaces their personal death patterns, and picks the corpse most worth resurrecting — then helps ship it. Use when the user mentions…

Shubhamsaboo/awesome-llm-apps · 127 tokens

commit-archaeologist

Reconstructs why code exists from local git history, including the introducing commit, later changes, current authors, repeated companion files, and likely intent. Use when the user asks "why does this code exist", "who wrote this function and why", or to "explain the history of this function" before a rewrite…

Shubhamsaboo/awesome-llm-apps · 82 tokens

scope-creep-detector

Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad pull requests, changes that grew beyond a fix, dependency additions, public API renames, config or CI edits, oversized hunks, and formatting-only files. Use when the user asks whether a change grew beyond the fix, a PR is too…

Shubhamsaboo/awesome-llm-apps · 98 tokens