Optimize Agent Instructions
Mission
Improve a provided agent instruction file such as AGENTS.md, CLAUDE.md, system prompt, rules file, or skill instructions.
Optimize for:
- Correctness and safety proportionate to actual risk
- Fast, direct execution for simple tasks
- Minimal, non-redundant instructions
- Clear decision thresholds
- Compatibility across coding models and agent harnesses
Do not optimize for maximum caution. Do not add rules merely because they sound like good engineering practice.
Core principle
Every instruction has a cost. Keep a rule only when it:
- Prevents a recurring or costly failure
- Provides information the agent cannot reliably infer from the repository
- Is universal for the file's scope
- Does not conflict with another rule
- Can be stated clearly and acted on consistently
Remove or merge everything else.
The yardstick: how a lean instruction file should make the agent behave
This is your reference for what "good" looks like. A well-tuned instruction file pushes the agent toward:
For simple, local, and reversible tasks:
- Direct action, not a plan, assumption list, or confirmation loop.
- The cheapest relevant check.
For non-trivial tasks:
- Inspecting only relevant files, conventions, configuration, and tests.
- The smallest solution that fulfills the request.
- Validation proportional to blast radius and risk.
And asking one concise question only when a missing answer materially risks an incorrect, incompatible, destructive, costly, or insecure outcome — otherwise making the most reasonable low-risk assumption and mentioning it only if it matters.
When you audit a file, the file is the thing being judged and this behavior is the ruler. Flag any instruction that pushes the agent the other way: mandatory planning steps, redundant confirmations, or validation heavier than the actual risk warrants.
Review process
Identify the file's scope:
- Global, project, directory, task-specific, or system-level
- Determine which instructions belong elsewhere
Extract the intended outcomes:
- Speed, safety, code quality, tool choice, style, communication, or workflow
Audit every rule:
- Is it actionable?
- Is it specific enough to guide behavior?
- Is it redundant with another rule?
- Is it absolute where it should be conditional?
- Does it require unnecessary planning, questions, tool calls, or validation?
- Does it conflict with project conventions or other instructions?
- Would its absence plausibly cause a meaningful failure?
Classify each rule:
- Keep
- Rewrite
- Merge
- Move to local documentation
- Remove
Produce a lean replacement that preserves only high-value constraints.
Rules to reject by default
Remove or challenge instructions that:
- Require asking permission before ordinary requested code changes
- Require a plan, explanation of assumptions, or status report for every task
- Require Git inspection before every small local change
- Require tests, full builds, or broad checks for every change
- Forbid standard tools absolutely when the project may rely on them
- Impose global naming or style rules that local project conventions should decide
- Invite unrelated cleanup, refactoring, formatting, or "making the codebase better"
- Duplicate instructions already handled by linters, formatters, tests, CI, or the agent harness
- Use vague language such as "be smart", "ensure quality", or "think carefully"
- Add abstractions, dependencies, configurability, or edge-case handling without a demonstrated need
Required output
Reply in this exact structure.
Verdict
State whether the file should be kept, shortened, split, or replaced.
Critical issues
List only issues that materially affect speed, reliability, or instruction conflicts.
For each issue, include:
- Existing rule or concept
- Why it is harmful, redundant, vague, or misplaced
- Recommended action
Proposed file
Provide a complete replacement in one Markdown code block.
Optional local rules
List only rules that should live in project-level or directory-level instructions instead.
Rationale
Use at most five bullets. Explain the main tradeoffs and any deliberate omissions.
Do not include a long theoretical explanation. Do not preserve wording merely because it appears authoritative. Do not invent project facts, commands, tools, conventions, or risks.
1---2name: optimize-agent-instructions3description: Lean audit and rewrite workflow for agent instruction files such as AGENTS.md, CLAUDE.md, system prompts, rules files, and skill instructions. Use when the agent needs to clean up, shorten, or refactor an instruction file, remove redundant or contradictory rules, reduce unnecessary planning, questions, or validation steps, fix a CLAUDE.md or AGENTS.md that feels too long or too strict, review a skill's instructions for leanness, or consolidate overlapping project rules into a minimal high-signal replacement. Déclenche aussi sur les requêtes en français, par exemple alléger, raccourcir, nettoyer ou réécrire un fichier d'instructions (AGENTS.md, CLAUDE.md, prompt système, fichier de règles, skill), supprimer les règles redondantes ou contradictoires, simplifier un CLAUDE.md ou AGENTS.md trop long ou trop strict, ou consolider des règles projet qui se chevauchent en un fichier minimal.4---56# Optimize Agent Instructions78## Mission910Improve a provided agent instruction file such as AGENTS.md, CLAUDE.md, system prompt, rules file, or skill instructions.1112Optimize for:13- Correctness and safety proportionate to actual risk14- Fast, direct execution for simple tasks15- Minimal, non-redundant instructions16- Clear decision thresholds17- Compatibility across coding models and agent harnesses1819Do not optimize for maximum caution. Do not add rules merely because they sound like good engineering practice.2021## Core principle2223Every instruction has a cost. Keep a rule only when it:24- Prevents a recurring or costly failure25- Provides information the agent cannot reliably infer from the repository26- Is universal for the file's scope27- Does not conflict with another rule28- Can be stated clearly and acted on consistently2930Remove or merge everything else.3132## The yardstick: how a lean instruction file should make the agent behave3334This is your reference for what "good" looks like. A well-tuned instruction file pushes the agent toward:3536For simple, local, and reversible tasks:37- Direct action, not a plan, assumption list, or confirmation loop.38- The cheapest relevant check.3940For non-trivial tasks:41- Inspecting only relevant files, conventions, configuration, and tests.42- The smallest solution that fulfills the request.43- Validation proportional to blast radius and risk.4445And asking one concise question only when a missing answer materially risks an incorrect, incompatible, destructive, costly, or insecure outcome — otherwise making the most reasonable low-risk assumption and mentioning it only if it matters.4647When you audit a file, the file is the thing being judged and this behavior is the ruler. Flag any instruction that pushes the agent the other way: mandatory planning steps, redundant confirmations, or validation heavier than the actual risk warrants.4849## Review process50511. Identify the file's scope:52 - Global, project, directory, task-specific, or system-level53 - Determine which instructions belong elsewhere54552. Extract the intended outcomes:56 - Speed, safety, code quality, tool choice, style, communication, or workflow57583. Audit every rule:59 - Is it actionable?60 - Is it specific enough to guide behavior?61 - Is it redundant with another rule?62 - Is it absolute where it should be conditional?63 - Does it require unnecessary planning, questions, tool calls, or validation?64 - Does it conflict with project conventions or other instructions?65 - Would its absence plausibly cause a meaningful failure?66674. Classify each rule:68 - Keep69 - Rewrite70 - Merge71 - Move to local documentation72 - Remove73745. Produce a lean replacement that preserves only high-value constraints.7576## Rules to reject by default7778Remove or challenge instructions that:79- Require asking permission before ordinary requested code changes80- Require a plan, explanation of assumptions, or status report for every task81- Require Git inspection before every small local change82- Require tests, full builds, or broad checks for every change83- Forbid standard tools absolutely when the project may rely on them84- Impose global naming or style rules that local project conventions should decide85- Invite unrelated cleanup, refactoring, formatting, or "making the codebase better"86- Duplicate instructions already handled by linters, formatters, tests, CI, or the agent harness87- Use vague language such as "be smart", "ensure quality", or "think carefully"88- Add abstractions, dependencies, configurability, or edge-case handling without a demonstrated need8990## Required output9192Reply in this exact structure.9394### Verdict9596State whether the file should be kept, shortened, split, or replaced.9798### Critical issues99100List only issues that materially affect speed, reliability, or instruction conflicts.101102For each issue, include:103- Existing rule or concept104- Why it is harmful, redundant, vague, or misplaced105- Recommended action106107### Proposed file108109Provide a complete replacement in one Markdown code block.110111### Optional local rules112113List only rules that should live in project-level or directory-level instructions instead.114115### Rationale116117Use at most five bullets. Explain the main tradeoffs and any deliberate omissions.118119Do not include a long theoretical explanation. Do not preserve wording merely because it appears authoritative. Do not invent project facts, commands, tools, conventions, or risks.