Skip to content

Add prek hook to enforce 500-line limit on AGENTS.md and SKILL.md files#1849

Merged
nathanjmcdougall merged 2 commits into
mainfrom
copilot/create-hook-manage-skill-size
Apr 7, 2026
Merged

Add prek hook to enforce 500-line limit on AGENTS.md and SKILL.md files#1849
nathanjmcdougall merged 2 commits into
mainfrom
copilot/create-hook-manage-skill-size

Conversation

Copilot AI commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

Agent skill files and AGENTS.md can grow unbounded, making them harder to maintain and reason about. This adds a pre-commit hook that enforces a 500-line ceiling and tells contributors exactly how to fix violations.

Changes

  • hooks/check-agent-file-sizes.py — new bespoke hook; scans AGENTS.md and all */SKILL.md files under a given skills directory, reports files over the limit with actionable remediation advice:
    • SKILL.md violations → split into sub-skills
    • AGENTS.md violations → move general instructions into separate referenced files
  • .pre-commit-config.yaml — wires the hook at priority: 0 alongside check-skills-documented; all limits and paths are passed as args so the script is project-agnostic
ERROR: The following agent files exceed the 500-line limit:
  .agents/skills/some-big-skill/SKILL.md: 512 lines (limit: 500)

To fix these violations:
  - For SKILL.md files: split the skill into sub-skills, each in its own subdirectory under .agents/skills/.
  - For AGENTS.md: move general instructions into separate files referenced from AGENTS.md.

Copilot AI changed the title [WIP] Add hook to limit SKILL.md and AGENTS.md to 500 lines Add prek hook to enforce 500-line limit on AGENTS.md and SKILL.md files Apr 7, 2026
Copilot AI requested a review from nathanjmcdougall April 7, 2026 07:26
@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review April 7, 2026 08:20
@nathanjmcdougall nathanjmcdougall merged commit 38f466f into main Apr 7, 2026
1 check passed
@nathanjmcdougall nathanjmcdougall deleted the copilot/create-hook-manage-skill-size branch April 7, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a hook to manage the size of agent skills and AGENTS.md

2 participants