Skip to content
Back to skills

Spgr Read File

ASecurity

Read a repository file as line-numbered text with binary, size, and missing-path handling. Use when an agent needs to read existing source, config, or artifact files before analyzing or editing them, or as the read side of the read-before-write contract.

  • 2 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 11, 2026
ai-agents

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add z4gunn/springer --skill spgr-read-file --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Spgr Read File?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Spgr Read File
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/z4gunn-spgr-read-file/badge)](https://www.skillsdirectory.com/skills/z4gunn-spgr-read-file)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: spgr-read-file
description: Read a repository file as line-numbered text with binary, size, and missing-path handling. Use when an agent needs to read existing source, config, or artifact files before analyzing or editing them, or as the read side of the read-before-write contract.
disable-model-invocation: true
---

# read-file

## Purpose

Give every agent one consistent read interface that returns accurate 1-indexed line numbers and handles the edge cases that cause silent failures: binary files, missing paths, oversized files, and out-of-repo traversal. Downstream edit tools reference the line numbers returned here, so numbering is load-bearing and must be exact.

## Inputs

| Field | Description |
|-------|-------------|
| `file_path` | Absolute or repo-relative path to read |
| `line_start` | Optional first line, 1-indexed, defaults to 1 |
| `line_end` | Optional last line, defaults to end of file |
| `encoding` | Optional, defaults to utf-8 |

## Outputs

| Artifact | Description |
|----------|-------------|
| `read_result` | Object: `file_path`, `file_exists`, `is_binary`, `line_count`, `file_size_bytes`, `line_start`, `line_end`, `contents` |

## Procedure

1. Resolve `file_path` and confirm it stays within the repository root. Refuse any path that traverses outside the repo and return an error.
2. If the file does not exist, return `file_exists: false` and suggest up to three alternative paths found by codebase search. Do not return empty content silently.
3. Detect binary by scanning the first 8KB for null bytes. If binary, return `is_binary: true` with a short message and no content.
4. Read the requested range. For a file over 500KB with no range given, return the first 200 lines and a truncation notice carrying the total line count. The caller must request a range for more.
5. Prefix each returned line with its 1-indexed number. Normalize line endings to LF in output and record the source style in metadata.

## Notes

- Treat reads as the read side of the read-before-write contract. `spgr-write-file` and the artifact-write skills refuse to operate on a file not read in the current session.
- Reading a file is a precondition for editing it, never a substitute for the agent's own analysis.
- A binary document the human supplied (PDF, DOCX, PPTX, XLSX) is not read here. Route it through spgr-ingest-document, which writes its Markdown source under `docs/inputs/`, and read that.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.