Hook#buildwithclaude
0
Large file guard
Repo şişmesini önlemek için 100 KB'tan büyük dosyalar yazıldığında uyar
yazan kuscubasiece·8 Eylül 2026
Kaynak: davepoon/claude-code-subagents-collection · MIT
Repo şişmesini önlemek için 100 KB'tan büyük dosyalar yazıldığında uyar
Kaynak: davepoon/claude-code-subagents-collection · MIT
curl -sL https://www.antrophiclove.com/api/kaynak/large-file-guard/rawBu içerik mevcut dosyaya elle harmanlanmalı: .claude/settings.json
Warns when a written file exceeds the size threshold (default 100KB). Claude sometimes generates entire datasets, logs, or documentation dumps as single files that bloat the repository. The threshold is configurable via CC_MAX_FILE_SIZE environment variable.
PostToolUseWriteCC_MAX_FILE_SIZE - Maximum file size in bytes (default: 102400 = 100KB)#!/bin/bash
# large-file-guard.sh — Warn when writing large files
INPUT=$(cat)
FILE=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty' 2>/dev/null)
[ -z "$FILE" ] && exit 0
[ ! -f "$FILE" ] && exit 0
MAX_SIZE="${CC_MAX_FILE_SIZE:-102400}" # 100KB default
FILE_SIZE=$(wc -c < "$FILE" 2>/dev/null)
[ -z "$FILE_SIZE" ] && exit 0
if [ "$FILE_SIZE" -gt "$MAX_SIZE" ]; then
SIZE_KB=$((FILE_SIZE / 1024))
MAX_KB=$((MAX_SIZE / 1024))
echo "WARNING: Large file written: $FILE (${SIZE_KB}KB > ${MAX_KB}KB limit)" >&2
echo " Consider splitting into smaller files or using .gitignore." >&2
fi
exit 0
Add to your .claude/settings.json:
{
"hooks": {
"PostToolUse": [{
"matcher": "Write",
"hooks": [{ "type": "command", "command": "~/.claude/hooks/large-file-guard.sh" }]
}]
}
}
To customize the threshold:
export CC_MAX_FILE_SIZE=51200 # 50KB