Feature request: Context-aware instruction loading (lazy-load instructions by action type)

Resolved 💬 4 comments Opened Mar 27, 2026 by vikingh27 Closed Apr 27, 2026

Hi team! One more idea from my experience using Claude Code daily. This one is more of a "wouldn't it be cool if" than a pain point, so totally understand if it's lower priority.

The pattern I noticed

I have instructions that are only relevant for specific types of work. For example, 30 lines of testing instructions that matter when running tests but are irrelevant when writing articles. Today, these either:

  1. Live in CLAUDE.md (always loaded, diluting attention on other instructions), or
  2. Live in a skill file (only loaded when I explicitly type the command)

The gap is: instructions that require judgment (not just mechanical checks, so a hook won't work) but are only relevant for a specific type of action.

What might help

Something like action-triggered instruction files. For example:

  • .claude/instructions/on-test.md - loaded when the model is about to run tests
  • .claude/instructions/on-deploy.md - loaded when running deploy commands
  • .claude/instructions/on-write-markdown.md - loaded when editing .md files

This would be similar to how the if field in hooks already filters by action pattern, but instead of running a script, it would inject instructions into the model's context.

Why I think this could be valuable

It would let users keep their CLAUDE.md lean (just core identity and routing) while having detailed, domain-specific instructions that load automatically at the right time. Less context pressure, more precise instructions.

Current workaround

I use skills for workflow-specific instructions and hooks for mechanical enforcement. It works well enough, but the automatic loading would remove the need for me to remember to invoke the right skill.

Thanks as always for the great work on Claude Code!

Environment: Claude Code CLI on macOS, 8 skill files, 10 memory files

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗