Skills

Improve Claude Md

Improve a CLAUDE.md file using <important if> blocks to improve instruction adherence

Install

npx skills add humanlayer/skills --skill improve-claude-md -g -a claude-code -y
Repository
humanlayer/skills5.5k
Category
AI and agents
Updated
3d ago
License
MIT
Context cost
Mediumabout 2,318 tokens
Runs scripts
No, instructions only

What it does

improve a CLAUDE.md file using <important if> blocks to improve instruction adherence

When the user provides a CLAUDE.md file (or asks you to improve one), rewrite it following the principles and structure below.

Core Problem

Claude Code injects a system reminder with every CLAUDE.md that says:

"this context may or may not be relevant to your tasks. You should not respond to this context unless it is highly relevant to your task."

This means Claude will ignore parts of your CLAUDE.md it deems irrelevant. The more content that isn't applicable to the current task, the more likely Claude is to ignore everything, including the parts that matter.

Solution: <important if="condition"> Blocks

Wrap conditionally-relevant sections of the CLAUDE.md in <important if="condition"> XML tags. This exploits the same XML tag pattern used in Claude Code's own system prompt, giving the model an explicit relevance signal that cuts through the "may or may not be relevant" framing.

Principles

1. Foundational context stays bare, domain guidance gets wrapped

Not everything should be in an <important if> block. Context that is relevant to virtually every task, project identity, project map, tech stack, should be left as plain markdown at the top of the file. This is onboarding context the agent always needs.

Domain-specific guidance that only matters for certain tasks, testing patterns, API conventions, state management, i18n, gets wrapped in <important if> blocks with targeted conditions.

The rule of thumb: if it's relevant to 90%+ of tasks, leave it bare. If it's relevant to a specific kind of work, wrap it.

2. Conditions must be specific and targeted

Bad, overly broad conditions that match everything:

<important if="you are writing or modifying any code">
- Use absolute imports
- Use functional components
- Use camelCase filenames
</important>
Read the whole SKILL.md on GitHub

More in AI and agents