sync-ignore
Skill65 starsChanged 4 days agoMITView on GitHub
Mirror .gitignore to .dockerignore. Use whenever a .gitignore entry is added or removed, or when auditing a bloated Docker build context.
- Reads credentials
In this repository21 other files it gives its agents.
- AGENTS.mdAGENTS.md
- add-packageSkill
- agent-browserSkill
- api-endpointSkill
- codebase-mapSkill
- db-migrationSkill
- delete-commentSkill
- designSkill
- devSkill
- docker-testSkill
- fontsSkill
- gh-commitSkill
- iceboxSkill
- portlessSkill
- releaseSkill
- runtime-apisSkill
- skills-managerSkill
- sync-depsSkill
- sync-docsSkill
- sync-shadcnSkill
- ui-verifySkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
After any .gitignore edit, run:
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
Ignore Sync
.dockerignore does not inherit from .gitignore. Whatever git ignores but .dockerignore misses still enters the Docker build context (COPY . . in the prepare stage of web/next/Dockerfile and api/hono/Dockerfile), and on this repo that has meant gigabytes: web/next/.next alone hit 3GB and .turbo 23GB.
The two files are mirrors
.gitignore is the source of truth and .dockerignore follows it line for line, written by bun run sync:ignore (packages/scripts/src/sync-ignore.ts), so an edit goes to .gitignore alone. Every ignore rule and every shared ! un-ignore (e.g. !.yarn/patches) lives in the shared body of both: same entry, same section, same order, same commit.
The script writes two sanctioned divergences:
- The
**/prefix. Docker matches each pattern from the build context's root, while git matches a pattern with no slash before its end at any depth (Build context). So.dockerignorewrites each folder pattern git matches at any depth with a**/prefix (node_modules/becomes**/node_modules/), which keeps every workspace's.next,distandnode_modulesout of the context. A pattern git anchors to the root, one with a slash before its end (web/next/content/docs/meta.json), stays as written, and so does a file pattern (.env*,next-env.d.ts), on purpose: the prefix is for folders alone. A folder.gitignorewrites with no trailing slash (.vercel) gets its prefix only when its name is in the script'sSLASHLESS_FOLDERS. - The labeled tail at the end of each file, for a git-only or docker-only override. The script drops
.gitignore's tail, from its# git overridesline on, and writes its ownDOCKER_TAIL:# docker overrides,.git, and!.env.example..gitstays out of the context since the images build fromturbo prune's output, which holds none. A docker-only override goes inDOCKER_TAIL.
.env stays out of the context
Real .env* files never enter the Docker context. Each build mounts the host file as a required BuildKit secret (--mount=type=secret,id=dotenv,target=/app/.env,required=true; compose supplies it via secrets.dotenv.file: .env), so it is validated in full during the build yet never lands in a layer. A diff that re-includes .env* to feed a builder-stage COPY is drift; sync it away.
Sync
After any .gitignore edit, run:
bun run sync:ignoreDone when bun run sync:ignore --check exits 0. The pre-commit hook runs the script whenever .gitignore or the script is staged, and stages .dockerignore; CI runs --check, so a hand edit to .dockerignore fails the pull request.
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.

