Agent skill

Capture Environment

by pedrohcgs in pedrohcgs/claude-code-my-workflow

Snapshot the computational environment for a replication package — detects the analysis stack (R / Stata / Python) and emits the right lockfiles (renv.lock + sessionInfo.txt, requirements.txt /…

MITAuto-check: notesResearch & Science

Install Capture Environment

skills CLI
$ npx skills add pedrohcgs/claude-code-my-workflow --skill capture-environment -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install pedrohcgs/claude-code-my-workflow capture-environment --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/pedrohcgs/claude-code-my-workflow.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/capture-environment .claude/skills/capture-environment && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
capture-environment
GitHub stars
1.7k
Token cost
~2.8k tokens
SKILL.md length
1,153 words
Files
1
Skills in repo
59
Repo updated
First seen
Licence
MIT

At a glance

Snapshot the computational environment for a replication package — detects the analysis stack (R / Stata / Python) and emits the right lockfiles (renv.lock + sessionInfo.txt, requirements.txt /…

  • Works in 5 steps: Detect the stack → Capture per language → Dockerfile (only with --docker) → …
  • User says capture the environment
  • SKILL.md covers When to use, Inputs, Workflow and Output / artifacts, plus 3 more sections
  • Calls uv, pip and python

What it does

Capture Environment is an agent skill from pedrohcgs/claude-code-my-workflow. Snapshot the computational environment for a replication package — detects the analysis stack (R / Stata / Python) and emits the right lockfiles (renv.lock + sessionInfo.txt, requirements.txt / environment.yml / uv.lock, Stata version + ado package list), records seeds and RNG kind, optionally writes a pinning Dockerfile, and produces a paste-ready "Computational requirements" block. Use when user says "capture the environment", "snapshot my dependencies", "pin the versions", "make a renv.lock /…

Its SKILL.md is about 2.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Research & Science, covering Econometrics and empirical research, Containers and Dependency management. It works with Docker and Python. The repository describes itself as: A ready-to-fork Claude Code template for academics using LaTeX/Beamer + R. Multi-agent review, quality gates, adversarial QA, and replication protocols. The licence is MIT.

When your agent uses it

  • User says capture the environment
  • Snapshot my dependencies
  • Pin the versions
  • Make a renv.lock / requirements.txt

Example prompts

  • “Computational requirements”
  • “capture the environment”
  • “snapshot my dependencies”
  • “/capture-environment”

Requirements

  • Python 3
  • Docker
  • Pre-approved tools (allowed-tools): Read, Grep, Glob, Write, Bash

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Detect the stack
  2. Capture per language
  3. Dockerfile (only with --docker)
  4. Verify the lockfile installs clean (best-effort; skip with --no-verify)
  5. Report

What it can do on your machine

Read from SKILL.md and the folder at commit ae72617. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Grep
    • Glob
    • Write
    • Bash

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • uv
    • pip
    • python
    • conda
    • apt-get
    • docker

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • aeadataeditor.github.io
    • openicpsr.org

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Capture Environment loads about 2.8k tokens when it runs. Until then it costs about 162 tokens; SKILL.md has 1,153 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~162
When it runs · the whole SKILL.md, loaded when a task matches
~2.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Grep, Glob, Write, Bash

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from pedrohcgs/claude-code-my-workflow at commit ae72617, republished under its MIT licence (© pedrohcgs). 1,153 words, ~2,799 tokens.

Download SKILL.mdSave it as .claude/skills/capture-environment/SKILL.md (or your agent's skills folder).
name
capture-environment
description
Snapshot the computational environment for a replication package — detects the analysis stack (R / Stata / Python) and emits the right lockfiles (renv.lock + sessionInfo.txt, requirements.txt / environment.yml / uv.lock, Stata version + ado package list), records seeds and RNG kind, optionally writes a pinning Dockerfile, and produces a paste-ready "Computational requirements" block. Use when user says "capture the environment", "snapshot my dependencies", "pin the versions", "make a renv.lock / requirements.txt", "make this byte-reproducible", or before releasing a replication package to openICPSR / the AEA Data Editor.
allowed-tools
Read, Grep, Glob, Write, Bash
argument-hint
[project-dir] [--docker] [--no-verify] (project-dir defaults to repo root)
effort
medium

/capture-environment — snapshot the computational environment

A replication package that runs on the author's laptop in 2026 and nowhere else in 2029 is not reproducible. This skill captures the exact computational environment — language versions, package versions, seeds, RNG kind, and (optionally) the OS layer — so a referee, the AEA Data Editor, or future-you can reconstruct it. It detects which stack the project uses and emits the artifacts that stack's ecosystem expects, then verifies the lockfile installs clean.

Core principle: Pin everything a result depends on. Display rounding aside, a re-run on a pinned environment should reproduce the paper to the replication-protocol.md tolerances — byte-identical when the optional Dockerfile is used.

When to use

  • Before releasing a replication package to openICPSR, Zenodo, Dataverse, or a journal archive — the AEA Data Editor / DCAS standard expects a documented, version-pinned environment.
  • Before submission, alongside /audit-reproducibility — that skill checks the numbers; this one captures the environment those numbers were produced in (its sessionInfo.txt requirement is satisfied by this skill).
  • After adding or upgrading a package mid-project — re-snapshot so the lockfile doesn't drift from what the code actually loads.
  • When handing a project to a co-author or RA who needs to reconstruct your stack.

Inputs

  • $0 — project directory. Defaults to the repo root. The skill looks under scripts/R/, scripts/stata/, scripts/python/.
  • --docker — also emit a Dockerfile pinning OS + language version + system libraries for byte-identical reproduction.
  • --no-verify — skip Phase 3 (the best-effort clean-install check). Useful in CI or when the toolchain isn't installed locally.

Workflow

Phase 0: Detect the stack

Glob for stack signals and decide which capture paths to run (a project may be multi-language — DiD in R, an IV robustness check in Stata):

SignalStackCapture path
scripts/R/*.R, DESCRIPTION, renv/, *.RprojRrenv + sessionInfo
scripts/python/*.py, *.ipynb, pyproject.toml, requirements.txt, environment.yml, uv.lockPythonpip / conda / uv
scripts/stata/*.doStataversion + ado list

If no signal is found, report and stop — there is no environment to capture.

Phase 1: Capture per language

R — emit two artifacts:

  • renv.lock via renv::snapshot() (run renv::init(bare = TRUE) first if the project isn't renv-managed; snapshot records every package + version + source/remote and the R version). Honors the seed conventions in r-code-conventions.md.
  • sessionInfo.txt via Rscript -e "writeLines(capture.output(sessionInfo()), 'output/sessionInfo.txt')" — the human-readable companion /audit-reproducibility looks for.

Python — emit whichever matches the project's existing tooling (do not invent a new one):

  • uv.lock (preferred when pyproject.toml + uv present — fully-resolved, hashed, cross-platform): uv lock / uv export --format requirements-txt > requirements.txt.
  • requirements.txt via pip freeze (or python -m pip freeze) for a venv/pip project — pin == exactly.
  • environment.yml via conda env export --no-builds for a conda project. Always also record the interpreter version (python --version) in the report.

Stata — Stata has no lockfile, so capture the closest equivalents (mirrors stata-code-conventions.md §3):

  • The pinned version line each .do file declares (e.g. version 18) — grep scripts/stata/*.do and report the version actually pinned.
  • An ado/plus package inventory: a small .do that runs which on the user-installed commands the pipeline uses (reghdfe, ivreg2, estout/esttab, rdrobust, csdid, …) plus ado dir and about, logged to output/sessionInfo_stata.txt.
  • A note that Stata version pinning is semantic (version 18 fixes command behavior), not a binary pin — the Dockerfile (Phase 2) cannot help here because Stata is licensed and not redistributable; record the exact Stata version + flavor (SE/MP/IC) + update level in the report so a replicator can match it.
Phase 1b: Record seeds and RNG

Grep the analysis scripts for the master seed and RNG kind so the "Computational requirements" block can state them:

  • R: set.seed(YYYYMMDD), and RNGkind() — flag "L'Ecuyer-CMRG" if parallel/Monte Carlo work is present (see simulation-conventions.md).
  • Stata: set seed and set sortseed.
  • Python: numpy.random.default_rng(seed) / random.seed() / framework seeds.

If the pipeline does randomized work (bootstrap, MC, RCT re-randomization, permutation inference) and no seed is found, surface it as a WARNING — an unseeded random result is not reproducible.

Phase 2: Dockerfile (only with --docker)

Emit a Dockerfile that pins the OS + language version + system libraries for byte-identical reproduction:

  • R → FROM rocker/r-ver:<X.Y.Z> (Rocker pins the R version), COPY renv.lock, RUN R -e "renv::restore()", plus apt-get install for system libs the packages need (e.g. libcurl4-openssl-dev, libgdal-dev for spatial work).
  • Python → FROM python:<X.Y.Z>-slim, COPY requirements.txt / uv.lock, RUN pip install -r requirements.txt (or uv sync --frozen).
  • Stata → cannot pin the licensed binary; emit a Dockerfile stub that documents the expected Stata version + flavor and leaves the stata install/license step to the replicator (with a comment pointing at the AEA's guidance on Stata images).

Pin a digest where possible (FROM image@sha256:…) so the base image can't drift.

Show full SKILL.md (419 more words)Show less
Phase 3: Verify the lockfile installs clean (best-effort; skip with --no-verify)

Attempt a clean restore in a throwaway location and report PASS / FAIL — never overwrite the working environment:

  • R: renv::restore() into a temp library, or Rscript -e "renv::status()" for a dry check.
  • Python: uv sync --frozen / pip install --dry-run -r requirements.txt into a fresh venv.
  • Docker (if --docker): docker build the image.

A FAIL here means the lockfile references a package version that can't be resolved (yanked release, private remote, platform-specific wheel). Report it; do not auto-edit the lockfile.

Phase 4: Report

Print a paste-ready block and write it to output/computational_requirements.md:

markdown
## Computational requirements

**Software:** R 4.4.1 (or: Stata 18.0 SE, update 2026-01-15; Python 3.12.3)
**OS used:** macOS 15.5 (arm64) — Dockerfile pins Ubuntu 24.04 for portability
**Key packages:** fixest 0.12.1, did 2.1.2 (full list in renv.lock)
**Random seeds:** set.seed(20260609); RNGkind("L'Ecuyer-CMRG") for the bootstrap
**Approx. runtime:** [author confirms — e.g. ~12 min, 8 cores]
**Lockfiles in package:** renv.lock, output/sessionInfo.txt[, Dockerfile]

Pre-fill software/package/seed lines from the captured artifacts; leave runtime for the author to confirm.

Output / artifacts

StackFiles written
Rrenv.lock, output/sessionInfo.txt
Pythonrequirements.txt or environment.yml or uv.lock (matching project tooling)
Stataoutput/sessionInfo_stata.txt (version + ado list; named so it does not overwrite R's in a mixed project)
Any (--docker)Dockerfile
Alwaysoutput/computational_requirements.md (the paste-ready block)

Exit behavior

  • All captures succeeded, verify PASS (or --no-verify): exit 0, requirements block printed.
  • A missing-seed WARNING on a randomized pipeline: exit 0 with the warning surfaced — reproducibility is compromised but the snapshot still wrote.
  • Verify FAIL (lockfile won't resolve): exit 1, so the skill can gate a pre-release /commit. Report the unresolvable package; do not silently "fix" the lockfile.
  • No stack detected in Phase 0: exit 1 with the directories searched.

Cross-references

What this skill does NOT do

  • Re-run your analysis or check your numbers. It captures the environment; /audit-reproducibility verifies the manuscript's numeric claims against the outputs.
  • Package or de-identify data. Lockfiles describe software, not data. Disclosure avoidance, de-identification, and data-availability statements are out of scope — see confidential-data.md.
  • Upgrade or "fix" your dependencies. It records what the code currently uses. If a verify FAIL surfaces a yanked version, you decide whether to pin an alternative.
  • Pin a Stata binary. Stata is licensed and not redistributable; the skill records the exact version/flavor/update so a replicator can match it, but cannot containerize it.

© pedrohcgs, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/capture-environment of pedrohcgs/claude-code-my-workflow.

Open the folder on GitHubat commit ae72617

Compare with similar skills

Capture Environment next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Capture Environment compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Capture Environment this skillpedrohcgs/claude-code-my-workflow1.7k—~2.8kAutomated safety check: NotesMIT
Flowfile Build and Environment SetupEdwardvaneechoud/Flowfile375—~7.3kAutomated safety check: NotesMIT
Megatron-LM Container and Dependency SetupNVIDIA/Megatron-LM18k—~2.6kAutomated safety check: PassApache-2.0
Minimegasandia-minimega/minimega160—~3.2kAutomated safety check: PassGPL-3.0-only
Unraiddinglebear-ai/unraid135—~5.4kAutomated safety check: NotesMIT
Cyberowlaikarimhabush/cyberowl263—~2.5kAutomated safety check: PassMIT

Similar skills

  • Flowfile Build and Environment Setup

    Edwardvaneechoud/Flowfile

    Recreates every Flowfile development and build environment from scratch, with exact version pins and an explanation of what each Makefile target really does.

    375 GitHub stars~7.3k tokensUpdated today
    DevelopmentAuto-check: notes
  • Official

    Walks an agent through working inside the Megatron-LM CI container and changing dependencies with uv, so lock files resolve the same locally and in CI.

    18k GitHub stars~2.6k tokensUpdated today
    DevelopmentAuto-check passed
  • Minimega

    sandia-minimega/minimega

    This skill should be used when the user asks how to configure, run, automate, integrate, or troubleshoot minimega (VMs, namespaces, VLANs, clusters, miniccc, miniweb, command socket or Python API…

    160 GitHub stars~3.2k tokensUpdated 3 days ago
    DevOps & CloudAuto-check passed
  • Unraid

    dinglebear-ai/unraid

    This skill should be used when the user mentions Unraid, asks to check server health, monitor array or disk status, list or restart Docker containers, start or stop VMs, read system logs, check…

    135 GitHub stars~5.4k tokensUpdated 5 days ago
    DevOps & CloudAuto-check: notes
  • Cyberowlai

    karimhabush/cyberowl

    Check if recent cybersecurity alerts from 10 international CERTs affect your current project.

    263 GitHub stars~2.5k tokensUpdated yesterday
    SecurityAuto-check passed
  • Generate Nemo Gym Env

    adithya-s-k/FineEnvs

    Builds a NeMo Gym (NVIDIA) variant of an RL environment. An agent skill from adithya-s-k/FineEnvs.

    456 GitHub stars~2.1k tokensUpdated yesterday
    DevOps & CloudAuto-check passed

More from pedrohcgs/claude-code-my-workflow

All 59 skills in this repo
  • Devils Advocate

    pedrohcgs/claude-code-my-workflow

    Adversarial 5-7 question challenge to a deck's pedagogical choices — ordering, prerequisites, cognitive load, motivation.

    1.7k GitHub starsUsed in 2 repos~641 tokens
    Auto-check passed
  • Vaccinate

    pedrohcgs/claude-code-my-workflow

    Qualify a check before it is allowed to clear anything — prove it can detect the failure it is meant to catch.

    1.7k GitHub stars~2.1k tokensUpdated 12 days ago
    Auto-check: notes
  • Compile Latex

    pedrohcgs/claude-code-my-workflow

    Compile a Beamer LaTeX slide deck with XeLaTeX (3 passes + bibtex).

    1.7k GitHub starsUsed in 1 repo~492 tokens
    Auto-check: notes
  • Context Status

    pedrohcgs/claude-code-my-workflow

    Show current context status and session health. An agent skill from pedrohcgs/claude-code-my-workflow.

    1.7k GitHub starsUsed in 1 repo~613 tokens
    Auto-check: notes
  • Checkpoint

    pedrohcgs/claude-code-my-workflow

    Save a structured state snapshot before stopping or handing off.

    1.7k GitHub stars~2.8k tokensUpdated 12 days ago
    Auto-check: notes
  • Coauthor Brief

    pedrohcgs/claude-code-my-workflow

    Generate a co-author / collaborator handoff brief for a multi-author, multi-machine project — summarizing what changed since the last brief (git delta), the current state of each artifact…

    1.7k GitHub stars~2.9k tokensUpdated 12 days ago
    Auto-check: notes

Works with

Questions about Capture Environment

What does Capture Environment do?

Snapshot the computational environment for a replication package — detects the analysis stack (R / Stata / Python) and emits the right lockfiles (renv.lock + sessionInfo.txt, requirements.txt /…. Capture Environment is an agent skill from pedrohcgs/claude-code-my-workflow.lock, Stata version + ado package list), records seeds and RNG kind, optionally writes a pinning Dockerfile, and produces a paste-ready "Computational requirements" block.

When should I use Capture Environment?

Capture Environment fits situations like: user says capture the environment; snapshot my dependencies; pin the versions; make a renv.lock / requirements.txt.

How do I install Capture Environment in Claude Code?

Run `npx skills add pedrohcgs/claude-code-my-workflow --skill capture-environment -a claude-code`. Or copy the skill folder (.claude/skills/capture-environment in pedrohcgs/claude-code-my-workflow) into .claude/skills/capture-environment in your project. Claude Code loads it when a task matches its description.

How do I install Capture Environment in Codex?

Run `npx skills add pedrohcgs/claude-code-my-workflow --skill capture-environment -a codex`. Or copy the skill folder (.claude/skills/capture-environment in pedrohcgs/claude-code-my-workflow) into .agents/skills/capture-environment in your project. Codex loads it when a task matches its description.

Can I use Capture Environment in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add pedrohcgs/claude-code-my-workflow --skill capture-environment -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/capture-environment, .gemini/skills/capture-environment, .github/skills/capture-environment and .opencode/skills/capture-environment in your project.

What does Capture Environment need to run?

Going by SKILL.md and its folder, Capture Environment needs the command-line tools its instructions call (uv, pip, python, conda, apt-get and docker). Our summary lists: Python 3; Docker. Its frontmatter pre-approves these tools: Read, Grep, Glob, Write, Bash.

Does Capture Environment access the network?

SKILL.md names 2 domains. As links in the text: aeadataeditor.github.io and openicpsr.org. This is read from the text; nothing was executed.

Is Capture Environment safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Capture Environment use?

Capture Environment is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Capture Environment use?

About 2.8k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Capture Environment?

Skills that share tags, products or a category with Capture Environment: Flowfile Build and Environment Setup (Edwardvaneechoud/Flowfile, 375 stars), Megatron-LM Container and Dependency Setup (NVIDIA/Megatron-LM, 18k stars), Minimega (sandia-minimega/minimega, 160 stars) and Unraid (dinglebear-ai/unraid, 135 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Capture Environment?

pedrohcgs (a GitHub user) maintains it in pedrohcgs/claude-code-my-workflow, which has 1,653 GitHub stars. The repository holds 59 skills in this directory. The repository was last updated on September 27, 2026.

Source: pedrohcgs/claude-code-my-workflow on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.