AI Coding Skills Should Be Swapped Per Problem, Not Fixed in Place

    This article argues that treating one heavily reused AI coding workflow as a permanent default is riskier than the occasional wrong line of code from a model. It explains how one-shot generation turns a missing boundary into a repository-wide change, how a replaceable discipline differs from a framework, and what a usable specification of goals, authoritative sources, invariants, blast radius, and acceptance cases looks like. It also covers when to switch between code alignment, domain modeling, minimal reproduction, and direct fixes; how to keep each generation step small and reversible; what code review should check; and how to divide work between people and assistants. Readers get a thin, disposable skill catalog model that preserves both changeability in the code and human veto power.

    Putting a single, repeatedly reused AI coding workflow on a pedestal is often more dangerous than a model that occasionally writes a wrong line. On the surface, the more fixed the process, the more stable the output. In practice, once the problem type changes, a fixed process amplifies a wrong premise into a repository-wide change. The safer approach is to treat a skill as a discipline that is executable, disposable, and composable, rather than a framework you owe long-term loyalty to.

    Failures usually start with “say it all at once”

    A common scenario: you ask a coding assistant to add access control to an existing system. It touches dozens of files in a very short time, and after compiling or running, you get null references. You ask it to keep fixing, and it drags in new branch-condition errors, duplicated validation, and inconsistent error codes. Looking back at the code, the naming is convoluted, comments contradict the implementation, and the same rule is written once each in the interface layer, the service layer, and the data access layer. Three months later a requirement changes only the scope of one role, and nobody dares touch it, because nobody can point to which rule is the authoritative source.

    This is not a case of your prompt not being eloquent enough. It is a task treated as one-shot generation instead of a constrained engineering change. For permissions, billing, state machines, and data consistency, what is missing first is boundaries and invariants, not more files.

    Discipline versus framework: can you throw it away?

    A framework aims for coverage: one set of steps claims to apply to planning, design, implementation, review, and refactoring. A discipline aims for specificity: it constrains only the current class of decisions and can be replaced as soon as it is used up.

    A replaceable discipline usually meets four conditions:

    • Explicit trigger. For example, the alignment process is enabled only when “the change spans multiple modules and the rules come from existing code.”
    • Inspectable output. Not a vague plan, but a rule list, invariants, blast radius, and acceptance cases.
    • A way out on failure. If you discover that domain boundaries matter more than document alignment, switch to a modeling process instead of forcing the old one because of sunk cost.
    • No binding to a tool shape. The same discipline can be executed through a conversation, a checklist, or a code review template; it does not depend on one specific command name.

    Whoever keeps a skill enshrined has not yet learned to use it. Today “align with existing code first” fits; next week, when the core difficulty turns out to be unclear concepts, switch to domain modeling; the week after, if it is only a local defect, go straight to a minimal reproduction and a regression test. No hesitation, no nostalgia.

    The industry shows similar signals: a prompting process that was once widely bookmarked is no longer recommended by its maintainer as the default starting point, who instead suggests aligning with the code first or clarifying the domain model first. That is not self-contradiction; it is admitting that defaults expire. The value of a default recommendation is lowering the cost of getting started, not forbidding a different route.

    Write the invariants first, then let the model touch code

    A sound planning step should at minimum get the human and the assistant to the same wording on the following.

    1. Goals and non-goals. Control who can perform which operation; state explicitly that this change does not touch the authentication protocol, does not touch the data model, or touches only one of them.
    2. Authoritative source. Whether the rules follow the interface contract, configuration, database constraints, or existing services, so that comments, variable names, and implementation do not each tell a different story.
    3. Invariants. For example, “an unauthorized request must not write an audit success state” and “one resource has exactly one outward-facing error code for denial reasons.”
    4. Blast radius. List the modules that may be reached, and mark which are allowed to change and which are read-only references.
    5. Acceptance. Cover allow, deny, privilege escalation, and missing role with a few request samples, rather than “it looks like it runs.”

    An illustrative constraint can be written as a short spec that everyone on the team can read, not a long prompt:

    1. Rule: a resource operation must satisfy valid identity, matching role, and consistent resource ownership at the same time.
    2. Invariant: the denial path must not produce side-effect writes.
    3. Allowed changes: access checks and their unit tests.
    4. Forbidden changes: credential issuance, storage structure, unrelated interfaces.
    5. Acceptance: all four cases (allow, deny, escalation, missing role) must be repeatable.

    With this spec, the assistant’s job changes from “improvise” to “fill in the implementation within the boundaries.” Review also has something to compare against: a variable name may be ugly, but it must not violate an invariant; a comment must be falsifiable by a test.

    When to switch disciplines

    Do not use the same opening line for every task. Switch by problem shape:

    • Rules already scattered in the code, and you fear the assistant rewriting from imagination: do code alignment first. Require it to cite existing branches, configuration entries, and tests, list conflicts, then propose the minimal diff.
    • Nouns are muddled, and the same word means different things in different modules: do domain modeling first. Separate entities, roles, actions, and states, state which words must not be mixed, then move to implementation.
    • The defect reproduces reliably: skip grand planning. Write a minimal reproduction, locate the failure point, add a regression test, and limit the radius of the change.
    • Requirements are not yet stable: produce only disposable option comparisons and risks, and do not generate large amounts of code. The cost of rejecting a proposal should be lower than the cost of reworking code.

    Switching is itself part of the process. If two consecutive rounds of edits keep expanding the file scope, or new defects are unrelated to the original requirement, stop generating and go back to the constraints or the model, rather than continuing to ask for “just one more fix.”

    Keep generation in reversible steps

    Even with correct planning, you should not accept a patch spanning dozens of files in one go. A steadier rhythm:

    • Change the contract or the types first, so illegal states are harder to write.
    • Then change one validation or one state transition, with a test for that spot.
    • Solve one invariant per step, and name the corresponding rule in the commit message.
    • For generated output, first check whether the diff crosses the boundary, then whether existing tests and new cases pass.
    • If naming and comments drift from the spec, change either the spec or the code; the two must become consistent again.

    Null references, wrong branches, and “fixing one defect into another” are often a matter of step size being too large: the assistant added a null check without understanding the call order, and turned a path that should have failed early into one that continues. Moving the failure forward to the boundary is usually more effective than scattering null checks deep inside.

    Review checks whether the discipline was executed

    Code review does not need to argue about whether the prompt was good. It should check whether the output leaves a traceable discipline:

    • Is there a short rule description that is still currently valid?
    • Do the tests map directly to allow and deny, rather than covering only the happy path?
    • Does the same rule have exactly one implementation entry point, with other locations calling it rather than copying it?
    • Does this diff exceed the allowed-change list? If so, require an explanation or roll it back.
    • Three months later, when only a role scope changes, is it clear which configuration or policy to edit, without reading all the generated code?

    A team can maintain a very thin skill catalog: each entry states only the applicable scenario, input, output, exit condition, and one counterexample. The catalog is not a standard framework and does not rank entries. If a skill repeatedly makes changes larger and tests fewer, downgrade or delete it. When a new problem appears, combining two disciplines is allowed, for example modeling then alignment, but the combination still needs a single acceptance checklist.

    Division of labor between people and assistants

    Assistants are suited to enumerating the blast radius, drafting samples, filling in implementations against a spec, and pointing out inconsistencies between spec and code. People decide the non-goals, adjudicate conflicting rules, and accept or reject out-of-bounds diffs. Treating “be bolder” as a quality strategy yields longer patches, not a clearer system.

    If you use cloud-based development collaboration, code hosting, continuous integration, and log alerting, treat them only as the environment that executes the discipline: specs and tests go into the repository, failing acceptance blocks the merge, and runtime denial paths leave auditable records that can be correlated. These are general engineering facilities and cannot replace the step of writing the invariants down first.

    Conclusion

    The right posture for AI coding is not to find one forever-default skill and keep worshipping it, but to make every skill short, hard, and disposable. Be specific to today’s change: align, model, reproduce, or fix directly, whichever reduces uncertainty and the radius of the change. When a smoother method appears next week, switch. The code keeps its changeability, and people keep their veto power. That is closer to engineering itself than any process claiming to be complete.