/lab-skills:sync-projectfrom lab-skills
Sync project state when arriving at a new machine (local or cluster). Pulls git, updates conda env from environment.yml, restores renv packages, checks for memory promotion. Use when switching between local and cluster work, starting a session on a different machine, or when the user invokes /sync-project. Do NOT auto-load — this is a deliberate, user-initiated workflow.
Ships in lab-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Arrival-side sync for projects worked on across multiple machines (typically local macOS and Yale HPC cluster). Ensures git, conda, and renv are current before starting work.
This skill is arrival-only. Departure-side tasks (env export, commit, push) are
handled by /done.
Determine which machine we're on:
# Check for module command (cluster indicator)
type module &>/dev/null && echo "cluster" || echo "local"
hostname
Set the conda activation pattern based on environment:
source ~/miniconda3/etc/profile.d/conda.shmodule load miniconda && source $(conda info --base)/etc/profile.d/conda.shRead the project's .claude/CLAUDE.md to find:
git status --short
If uncommitted changes exist, stop and warn:
"You have uncommitted changes. Commit or stash before syncing?"
Do NOT proceed with git pull if there are uncommitted changes — this risks merge
conflicts that could lose work.
git fetch
git rev-list --left-right --count @{u}...HEAD # → "<behind> <ahead>"
Branch on the counts (do NOT blindly git pull — it silently merges on divergence):
| behind / ahead | Meaning | Action |
|---|---|---|
0 / 0 | Up to date | Report "Already up to date." Done. |
N / 0 | Remote ahead only | Fast-forward: git pull --ff-only. No decision needed. |
0 / N | Local ahead only | Nothing to pull. Note: "N local commit(s) not pushed — push via /done." |
N / M | Diverged (both sides have commits) | Go to 1c. |
Report what was updated (files changed, new files, deletions).
Reached only when both sides have commits.
git merge-tree --write-tree @{u} HEAD # exit 0 = clean; exit 1 = conflicts (lists files)
git pull --rebase): replays your commits on top of the remote → linear history. Safe because unshared commits can be rewritten. ← default recommendation.git pull): creates a merge commit; never rewrites shared history.If no environment.yml in the project root, skip this step.
head -1 environment.yml # name: my-env
conda env list | grep -q "env-name"
conda env create -f environment.ymlconda env update -f environment.yml --pruneThe --prune flag removes packages no longer in environment.yml.
conda activate env-name && python --version
Report the Python version and package count as a sanity check.
Skip if no renv.lock in the project root.
Rscript -e "renv::status()"
If packages are out of sync:
Rscript -e "renv::restore()"
Report what was installed/updated or "renv is in sync."
Scan for project-relevant memory files:
ls ~/.claude/projects/*<project-name>*/memory/ 2>/dev/null
Where <project-name> is a fuzzy match on the project directory name.
If memory files exist:
.claude/ planning
doc or CLAUDE.md so it's available on both machines?If no memory directory exists or it's empty, skip silently.
/sync-project complete
Git: pulled 3 files (scripts/01_busco.qmd, batch/run_busco.sh, ...)
Conda: spongilla-genome updated (2 packages added)
renv: in sync
Memory: 1 memory promoted to .claude/STRESS_TEST_FINDINGS.md
Ready to work.
These checks run as part of Step 2 but are documented here for reference.
When this skill reads environment.yml, flag these issues:
| Issue | Action |
|---|---|
prefix: line present | Warn — this is a machine-specific path that shouldn't be in git |
defaults in channels | Warn — conflicts with bioconda strict channel priority |
Missing conda-forge channel | Warn — needed for most scientific Python packages |
Missing bioconda channel | Note — only needed if bioinformatics tools are in conda |
These are warnings only — the skill does not auto-fix environment.yml during arrival.
Fixes happen at departure time (in /done) when exporting the environment.
/done)~/.claude sync (that's /sync-cluster)/sync-projectWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub musserlab/lab-claude-skills --plugin lab-skills34 skills in this plugin
/audit-projectPeriodic project health check - cross-check docs, prune conventions, find drift. Use when project documentation feels stale, before milestones, or when CLAUDE.md is getting long. Do NOT load for auditing skills (use /audit-skills) or data analysis scripts (use /audit-script).
/audit-scriptSystematic audit of data analysis scripts for bugs, analytical reasoning, data handling, style, and reproducibility. Includes domain verification phase that researches tools, file formats, and methods to catch domain-specific errors (not just code bugs). Use when auditing a script, reviewing code for correctness, checking for bugs, preparing a script for publication, or when the user says "audit this script", "review this code", "check this for bugs", or "is this script correct". Three modes: thorough (collaborative section-by-section), fast (Claude-driven with discussion), and report-only. Do NOT load for quick one-off questions about a single line or function.
/audit-skillsAudit Claude Code skills for bloat, trigger accuracy, structural quality, redundancy, and pruning opportunities. Use when skills feel bloated, before publishing to lab repo, after building several new skills, when reviewing a single newly-created skill before publishing, or when the user says "audit my skills", "review skills", "check skill quality", "audit this skill", or invokes /audit-skills. Covers both user-level (~/.claude/skills/) and project-level (.claude/skills/) skills, and supports both full-library scans and single-skill reviews. Do NOT load for auditing data analysis scripts (use /audit-script) or project documentation (use /audit-project).
/cleanup-scriptsSession-scoped script cleanup for data science projects. Checks scripts/scratch/ for working files that need consolidation into .qmd scripts, flags numbered non-.qmd files in scripts/, and verifies script-output directory correspondence. Use when finishing a coding session, when scripts/scratch/ has accumulated files, or when the user says "clean up scripts", "consolidate scratch", or "check script conventions". Lightweight and fast — reads files, no expensive computation.
/conda-envConda environment activation for Python commands. Use when running Python scripts, pip, or conda-dependent tools./data-handlingData handling best practices for R and Python data science analysis scripts. Use when writing data manipulation code, analysis pipelines, or .qmd scripts that process scientific/analytical data (e.g., filtering, joining, normalizing datasets). Do NOT load for general Python scripting, infrastructure code, or configuration management.