skill-everything / rules
Cursor rule20 starsChanged 7 months agoMITView on GitHub
Apply when writing or reviewing Dockerfiles, docker compose files, or container build pipelines. Covers layer caching, multi-stage builds, security hardening, and compose conventions.
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/brainstorming.mdcCursor rule
- .cursor/rules/branch-finishing.mdcCursor rule
- .cursor/rules/code-quality.mdcCursor rule
- .cursor/rules/db-schema.mdcCursor rule
- .cursor/rules/debugging.mdcCursor rule
- .cursor/rules/domain-template.mdcCursor rule
- .cursor/rules/drawio.mdcCursor rule
- .cursor/rules/error-log.mdcCursor rule
- .cursor/rules/fastapi.mdcCursor rule
- .cursor/rules/git-conventions.mdcCursor rule
- .cursor/rules/github-cli.mdcCursor rule
- .cursor/rules/implementation-plan.mdcCursor rule
- .cursor/rules/langchain.mdcCursor rule
- .cursor/rules/python.mdcCursor rule
- .cursor/rules/react.mdcCursor rule
- .cursor/rules/review-deployment.mdcCursor rule
- .cursor/rules/security-review.mdcCursor rule
- .cursor/rules/self-extension-workflow.mdcCursor rule
- .cursor/rules/shell-scripting.mdcCursor rule
- .cursor/rules/svg-check.mdcCursor rule
- .cursor/rules/tdd.mdcCursor rule
- .cursor/rules/typescript.mdcCursor rule
- skill-everythingSkill
- brainstormingSkill
- branch-finishingSkill
- code-qualitySkill
- db-schemaSkill
- debuggingSkill
- dockerSkill
- domain-templateSkill
- drawioSkill
- error-logSkill
- fastapiSkill
- git-conventionsSkill
- github-cliSkill
- implementation-planSkill
- langchainSkill
- pythonSkill
- reactSkill
- review-deploymentSkill
- security-reviewSkill
- self-extension-workflowSkill
- shell-scriptingSkill
- svg-checkSkill
- tddSkill
- <kebab-case-name>Skill
- typescriptSkill
The file
Show its rules and text
We split this docker.mdc into the rules it gives an agent
17 rules. About 0 are common, 4 are distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Dependency layer first: Always install dependencies in a separate layer before copying application source, so a source change does not …
- Very specific: line 17
Copy only what's needed early: Before copying the full source tree, copy only the dependency manifest files (e.g., requirements.txt, …
- Very specific: line 18
Minimise layer count: Prefer chaining related RUN commands with && and \ continuations rather than issuing one RUN per command.
- Distinctive: line 19
Order by change frequency: Always place instructions that change rarely (OS packages, global tools) before instructions that change often …
- Distinctive: line 23
Use multi-stage for compiled artefacts: Always use a builder stage to compile or bundle, then copy only the final artefact into a minimal …
- Very specific: line 24
Name every stage: Use AS <name> on every FROM line so later stages and docker build --target calls are readable and stable.
- Very specific: line 25
Pin the runtime base image: Always pin base images to a specific digest or immutable tag (e.g., python:3.12.3-slim) in the runtime stage.
- Very specific: line 29
Run as non-root: Always create a dedicated non-root user and switch to it with USER before the final CMD/ENTRYPOINT.
- Very specific: line 30
Never embed secrets in image layers: Never pass secrets via ARG or ENV in a Dockerfile.
- Very specific: line 31
Scan images before push: Before pushing any image to a registry, run an image vulnerability scanner (e.g., trivy image, docker scout) and …
- Very specific: line 32
Prefix docker run -v from Git Bash with MSYS_NO_PATHCONV=1: Always prefix docker run -v calls issued from Git Bash or MSYS on Windows with …
- Very specific: line 36
Maintain a .dockerignore: Always keep a .dockerignore at the repo root that excludes .git, test fixtures, local env files, and build …
- Very specific: line 40
Declare a HEALTHCHECK: Always add a HEALTHCHECK instruction so orchestrators (Compose, Kubernetes) can detect unhealthy containers without …
- Very specific: line 41
Use exec-form ENTRYPOINT: Always write ENTRYPOINT in exec form (["executable", "arg"]) rather than shell form so the process receives OS …
- Very specific: line 45
Set resource limits in compose: Always declare deploy.resources.limits (CPU and memory) for every service in docker-compose.yml to prevent …
- Very specific: line 46
Use compose profiles for optional services: Prefer assigning optional services (e.g., observability stacks, seed jobs) to named profiles so …
- Distinctive: line 47
Isolate networks per stack: Avoid using the default bridge network across unrelated stacks.
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule 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
--- description: Apply when writing or reviewing Dockerfiles, docker compose files, or container build pipelines. Covers layer caching, multi-stage builds, security hardening, and compose conventions. alwaysApply: false --- # Sub-Skill: Docker / Container Conventions **Purpose:** Prevent common container mistakes — busted layer caches, bloated images, insecure defaults, and compose misconfigurations — before they reach CI or production. --- ## Rules ### Layer Ordering & Cache 1. **Dependency layer first.** Always install dependencies in a separate layer before copying application source, so a source change does not invalidate the package cache. Reference: ERR-2026-020 2. **Copy only what's needed early.** Before copying the full source tree, copy only the dependency manifest files (e.g., `requirements.txt`, `package.json`, `pyproject.toml`) so the install layer is cached independently. 3. **Minimise layer count.** Prefer chaining related `RUN` commands with `&&` and `\` continuations rather than issuing one `RUN` per command; each `RUN` creates a new layer. 4. **Order by change frequency.** Always place instructions that change rarely (OS packages, global tools) before instructions that change often (app source, config files). ### Multi-Stage Builds 5. **Use multi-stage for compiled artefacts.** Always use a builder stage to compile or bundle, then copy only the final artefact into a minimal runtime stage; never ship build toolchains in the production image. 6. **Name every stage.** Use `AS <name>` on every `FROM` line so later stages and `docker build --target` calls are readable and stable. 7. **Pin the runtime base image.** Always pin base images to a specific digest or immutable tag (e.g., `python:3.12.3-slim`) in the runtime stage; never use `latest` in production Dockerfiles. ### Security 8. **Run as non-root.** Always create a dedicated non-root user and switch to it with `USER` before the final `CMD`/`ENTRYPOINT`; never run application processes as `root` inside a container. 9. **Never embed secrets in image layers.** Never pass secrets via `ARG` or `ENV` in a Dockerfile; use Docker BuildKit `--secret` mounts or runtime environment injection instead. 10. **Scan images before push.** Before pushing any image to a registry, run an image vulnerability scanner (e.g., `trivy image`, `docker scout`) and fail the pipeline on critical CVEs. 11. **Prefix docker run -v from Git Bash with MSYS_NO_PATHCONV=1.** Always prefix `docker run -v` calls issued from Git Bash or MSYS on Windows with `MSYS_NO_PATHCONV=1` to prevent path mangling. Reference: ERR-2026-013 ### .dockerignore & Context 12. **Maintain a .dockerignore.** Always keep a `.dockerignore` at the repo root that excludes `.git`, test fixtures, local env files, and build artefacts; a large build context slows every build and may leak secrets. ### Health Checks & Signal Handling 13. **Declare a HEALTHCHECK.** Always add a `HEALTHCHECK` instruction so orchestrators (Compose, Kubernetes) can detect unhealthy containers without external probes. 14. **Use exec-form ENTRYPOINT.** Always write `ENTRYPOINT` in exec form (`["executable", "arg"]`) rather than shell form so the process receives OS signals directly and `docker stop` terminates it cleanly. ### Compose Conventions 15. **Set resource limits in compose.** Always declare `deploy.resources.limits` (CPU and memory) for every service in `docker-compose.yml` to prevent a runaway container from starving the host. 16. **Use compose profiles for optional services.** Prefer assigning optional services (e.g., observability stacks, seed jobs) to named `profiles` so `docker compose up` starts only the core services by default. 17. **Isolate networks per stack.** Avoid using the default bridge network across unrelated stacks; define explicit named networks and attach only the services that need to communicate. --- ## See also - `skills/code-quality/SKILL.md` — general layering and change-frequency ordering principles - `skills/review-deployment/SKILL.md` — deployment checklist that includes image scanning and migration ordering --- ## Notes - ERR-2026-020 is the canonical reference for layer-cache busting caused by copying source before installing dependencies. - ERR-2026-013 covers MSYS path mangling on Windows when using `docker run -v`.
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.

