agentsclimarketplace

Docker find chmod fast readability

Skill kjuhwa/skills-hub/skills/build/docker-find-chmod-fast-readability

In a Dockerfile RUN layer, use find -not -perm to touch ONLY files missing a permission bit instead of chmod -R — cuts image build time from minutes to seconds on big node_modules trees.From its SKILL.md

Install
npx -y skills add kjuhwa/skills-hub --skill docker-find-chmod-fast-readability

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

2.3 KB, 486 tokens by cl100k_base, as published. Nobody here has run it

chmod smart in Docker (find -not -perm)

When to use

  • You want world-readable app files inside a container so docker run --user $(id -u):$(id -g) works for arbitrary host users.
  • Your /app has hundreds of thousands of files (node_modules - looking at you).
  • chmod -R o+r /app takes minutes and explodes the layer size.

How it works

chmod -R walks every inode and writes the new mode unconditionally. find -not -perm only invokes chmod on files that actually need it:

RUN find /app -not -perm -o=r -exec chmod o+r {} + && \
    find /app -type d -not -perm -o=x -exec chmod o+x {} +
  • -o=r / -o=x = "other has read/execute". -not -perm -o=r = "other is missing read".
  • -exec chmod o+r {} + = batch up arguments (like xargs), one chmod per batch instead of per file.
  • Directory pass is separate because you want o+x (traversability) not o+r on dirs if you're being precise.

Example

Slow:

RUN chmod -R o+r /app  # ~3 minutes on 300k files

Fast:

RUN find /app -not -perm -o=r -exec chmod o+r {} + && \
    find /app -type d -not -perm -o=x -exec chmod o+x {} +
# ~15 seconds, and the layer is tiny because most files didn't actually change

Gotchas

  • Layer size: chmod -R rewrites every file even if mode didn't change, bloating the diff layer. The find approach writes only deltas.
  • Don't forget BOTH passes - if you only o+r, dirs without o+x make files unreachable.
  • -exec {} + > -exec {} \; by 10-100x because it batches.
  • Symlinks: by default chmod follows, find doesn't; add -L if symlink targets matter.
  • This trick is especially valuable for images that wrap Node/Bun monorepos.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Gives 0 of the 12 instructions most containers cloud skills give in 486 tokens

Counted across 607 of the 657 authors here whose files we hold, read 2026-08-07

  • Run containers as a non-root userin 66 of 607, across 46 files
  • Use multi-stage buildsin 53 of 607, across 44 files
  • Use Promise.all for independent operationsin 47 of 607, across 13 files
  • Import directly instead of barrel filesin 46 of 607, across 12 files
  • Use ternary instead of AND for conditionalsin 45 of 607, across 12 files
  • Use Set or Map for O(1) lookupsin 42 of 607, across 10 files
  • Create a .dockerignore filein 41 of 607, across 31 files
  • Read individual rule files for detailsin 39 of 607, across 9 files
  • Copy dependency files before source codein 36 of 607, across 23 files
  • Authenticate server actions like API routesin 35 of 607, across 7 files
  • Use next/dynamic for heavy componentsin 34 of 607, across 9 files
  • Use React.cache for per-request deduplicationin 34 of 607, across 10 files

Said here and by no other author read

  • use find with -not -perm to chmod only files missing the bit
  • run separate passes for file read and directory execute bits
  • use the exec plus argument to batch chmod calls
  • add -L to find if symlink targets matter

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.

Keep looking

Skills are one crate of 326,790. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.