---
name: ayf:ayf-lint
description: Warn when CLAUDE.md exceeds its size budget (200 lines).
allowed-tools:
  - Bash
  - Read
---

# /ayf-lint -- CLAUDE.md size guard

Keep the project's `CLAUDE.md` lean. Every line ships into context on **every**
session, so an oversized `CLAUDE.md` is pure token tax. Budget: **200 lines**.

## Run

1. Count the lines of the active `CLAUDE.md` (project root; fall back to
   `templates/CLAUDE.md` when run inside the framework repo):

   ```bash
   FILE="CLAUDE.md"; [ -f "$FILE" ] || FILE="templates/CLAUDE.md"
   lines=$(wc -l < "$FILE" | tr -d ' ')
   echo "$FILE: $lines lines"
   ```

2. Evaluate against the 200-line budget:

   ```bash
   if [ "$lines" -gt 200 ]; then
     echo "⚠️  $FILE is $lines lines (> 200). Trim it: cut duplication, collapse"
     echo "    reference lists, and point to file headers instead of restating them."
   else
     echo "✅ $FILE is $lines lines (≤ 200)."
   fi
   ```

3. If over budget, print the section headers with their line numbers so the human
   sees where the weight is:

   ```bash
   [ "$lines" -gt 200 ] && grep -nE '^#{1,3} ' "$FILE"
   ```

## Exit criteria

- **≤ 200 lines:** pass -- print the ✅ line only.
- **> 200 lines:** print the warning plus the section breakdown, and suggest a slim
  pass. Warning only -- never auto-edit `CLAUDE.md`.
