agentsclimarketplace

Read file

Skill MauricioPerera/agent-skills-pack/skills/read-file

A curated pack of 7 practical agent-skills demonstrating real-world patterns: HTTP, GitHub CLI, ripgrep, file ops, JSON processing, encoding. Each SKILL.md validated against the v0.1 spec.

Install
npx -y skills add MauricioPerera/agent-skills-pack --skill read-file

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.

What its author says it does

Copied from the file, not written here

Reads the contents of a file from the local filesystem and writes it to stdout. Optionally limits to the first N lines. Sandboxed banks (SPEC §2.11) only see paths under the declared `filesystem` allowlist plus `$AGENT_SCRATCH`.

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

4.1 KB, as published. Nobody here has run it

Read a file's content

The simplest possible agent skill: read a file from disk.

Why head instead of cat

cat <path> reads the entire file regardless of size. For an LLM agent, an unbounded read can:

  • Burn context on a giant log file.
  • Trigger out-of-memory in the bank's audit recording.
  • Produce stdout that exceeds reasonable buffering.

head --lines=N provides a natural cap. The default 5000 covers most source files entirely; logs, datasets, and other large files require an explicit higher value or pagination.

For huge files, the agent should use a separate skill (e.g., a future read-file-range with tail | head) rather than raising max_lines to absurd values.

Output

  • stdout: the file's content, up to max_lines lines.
  • stderr: head: cannot open '<path>' for reading: No such file or directory on missing files.
  • exit code: 0 on success; 1 on any read failure.

Caveats

  • Binary files: head doesn't refuse them, but the output may include null bytes / unprintable chars that confuse the agent. Banks SHOULD detect binary content via file or magic-byte sniffing and refuse to feed binary into an LLM context.
  • Symlinks: followed by default. The actual file's content is returned, not the symlink target.
  • Permissions: standard file-permission rules apply. head /etc/shadow fails for non-root users.
  • No path-traversal sandbox: this skill does NOT restrict where it reads from. A bank operating in sandbox mode SHOULD wrap the path value to confine to a project root or scratch directory before resolving.
  • Encoding: assumes UTF-8. Non-UTF-8 files (e.g., Latin-1) appear as mojibake but don't fail.

Why no wc -l companion in this skill

A common pattern is "tell me how big the file is, then read it". Better as separate skills (file-info, read-file) than to bundle. Composability via chains > monolithic.

Keep looking

Skills are one crate of 328,083. 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.