Gate file reads/edits on required skills (declarative skill prerequisites by path regex)

Open 💬 0 comments Opened Jun 23, 2026 by marcospgp

What: Let a project declare in settings that specific skills must be loaded before the agent may read and/or edit files matching a path pattern. On a matching Read/Edit/Write without the required skill loaded, the harness blocks (or warns) and tells the agent to load it first.

Why: Skills carry the rules for working in an area (for example a TypeScript skill with house conventions). Loading the right one before editing currently depends on the agent remembering. When it forgets, it produces code that breaks rules the skill would have supplied, caught only in later review, if at all. MUST load text is advisory; there is no enforcement.

Why hooks don't cover it today: a PreToolUse hook can see the file path and block, but it has no way to know whether a skill has been loaded this session (no exposed skill/session state). The only workaround is self-managed marker files via PostToolUse-on-Skill plus PreToolUse-on-Edit, which is brittle and easy to get wrong.

Proposed shape:

"skillGates": [
  { "pathPattern": "\\.tsx?$", "requireSkills": ["typescript"], "on": "write", "mode": "enforce" }
]
  • on: read | write | both. Some skills are needed to interpret a file, others only to modify it safely.
  • mode: enforce (block) or warn (inject reminder, allow through).
  • Composes with existing hooks rather than replacing them.

View original on GitHub ↗