Skills

Capture Environment

Snapshot the computational environment for a replication package, detects the analysis...

Install

npx skills add pedrohcgs/claude-code-my-workflow --skill capture-environment -g -a claude-code -y
Category
Engineering
Updated
1mo ago
License
MIT
Context cost
Mediumabout 2,588 tokens
Runs scripts
No, instructions only

What it does

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.

/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

Read the whole SKILL.md on GitHub

More in Engineering