Skill and Rule Cleanup for Coding Agents Under Strong Instruction Following

    Coding agents now follow instructions literally, which turns broad skill descriptions and always-on repository rules from harmless padding into recurring context, latency, and conflict costs. This article explains how to clean up agent skills and repository guidance without removing necessary safeguards. It covers replacing broad domain-word triggers with task predicates, moving from mandatory reading lists to task-based context routing, establishing rule priority and conflict arbitration, and validating changes through replay samples. It also identifies which high-cost constraints should remain visible or conditionally loaded, and how teams can prevent new global rules from recreating the same problem. The goal is not fewer standards, but standards that appear only when the current task needs them.

    Coding agents have moved from often missing instructions to carefully executing every constraint authors write. In earlier stages, teams often compensated for weaker instruction following by making skills broad and turning repository guidance into a mandatory reading list before any action. With weaker-following models, those phrases were often ignored and caused few visible side effects. With strong-following models, the same text can be executed literally: a skill may be judged relevant and loaded in full, documents may be reread repeatedly, and conflicting rules may cause the agent to stop early and wait for confirmation. The goal of cleanup is not to remove standards. It is to ensure that standards take effect only on the tasks they are meant to govern.

    Why Old Practices for Weak Instruction Following Stop Working

    Early agents had three common defects: they did not know which authoritative documents existed, they did not distinguish task types, and they followed long instructions inconsistently. Teams compensated in three ways:

    • Writing skill descriptions with broad domain terms, such as “use when data, queries, models, or persistence are involved,” and expecting the model to infer relevance.
    • Writing repository-level rules as unconditional prerequisites, such as “before every edit, read the architecture, data, and release guides.”
    • Putting checklists, counterexamples, and historical incidents into the same always-on context.

    Those compensations reduced the chance of missed migrations and overlooked boundaries at the time. Strong instruction following changes the cost structure. The model no longer treats broad sentences as suggestions; it treats them as executable predicates. If a query, field, or configuration appears in the current diff, the model may decide that a skill matches. If a rule says “every time,” the model may open three long documents even when changing a line of copy or fixing a style issue. The result is often not more safety but four simultaneous losses.

    First, the context fills with irrelevant material. Once skill bodies, review steps, and reference snippets enter the window, later reasoning has to work around them, and the density of useful information falls. Second, tokens and latency increase. The same files may be read repeatedly within one turn, and the same skill may be injected repeatedly across turns, slowing progress without necessarily improving correctness. Third, conflicts become more visible. When two broad rules are both “mandatory” but cannot be satisfied at the same time, the model tends to ask a person, wait, or refuse to continue, turning a locally completable change into a blocker. Fourth, hallucination and excessive caution reinforce each other. After the window is filled with unused architectural narrative, the model is more likely to apply unrelated constraints to the current change; at the same time, fear of violating a vague prohibition can escalate an ordinary logic change into a process requiring human approval.

    Cleanup is therefore not a matter of style preference. It is context engineering under strong instruction following: exchange narrower triggers for more stable behavior.

    Skill Triggers: From Domain Terms to Task Predicates

    Think of a skill as an operating procedure that is loaded only when its conditions are met. A skill should define at least its trigger conditions, the scope in which it must not be used, the steps to execute, and completion criteria. Problems almost always start with the trigger.

    Poor triggers use category nouns whose coverage is close to half the system: database, query, model, persistence, configuration, API. A developer changing an object mapping, fixing a simple query, or adjusting an unstructured field may all be counted as “data-related.” Once the skill matches, migration procedures, rollback checks, and review checklists enter the context even if the user is only changing display logic.

    A usable trigger describes the type of change being made, not the technical nouns the change may touch. Narrow “use when data-related capabilities are involved” to “add or modify a schema migration, or review its rollout and rollback.” After that change, an ordinary query fix no longer automatically loads the migration procedure. A useful test is: an ordinary change that does not intend to touch the process should not literally satisfy the trigger.

    In practice, reduce each skill to a structure like the following, using neutral, checkable language rather than slogans:

    1. Name: Schema migration
    2. Enable when: Adding or modifying a migration script, or reviewing its release, compatibility, and rollback.
    3. Do not enable when: Only changing queries, object mappings, or API field validation without changing the storage structure.
    4. When enabled, complete:
    5. 1. Describe the impact of the change on existing data.
    6. 2. Provide a forward-compatible or phased release approach.
    7. 3. State how to stop and roll back on failure.
    8. Completion criterion: A person who did not author the change can use the change description to decide whether it can be released.

    The “do not enable” clause is as important as the enable clause. A strong-following model will use exclusions to shrink the match surface; with only broad positive terms, it tends to assume that the skill probably applies. Exclusions should name concrete actions rather than introducing another set of broader terms.

    Triggers should also avoid hidden universal quantifiers: always, every time, any change, all modules, by default. These turn a conditional skill into a resident one. If a constraint truly applies globally, write it as a very short invariant instead of making an entire manual default-loaded.

    Use a Routing Table Instead of Reading Everything Every Time

    “Before editing, read the architecture, data, and release guides” was a reasonable crutch in the early stages: if the model would not read, people forced it to read. Now the literal meaning is executed. Even changing a single string may cause three documents to be read once, and the next edit may read them again. If the documents are long, the context is quickly occupied by duplicate content, while the actual diff is pushed toward the edge. Hallucination and missed edits both increase.

    Prefer retrieval based on the task over mandatory reading based on time. Routing answers the question, “Which class of decision needs which authoritative material?”

    Current task Material to load Material not needed
    Adjust service boundaries, call relationships, or ownership Boundary and dependency sections of the architecture guide The full release manual
    Change storage structure or run a migration Table structures and compatibility rules in the data guide Historical chapters unrelated to the current table
    Prepare a release, canary, or rollback Steps and checklists in the release guide UI copy standards
    Routine UI or copy defect Local notes next to the component Full architecture, data, and release documents

    Put the routing table near the front of the repository guidance and state the default policy explicitly: tasks not listed do not pre-read long documents; only when a change touches the corresponding decision should the relevant section be opened, and a section should be read before an entire file. If the documentation tooling supports heading or symbol navigation, the rule should require reading by heading and prohibit unfocused full reads.

    Think of this as a small context routing table. Do not let it grow beyond what the team can genuinely maintain. Three to six task types are usually enough; a dozen ambiguous types will push the model back toward “read as much as possible.” Each row should point to one primary material. Avoid “you may also reference A, B, C, and D,” which turns routing back into full loading.

    Rules Need Arbitration, or Strong Following Will Stall

    When broad rules stack up, conflicts are often not logically new; they simply were not strictly enforced before. Typical conflicts include: one rule says “do not change public interfaces without confirmation,” while another says “immediately correct inconsistencies”; one rule says “run the full check suite on every commit,” while another says “keep small changes minimal and deliver quickly.” A weaker-following model picks one. A strong-following model notices that both cannot be satisfied and asks, waits, or stops.

    During cleanup, layer the rules and state their priority:

    1. Safety and data correctness: These must not be bypassed for speed, but their trigger scope must be narrow, covering only areas such as authentication, sensitive data, migrations, and external contracts.
    2. Repository-level invariants: Keep these extremely short, such as languages, directory responsibilities, and prohibited secret types. They are always visible, but each should be as close to one line as possible.
    3. Task skills: Load these conditionally, with steps and completion criteria.
    4. Preferences and style: If a preference can be expressed through formatting or static checks, do not write it as a natural-language prohibition.

    Conflicts within the same layer need an arbitration sentence. For example: “If the minimal diff conflicts with completing the checklist, prioritize not corrupting data and not breaking external contracts; run the remaining checks only on paths touched by this change.” Without an arbitration sentence, the model can only escalate the conflict to a person.

    Also delete sentences that cannot be verified. “Maintain high quality,” “fully consider edge cases,” and “align with the overall architecture” cannot be executed or falsified; they only create more reasons to stop and ask for confirmation. Replace them with observable outcomes: list the contracts to update, the failure paths to add, and the compatibility behavior to preserve.

    Four Steps for a Full Cleanup

    Step 1: Inventory always-on context. List repository guidance, personal habit instructions, and entries in the skill directory that are enabled by default. Flag sentences containing “every,” “always,” “any,” “all,” or “relevant.” These are the first suspects.

    Step 2: Add task predicates and exclusion scopes to every skill. Use real changes from recent weeks as thought experiments: a copy edit, a unit test change, a query change, a table change, and a release configuration change. Ask whether each one would trigger the skill. If a skill triggers clearly more often than the procedure is genuinely needed, narrow it further. Prefer a missed migration-skill trigger that a person can fix with an explicit command over a false trigger that charges a cost on every task. A missed trigger can be handled by explicit invocation; a false trigger automatically imposes cost every time.

    Step 3: Convert long documents into routes plus sections. Use stable headings inside documents to divide boundaries, structure, release, and failure handling. Rules should allow only the headings corresponding to the current task to be opened. Delete “read through everything before starting.” If a piece of material truly is necessary every time, compress it into no more than ten lines of invariants and keep the details in on-demand sections.

    Step 4: Validate with replay rather than intuition. Choose a fixed set of samples: a pure UI defect, a query fix, a mapping adjustment, a migration, a release configuration, and a cross-service contract change. Compare only behavior before and after cleanup, not prose quality: Are skills loaded incorrectly? Is the same file read repeatedly? Does the agent stop to ask questions without a clear reason? Do the key checks still appear in the migration and release samples? If material that should not appear does appear, the trigger is still too broad. If a check that should appear disappears, the trigger is too narrow; add a specific predicate rather than restoring broad terms.

    For team collaboration, tighten control over who can add global rules. If anyone can add “from now on, always” to always-on guidance, the window will be filled with slogans after a few months. A new global sentence should answer three questions: Which class of task does it apply to? What observable consequence follows from violating it? Why can it not be placed in a conditional skill? If the team cannot answer all three, the sentence should not enter the resident context.

    What to Keep After Cleanup

    A cleanup can easily overcorrect and remove constraints entirely. Keep the parts where failure is costly and the scope can be stated clearly: compatibility and rollback for structural changes, breaking changes to external contracts, secret and permission boundaries, and checks that must be seen during release. Their common property is that a mistake is hard to catch through a single local compilation. UI wording, naming preferences, and general refactoring advice should be handled by examples, formatting, and local comments rather than global skills.

    Also avoid turning routing into another rigid script. Routing defines entry points to materials, not the only solution. If a task changes both the schema and the release steps, allow the corresponding sections from both rows to be loaded at the same time, but still do not load unrelated full documents. A sentence such as “when multiple rows match, load only the sections specified by each row” can prevent the model from merging them into a full read.

    Strong instruction following is a capability, not a defect. It makes clear procedures reliable for the first time, and it makes vague procedures expensive for the first time. Convert skills from domain dictionaries into task predicates, convert repository guidance from a mandatory reading list into a context router, and leave explicit arbitration for conflicts. The team then gets not fewer standards, but standards that appear at the right moment. Routine defect fixes remain lightweight, migrations and releases still carry checks, context is no longer filled with repeated documents, and agents stop less often halfway through because rules cancel each other out.