How to Clean Up Skills and Agent Instructions as Instruction Following Improves
As coding agents become better at following instructions and interpreting context, long-lived skill files and agent instructions often need a structural cleanup. The goal is not to rewrite old wording, but to determine which rules provide information the model could not know and which merely compensate for behavior the model has already learned. Behavioral patches lose value over time; repository-specific knowledge becomes more valuable. This guide explains how to identify outdated rules, narrow trigger conditions, preserve private system knowledge, and evaluate whether the cleanup improves agent efficiency without weakening safeguards for high-risk changes.
Distinguish Between Two Types of Skills
Skill files often serve two different purposes.
The first type consists of behavioral patches: security review checklists, defensive programming language, process rules beginning with “always” or “never,” and habits that require asking for approval before taking action. These rules were created when models were more likely to miss tests, make unrelated changes, or stop too early. Their purpose was to pull the model back onto a manually defined track.
The second type contains private knowledge: internal API contracts, tenant and permission boundaries, release windows, data classifications, repository-specific directory conventions, and platform rules that cannot be inferred from public training data. As models become stronger, they are better able to apply this type of information. By contrast, increasingly forceful behavioral instructions may be followed too literally and amplify unwanted side effects.
During cleanup, tag each rule instead of sorting rules by file age. Ask three questions:
- Does the model still consistently exhibit the weakness that this rule was designed to address?
- Can the trigger be described as a specific action rather than a collection of broad nouns?
- After removing the rule, can the task still be completed using the model’s existing validation and feedback-loop capabilities?
The answers generally point to three outcomes: delete or downgrade the rule, narrow its trigger conditions, or retain it while stating the relevant facts clearly.
When Behavioral Patches Become Obstacles
Better instruction following does not mean that more commands should be added. When a model becomes more sensitive to ambiguous, conflicting, or overly broad instructions, it may pause prematurely, ask for repeated confirmation, or turn an implementation task into a question-and-answer loop. Absolute wording that was originally intended to prevent mistakes by weaker models may now be followed too thoroughly.
Three types of accidental damage are particularly common.
1. Triggers That Are Too Broad
A database migration skill might say:
Use this skill when working with databases, queries, models, or persistence.
Under this definition, changing a single object-mapping field could load an entire set of migration, rollback, and deployment checks.
A more appropriate description would be:
Use this skill only when adding or modifying migration scripts, or when reviewing migration deployment steps.
Listing related nouns makes a skill behave like a set of search keywords. Describing actions and their targets makes it behave like an applicability condition.
2. Unconditional Prerequisite Reading
Agent instructions often say:
Before every change, read the architecture, data, and release documentation in full.
Those documents may still be loaded when the task only changes a comment or fixes a spelling mistake. The irrelevant context crowds out the actual code and user goal, making later reasoning more likely to drift.
Instead, documentation should be read according to the change type:
- Read data documentation when the change affects table structure.
- Read release documentation when the change affects the release path.
- Do not load either document for a purely editorial change.
3. Repeating Behaviors the Model Has Already Internalized
Earlier models often needed repeated reminders to run tests or perform a final self-check. If a model now reliably runs relevant tests and performs basic validation before delivery, retaining rules such as “run the full test suite after every change” or “stop and ask whenever anything is uncertain” may create repeated tests and unnecessary turns rather than better results.
The same applies to disclaimers based on imagined risks, generalized security checklists, and warnings that were not requested. They consume context that should be reserved for constraints the model actually needs to follow.
A particularly rigid workflow once became common in the community: if a skill might possibly apply, it had to be invoked, and every action had to begin with a skill-selection decision. This could function as a seat belt for weak models, but for stronger models it forces natural reasoning into a fixed script. Skills should load when their conditions clearly match, not as a ritual at the beginning of every turn.
The Economics of Context
Context is not a free annotation area. Every additional skill or long instruction competes with code, error messages, and the user’s goal. The cost of an overly broad skill is usually not just “reading a little more documentation.” It can cause incorrect tool sequences, repeated approvals, and the suppression of useful default behavior by outdated rules.
A simple value assessment can help determine what to keep:
- Is the information something the model cannot reliably infer from the current repository and general public knowledge?
- Could getting it wrong or ignoring it cause an irreversible operation, a permission error, or data loss?
- Is it short enough to include in full when triggered, instead of carrying a long tutorial into every task?
If all three answers are weak, remove the information or move it out of permanently loaded instructions. If all three are strong, write it as a fact-based skill with narrow trigger conditions.
Permanent agent instructions should contain only short facts that apply across tasks, such as the default branch strategy, directories that must not be modified directly, or the requirement not to place secrets in logs. Process scripts, stylistic lectures, and hypothetical risk lists should move into on-demand skills or be left to the model’s default behavior.
How to Rewrite Skill Descriptions
The purpose of a description is to reduce accidental activation, not to demonstrate how comprehensive the skill is. A useful structure includes:
- The applicable action
- The applicable object
- Explicit exclusions
Bad example:
Use this skill when handling databases, queries, models, or persistence.Always complete the security checklist and run the full test suite after every change.
Better example:
Use this skill only when adding or modifying migration scripts, or when reviewing migration deployment steps.Do not use it for changing a mapping field name, editing comments, or optimizing queries unrelated to migrations.This skill provides the repository’s migration directory, production execution window, and rollback conventions.
The improved version separates when to use the skill from the private facts it provides. If a behavioral requirement is still necessary, express it as an observable completion condition:
After changing a migration script, document the corresponding rollback steps.
This is more useful than saying:
Always perform a complete review first.
Conflicting instructions should be consolidated. If a repository says both “commit small changes directly” and “all changes require manual approval,” a model that follows instructions closely may stop at the conflict.
Approval should be reserved for specific, reviewable outputs, such as destructive data changes, expanded permissions, or release configuration changes. It should not apply to every request that says “please make this change.” Implementation requests should normally be treated as actions unless they cross a clearly defined high-risk boundary.
How to Write Private-Knowledge Skills That Gain Value as Models Improve
The skills worth keeping should read like contracts, not like lessons from a teacher. They should ideally include:
- Resource locations: Relative repository paths for configuration, scripts, and environment entry points. Avoid hard-coded external brands or links that are difficult to maintain.
- Interface constraints: Field meanings, idempotency requirements, error-code semantics, and compatibility windows. Document only conventions that actually exist in the system.
- Platform rules: Release freeze periods, data classifications, and operations that require two-person review.
- Counterexample boundaries: Similar tasks that should not use the skill, preventing overly broad matching.
As models improve, they become better at applying these facts to the right steps. They still cannot infer your tenant model or internal terminology from general knowledge. Skills should therefore be short, verifiable, and capable of being confirmed or disproved by code and documentation.
When a skill no longer matches the repository, update the facts first. Do not add another meta-rule saying which source should take precedence. Multiple layers of “follow this source when there is a conflict” create another source of conflict.
A Practical Cleanup Process
Use the following sequence to avoid deleting old rules only to replace them with new absolute instructions:
- Inventory permanent instructions and the skill list. Mark trigger terms, absolute language, and mandatory reading requirements.
- Replay recent real-world changes, such as a spelling fix, a single-field adjustment, a new migration, and a release-configuration change. Record which skills were loaded unnecessarily.
- Delete or downgrade behavioral patches, including generic security checklists, unconditional full test runs, extremely low-threshold skill activation, and repeated disclaimers.
- Narrow the descriptions of retained skills. Add exclusion conditions and private facts, and remove statements that cannot be verified.
- Reduce the agent instructions to a page or less of stable constraints. Convert the rest to on-demand references.
- Run the same task set before and after the cleanup. Compare the number of turns, accidental activations, and whether the agent still pauses at the right high-risk points. Keep only changes that reduce useless context without reducing control over risky operations.
A concise set of agent instructions might look like this:
Complete verifiable code changes by default, and run tests that match the change before finishing.Pause and request confirmation only when the change involves data destruction, expanded permissions, or release configuration.Read data conventions only for schema changes; read release conventions only for changes to the release path.Do not load all documentation for unrelated changes.
This wording emphasizes scope and risk boundaries instead of applying “always” and “never” to every task.
How to Tell Whether the Cleanup Worked
A successful cleanup is not defined by whether the instructions sound more sophisticated. Look for four practical outcomes:
- Narrow tasks no longer load heavyweight skills.
- High-risk actions still have explicit pause points.
- Private contracts make up more of the context, while instructional lecturing takes up less.
- Similar requests require less rework and fewer unnecessary confirmation turns.
Models will continue to improve. Behavioral patches will continue to become outdated, while private contracts must be updated as the system evolves. Treat the cleanup as a recurring process for removing expired assumptions, not as a one-time wording exercise. Done well, skills and agent instructions remain a lever for reliable development instead of becoming an obstacle.
