Cc Read Limit Hook — Development skill for Claude Code
A hook that limit and guide how claude code read files.
How to install Cc Read Limit Hook
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open Cedriccmh/cc-read-limit-hook and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Cc Read Limit Hook does
A hook that limit and guide how claude code read files.
Alternatives in Development
- Hookify — Rule-based hook system for Claude Code 14k ★
- Claude Swap — Switch between multiple Claude Code accounts, with automatic rate-limit rotation, usage dashboard, and paralle 2k ★
- Claude Code Prompt Improver — Intelligent prompt improver hook for Claude Code 1.3k ★
README
cc-read-limit-hook
A Claude Code PreToolUse hook that enforces file read limits to optimize context usage.
一个 Claude Code PreToolUse 钩子,用于限制文件读取范围以优化上下文使用。
Features / 功能
- Block large file reads - Files >1000 lines or >50KB require
offset+limitparameters - Limit single reads - Max 500 lines / 20KB per read operation
- Auto-add limit - Automatically adds limit when only offset is specified
- Statistics logging - Logs read attempts for analysis
- 阻止大文件读取 - 超过 1000 行或 50KB 的文件必须指定
offset+limit参数 - 限制单次读取 - 每次最多读取 500 行 / 20KB
- 自动添加 limit - 仅指定 offset 时自动补充 limit
- 统计日志 - 记录读取操作用于分析
Installation / 安装
Copy `read-guard.py` to your hooks directory:
cp read-guard.py "$USERPROFILE/.claude/hooks/"Add to `~/.claude/settings.json`:
{ "hooks": { "PreToolUse": [ { "matcher": "Read", "hooks": [ { "type": "command", "command": "python \"$USERPROFILE/.claude/hooks/read-guard.py\"" } ] } ] } }
Configuration / 配置
Edit the constants in `read-guard.py`:
MAX_FILE_LINES = 1000 # Line threshold / 行数阈值
MAX_FILE_BYTES = 50 * 1024 # Byte threshold / 字节阈值
MAX_SINGLE_READ_LINES = 500 # Max lines per read / 单次最大行数
MAX_SINGLE_READ_BYTES = 20 * 1024 # Max bytes per read / 单次最大字节
License / 许可
MIT
Related Skills
Limisaw
LIMISAW (LIMIT SAW) - a one-file Windows tray monitor for how much quota is left across Codex, Claude Code, An
Post Compact Reminder
Claude Code hook that detects context compaction and injects a reminder to re-read AGENTS.md, preventing post-
PDF Text Router
A Claude Code hook that routes each Read on a PDF to the path that actually works: text layer to UTF-8 text, s
Narthex
Prompt-injection defenses for Claude Code. A PreToolUse Bash hook blocks compositional credential-exfiltration
Claude Memory Canary
Free Claude Code hook: warns when your CLAUDE.md / memory files grow past the size Claude can actually read
Hook
Turn work into posts people actually read
Related Agents
Antwork Content
Read-only analysis agent for the Antwork audit. Owns the Content Quality dimension — hook strength, CTA presen
Wd Researcher
Use this agent for time-boxed investigations that feed specs - provider TOS and rate-limit realities, Claude C
PM Security Review
Read-only security reviewer for Product Masters LMS diffs. Finds the input/actor that breaks auth, access, RLS