manage-renv-dependencies
Acerca de
Esta habilidad gestiona las dependencias de paquetes R utilizando renv para crear entornos reproducibles. Cubre la inicialización, los flujos de trabajo de snapshot/restauración, la resolución de problemas y la integración con CI/CD. Úsela al configurar nuevos proyectos R, agregar/actualizar paquetes, restaurar entornos o solucionar problemas de restauración.
Instalación rápida
Claude Code
Recomendadonpx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/manage-renv-dependenciesCopia y pega este comando en Claude Code para instalar esta habilidad
Documentación
Manage renv Dependencies
Set up and maintain reproducible R package environments using renv.
When to Use
- Initializing dependency management for a new R project
- Adding or updating package dependencies
- Restoring a project environment on a new machine
- Troubleshooting renv restore failures
- Integrating renv with CI/CD pipelines
Inputs
- Required: R project directory
- Optional: Existing
renv.lockfile (for restore) - Optional: GitHub PAT for private packages
Procedure
Step 1: Initialize renv
renv::init()
This creates:
renv/directory (library, settings, activation script)renv.lock(dependency snapshot)- Updates
.Rprofileto activate renv on load
Got: Project-local library created. renv/ directory and renv.lock present. .Rprofile updated with activation script.
If fail: If it hangs, check network connectivity. If it fails on a specific package, install that package manually first with install.packages() and then rerun renv::init().
Step 2: Add Dependencies
Install packages as usual:
install.packages("dplyr")
renv::install("github-user/private-pkg")
Then snapshot to record the state:
renv::snapshot()
Got: renv.lock updated with new packages and their versions. renv::status() shows no out-of-sync packages.
If fail: If renv::snapshot() reports validation errors, run renv::dependencies() to check which packages are actually used, then renv::snapshot(force = TRUE) to bypass validation.
Step 3: Restore on Another Machine
renv::restore()
Got: All packages installed at the exact versions in renv.lock.
If fail: Common issues: GitHub packages fail (set GITHUB_PAT in .Renviron), system dependencies missing (install with apt-get on Linux), timeouts on large packages (set options(timeout = 600) before restore), or binaries not available (renv compiles from source; ensure build tools are installed).
Step 4: Update Dependencies
# Update a specific package
renv::update("dplyr")
# Update all packages
renv::update()
# Snapshot after updates
renv::snapshot()
Got: Target packages are updated to their latest compatible versions. renv.lock reflects the new versions after snapshot.
If fail: If renv::update() fails for a specific package, try installing it directly with renv::install("package@version") and then snapshot.
Step 5: Check Status
renv::status()
Got: "No issues found" or a clear list of out-of-sync packages with actionable guidance.
If fail: If status reports packages used but not recorded, run renv::snapshot(). If packages are recorded but not installed, run renv::restore().
Step 6: Configure .Rprofile for Conditional Activation
if (file.exists("renv/activate.R")) {
source("renv/activate.R")
}
This ensures the project works even if renv isn't installed (CI environments, collaborators).
Got: R sessions activate renv automatically when starting in the project directory. Sessions without renv installed still start without errors.
If fail: If .Rprofile causes errors, ensure the file.exists() guard is present. Never call source("renv/activate.R") unconditionally.
Step 7: Git Configuration
Track these files:
renv.lock # Always commit
renv/activate.R # Always commit
renv/settings.json # Always commit
.Rprofile # Commit (contains renv activation)
Ignore these (already in renv's .gitignore):
renv/library/ # Machine-specific
renv/staging/ # Temporary
renv/cache/ # Machine-specific cache
Got: renv.lock, renv/activate.R, and renv/settings.json are tracked by Git. Machine-specific directories (renv/library/, renv/cache/) are ignored.
If fail: If renv/library/ accidentally gets committed, remove it with git rm -r --cached renv/library/ and add it to .gitignore.
Step 8: CI/CD Integration
In GitHub Actions, use the renv cache action:
- uses: r-lib/actions/setup-renv@v2
This automatically restores from renv.lock with caching.
Got: CI pipeline restores packages from renv.lock with caching enabled. Subsequent runs are faster due to cached packages.
If fail: If CI restore fails, check that renv.lock is committed and up to date. For private GitHub packages, ensure GITHUB_PAT is set as a repository secret.
Validation
-
renv::status()reports no issues -
renv.lockis committed to version control -
renv::restore()works on a clean checkout -
.Rprofileconditionally activates renv - CI/CD uses
renv.lockfor dependency resolution
Pitfalls
- Running
renv::init()in wrong directory: Always verifygetwd()first - Mixing renv and system library: After
renv::init(), only use the project library - Forgetting to snapshot: After installing packages, always run
renv::snapshot() --vanillaflag:Rscript --vanillaskips.Rprofile, so renv won't activate- Large lock files in diffs: Normal —
renv.lockis designed to be diffable JSON - Bioconductor packages: Use
renv::install("bioc::PackageName")and ensure BiocManager is configured
Related Skills
create-r-package- includes renv initializationsetup-github-actions-ci- CI integration with renvsubmit-to-cran- dependency management for CRAN packages
Repositorio GitHub
Frequently asked questions
What is the manage-renv-dependencies skill?
manage-renv-dependencies is a Claude Skill by pjt222. Skills package instructions and resources that Claude loads on demand, so Claude can perform manage-renv-dependencies-related tasks without extra prompting.
How do I install manage-renv-dependencies?
Use the install commands on this page: add manage-renv-dependencies to Claude Code as a plugin, or clone its repository into your skills directory, then restart Claude so it picks up the skill.
What category does manage-renv-dependencies belong to?
manage-renv-dependencies is in the Other category, tagged ai, api and automation.
Is manage-renv-dependencies free to use?
Yes. manage-renv-dependencies is listed on AIMCP and free to install. It runs inside Claude, so no separate service account is required to use the skill itself.
Habilidades relacionadas
LlamaGuard es el modelo de Meta de 7-8B parámetros para moderar las entradas y salidas de LLM en seis categorías de seguridad como violencia y discurso de odio. Ofrece una precisión del 94-95% y puede implementarse usando vLLM, Hugging Face o Amazon SageMaker. Utiliza esta skill para integrar fácilmente filtrado de contenido y barreras de seguridad en tus aplicaciones de IA.
Esta Skill de Claude ayuda a los desarrolladores a optimizar los costes en la nube mediante el ajuste de tamaño de recursos, estrategias de etiquetado y análisis de gastos. Proporciona un marco para reducir los gastos en la nube e implementar una gobernanza de costes en AWS, Azure y GCP. Úsala cuando necesites analizar los costes de infraestructura, ajustar el tamaño de los recursos o cumplir con restricciones presupuestarias.
Esta habilidad de Claude analiza los mercados de apuestas deportivas, incluyendo spreads, over/unders y apuestas de propuestas, mediante el examen de tendencias históricas y estadísticas situacionales para identificar apuestas de valor. Proporciona una salida en markdown estructurado con recomendaciones accionables con fines educativos. Los desarrolladores deben utilizar esto para herramientas de análisis de apuestas deportivas, teniendo en cuenta que está diseñado únicamente para entretenimiento/educación.
Esta habilidad cuantiza LLMs a precisión de 8 o 4 bits utilizando bitsandbytes, logrando una reducción de memoria del 50-75% con pérdida mínima de precisión. Es ideal para ejecutar modelos más grandes en memoria GPU limitada o para acelerar la inferencia, admitiendo formatos como INT8, NF4 y FP4. La habilidad se integra con HuggingFace Transformers y permite entrenamiento QLoRA y optimizadores de 8 bits.
