env-sync
Skill1 starsChanged 4 months agoMITView on GitHub
Sync .env files from git root repository to worktrees. Use when asked to sync env, copy env, environment file, or when working in a git worktree that is missing a .env file. Automatically detects missing .env in worktrees.
- Reads credentials
2 other projects use a version of this.
Adopted by
Most recently taken up by
- ieeecsopen/mcp-cstheir own version, first seen Aug 27, 2026
- FPVE-Webdev/claude-skillstheir own version, first seen Aug 17, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- ieeecsopen/mcp-cs★ 3same name
- FPVE-Webdev/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- code-standardsSkill
- daily-newsSkill
- macos-disk-cleanupSkill
- pr-review-loopSkill
- shipSkill
- video-downloaderSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 8 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
ALWAYS ask before overwriting: - if .env already exists, confirm with user first
- Distinctive: line 24
Validate paths: - ensure the root path exists and is a valid git repository
- Distinctive: line 25
No arbitrary paths: - only sync from the actual git root repository
- Distinctive: line 36
If not a worktree, inform user this skill is for git worktrees only.
- Distinctive: line 114
Always inform user what was done
- Distinctive: line 115
If .env already exists: MUST ask user before overwriting
- Distinctive: line 116
If root .env doesn't exist: tell user the path checked
- Distinctive: line 117
Never display .env file contents
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Env Sync - Git Worktree Environment File Synchronization
This skill syncs .env files from a git root repository to git worktrees.
When to Use
- User asks to sync env or copy env
- User mentions missing environment variables or .env file
- Working in a git worktree that lacks a .env file
- User asks to set up environment for a worktree
Security Rules
- NEVER display .env file contents - they contain secrets
- ALWAYS ask before overwriting - if .env already exists, confirm with user first
- Validate paths - ensure the root path exists and is a valid git repository
- No arbitrary paths - only sync from the actual git root repository
Instructions for Agent
Step 1: Check if in a Git Worktree
# Check if .git is a file (worktree) or directory (regular repo)
[ -f .git ] && echo "worktree" || echo "not-worktree"If not a worktree, inform user this skill is for git worktrees only.
Step 2: Find and Validate Root Repository
# Read gitdir and extract root path
GITDIR=$(cat .git | grep "^gitdir:" | sed 's/gitdir: //')
ROOT_REPO=$(echo "$GITDIR" | sed 's/\.git\/worktrees\/.*//')
# Validate: must be a real git repository
if [ -d "${ROOT_REPO}/.git" ]; then
echo "Valid root: $ROOT_REPO"
else
echo "Invalid root path - not a git repository"
exit 1
fiStep 3: Check for Existing .env
# IMPORTANT: Always check before copying
if [ -f ./.env ]; then
echo "WARNING: .env already exists in this worktree"
# ASK USER before proceeding
fiIf .env exists: STOP and ask user "Do you want to overwrite the existing .env file?"
Step 4: Copy .env (only after user confirmation if needed)
if [ -f "${ROOT_REPO}/.env" ]; then
cp "${ROOT_REPO}/.env" ./.env
echo "Synced .env from $ROOT_REPO"
else
echo "No .env found in root repository: $ROOT_REPO"
fiComplete Safe Script
# Safe env sync with validation
if [ ! -f .git ]; then
echo "Not a git worktree"
exit 1
fi
GITDIR=$(cat .git | grep "^gitdir:" | sed 's/gitdir: //')
ROOT=$(echo "$GITDIR" | sed 's/\.git\/worktrees\/.*//')
# Validate root is a git repo
if [ ! -d "${ROOT}/.git" ]; then
echo "Invalid: $ROOT is not a git repository"
exit 1
fi
# Check if .env exists at root
if [ ! -f "${ROOT}/.env" ]; then
echo "No .env in root: $ROOT"
exit 1
fi
# Check if local .env exists - MUST ASK USER
if [ -f ./.env ]; then
echo "WARNING: .env already exists here. Ask user before overwriting."
exit 0
fi
# Safe to copy
cp "${ROOT}/.env" ./.env
echo "Synced .env from $ROOT"Response Guidelines
- Always inform user what was done
- If .env already exists: MUST ask user before overwriting
- If root .env doesn't exist: tell user the path checked
- Never display .env file contents
- Report only: file exists/copied, line count, file size
Error Handling
| Situation | Action |
| Not a worktree | Inform user, no action |
| Invalid root path | Warn user, no action |
| No root .env | Tell user path, suggest checking |
| .env exists | Ask user before overwrite |
| Permission denied | Suggest checking permissions |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

