Direct answer
Write negative requirements as observable boundaries. Name the behavior, files, interfaces, and design choices that must remain unchanged while Claude Code makes the requested edit. “Keep it simple” is not a boundary because it does not tell either the implementer or the reviewer what would count as a violation.
For example: “Change the invoice due-date display to use the existing account timezone. Preserve money parsing, total calculations, export field names, and unrelated date labels. Do not reformat the whole page. Surface any shared-helper change before editing it.”
These exclusions guide review; they are not automatic enforcement. A necessary dependency or shared-code change can still be correct, so the brief should require that change to be explained rather than forbidding it without inspection. Concrete win: fewer unrelated decisions enter the edit. Honest loss: a badly written exclusion can block necessary work.
Why positive goals invite extra work
A positive goal describes what should change. It rarely lists everything that should stay stable. That asymmetry leaves room for opportunistic cleanup, especially when the requested area contains old naming, mixed styles, or duplicated logic.
Extra work can look helpful in isolation. Renaming a nearby variable may improve readability. Extracting a helper may reduce duplication. Updating a dependency may remove a warning. None of those changes follows from the original request unless the requirement owner approves the widened scope.
The cost appears in several places. Reviewers must separate necessary edits from improvements that were never requested. A shared interface change can affect callers outside the task. A formatting pass can obscure the behavioral diff and make a later rollback harder to reason about.
A negative requirement counters that drift by naming protected behavior before execution. It should be specific enough that a proposed edit can be compared with it. “No unrelated changes” is a useful intention, but “preserve the export field names and total calculation” gives the reviewer a concrete check.
Official prompting guidance calls for clear, explicit instructions and specific output formats (F007). Explicit wording can still be misinterpreted, so the resulting diff remains the authoritative place to inspect scope.
The Claude Code overengineering analysis diagnoses the broader tendency toward large responses. This article stays with the requirement layer: how to describe the edge of the task without turning scope control into a review-process redesign.
Evidence and its limits
Official, F007: Claude prompting best practices calls for clear, explicit instructions and specific output formats. A negative requirement uses that clarity to name exclusions, but the guidance does not make those exclusions self-enforcing.
Independent, F008: A software requirements specification guide lists constraints and assumptions as places to document technical guardrails and other limits. This evidence came from the search index only; the full page was not fetched. Treat it as vendor guidance, not a universal requirements standard.
Independent, F009: The refactoring chapter defines refactoring as maintainability improvement without affecting system behavior. That definition supplies a useful model for protected behavior. It states a goal, not proof that a generated edit preserved behavior.
Official, F014: In plan mode, Claude Code reads files and proposes a plan but makes no edits until the user approves. Use that boundary to review exclusions before implementation. Approval does not guarantee that the plan is complete or that execution stayed inside it.
No verified community report is used. The fact pack contains no reproducible run measuring the effect of negative requirements on diff size or defect rates. The method below is an editorial workflow, not a benchmark claim.
Identify protected behavior
Start with behavior that would be expensive or surprising to alter accidentally. Money calculations, permission decisions, public response fields, and durable side effects usually deserve explicit protection when they sit near the requested change.
A protected behavior should be named as an observable contract. “Totals remain unchanged for the same inputs” is stronger than “do not touch billing.” The first statement can be checked against a fixture; the second leaves the protected surface undefined.
Do not protect behavior merely because it exists. A known bug may need correction, and an inconsistent interface may be the actual target. The requirement owner should distinguish intentional contracts from accidental implementation details.
Ask what a caller, user, or downstream system would notice if the behavior changed. That question often reveals a better boundary than a file list. A helper can move without changing behavior, while a small field rename can break a caller despite a tiny diff.
| Protected item | Observable boundary | Evidence to inspect | Why protect it |
|---|---|---|---|
| Total calculation | Same inputs produce the same total | Existing invoice fixture | Financial behavior is outside the task |
| Export schema | Field names and order stay stable | Current exported row | Downstream consumers may depend on shape |
| Permission decision | Same role sees the same action | Authorized and unauthorized states | Security behavior is not visual cleanup |
| Date labels outside the target | Existing wording remains | Adjacent screen state | Prevents a page-wide formatting pass |
The Claude Code observable requirements guide explains how to write the positive outcome. Pair that outcome with a small set of protected behaviors rather than a long list of everything in the repository.
Identify protected files and interfaces
File boundaries reduce unnecessary exploration and editing, but they should not pretend that one file contains the whole behavior. A named file is a starting location, not proof that related call sites are irrelevant.
Use file exclusions for areas with a clear reason to stay untouched. “Leave the public API client and generated schema outside this edit” is reviewable. “Do not edit other files” can block a necessary import or shared type update.
Interface boundaries matter because a small change can propagate. A renamed function, altered response field, or changed event payload may affect callers that are not visible in the immediate component. Name the interface contract when it is part of the protected behavior.
A useful exclusion includes a reason. “Preserve the export field names because the accounting import reads them” tells Claude Code why the boundary exists and gives a reviewer context if a conflict appears.
Official, F016: Claude Code best practices recommends precise prompts with file names and symptoms. Specificity narrows the search, but a prompt can still point at the wrong location. Use named files as evidence and keep an exception path for necessary related edits.
The Claude Code edit target guide covers precise replacement anchors. A scope boundary answers a different question: which surrounding areas must remain stable even if the target block changes.
Write exclusions as observable boundaries
A negative requirement becomes useful when a reviewer can decide whether it held. Use verbs such as preserve, leave, retain, and exclude, then name the artifact or behavior.
Compare these pairs:
- Weak: “Do not clean up the component.”
- Strong: “Leave neighboring date labels and layout classes unchanged.”
- Weak: “Avoid API changes.”
- Strong: “Retain the current response field names and their order.”
- Weak: “No new dependencies.”
- Better: “Do not add or upgrade a dependency unless the requested behavior cannot be implemented safely without it; report that need before changing the dependency files.”
The last version avoids an absolute rule that could force a brittle implementation. It still creates a checkpoint for a consequential choice.
Negative requirements should not contradict the positive goal. If the goal requires a new response field, an exclusion preserving every field name is too broad. Write the exception directly: “Retain existing field names; add only the requested status field.”
| Positive requirement | Negative requirement | Reviewable boundary |
|---|---|---|
| Use the account timezone for the due date | Leave other date labels unchanged | Only the due-date display changes |
| Show a validation message | Preserve existing field values and submit behavior | No data-loss or workflow change |
| Add a status field to the export | Retain existing field names and order | Only the requested field is added |
| Simplify a private helper | Preserve its callers’ observable results | Structure may change, behavior may not |
Official guidance supports clear, explicit wording, not deterministic enforcement (F007). Treat each exclusion as a question to check against the proposed plan and the resulting edit.
Distinguish necessary edits from opportunistic cleanup
Some changes are necessary even when they were not named in the original request. A shared helper may need a parameter to support the requested behavior. A type definition may need a new field. A dependency may genuinely be required.
The distinction is consequence, not appearance. A necessary edit exists because the agreed outcome cannot be delivered safely without it. Opportunistic cleanup exists because the implementer noticed an unrelated improvement while inside the code.
Require a short justification for boundary crossings. The plan should say what must change, why the change is necessary, and which protected behavior remains intact. This turns a scope exception into a reviewable decision rather than a surprise in the final diff.
Do not forbid every dependency change without checking necessity. Instead, separate dependency changes from formatting or refactoring changes and ask for explicit approval when the dependency affects runtime behavior, lockfiles, or install steps.
| Request | Classification | Required response |
|---|---|---|
| Update the target component’s due-date call | Necessary if it carries the requested behavior | Proceed within the stated boundary |
| Reformat the whole page | Opportunistic cleanup | Exclude unless separately requested |
| Add a parameter to a shared date helper | Potentially necessary | Explain caller impact before editing |
| Upgrade a date library | Potentially necessary but consequential | Surface alternatives and dependency impact |
| Rename unrelated public functions | Scope expansion | Reject or split into another task |
The Claude Code dependency install guide is relevant when a proposed dependency change has install-time effects. This article does not prescribe installation behavior; it uses that risk to justify an explicit scope checkpoint.
Resolve conflicts between goal and exclusion
A conflict appears when the requested outcome seems to require a forbidden change. Do not ask Claude Code to choose silently between them. Surface the conflict and identify which requirement needs revision.
For example, a goal may require a shared timezone helper while an exclusion says no shared helper may change. The correct response is not to build a duplicate helper automatically. The plan should explain the conflict and ask whether the shared change is approved.
A good conflict statement has three parts: the goal, the exclusion, and the consequence of each option. That gives the requirement owner enough information to make a decision without rereading the whole session.
Sometimes the exclusion is wrong because it protects an accidental detail. Sometimes the goal is too broad because it would force a risky interface change. Either resolution is valid when it is explicit.
The Claude Code ambiguity clarification guide separates code facts from product choices. Use code investigation to establish what a shared change would affect, then route the scope decision to the person who owns it.
Worked example: a due-date display correction
Suppose the request says, “Fix the invoice due date and clean up the date handling.” The first clause names a target; the second invites unbounded work.
A bounded brief could read:
Goal: Display the invoice due date using the existing account timezone while preserving the stored value. Protected behavior: Total calculation, money parsing, payment status, and the export schema remain unchanged. Protected files: Leave the payment processor and public API client untouched unless the plan demonstrates that the goal cannot be met without them. Excluded cleanup: Do not rename unrelated date helpers, reformat the page, or update dependencies as part of this correction. Exception path: If the current date helper cannot represent the account timezone, explain the smallest necessary change and its affected callers before editing. Evidence: Inspect the due-date display for an account with a known timezone and confirm that the stored value and export fields remain stable.
The brief gives Claude Code a precise outcome and a defined edge. It does not dictate whether the fix belongs in a component, a formatter, or a shared helper. Investigation can choose the method while the exclusions remain visible.
Derived arithmetic for scope review: The illustrative page has five date labels. The request names one due-date label as in scope, so excluded labels = 5 - 1 = 4. A plan that changes all five labels crosses the stated boundary. This arithmetic checks the example’s scope; it is not a measured diff statistic.
A second check concerns the export. If the current export has four fields and none is the due-date display, the display correction should leave exported fields = 4. A new export field would be a separate requirement, not an incidental improvement.
The concrete win is that a reviewer can reject page-wide formatting without debating the timezone fix. The concrete loss is that the count-based example does not reveal shared behavior: changing a helper could affect more code than the visible label count suggests.
Confirm the boundary in plan mode
Ask the plan to list proposed files, protected behaviors, and any requested exception. Official documentation says plan mode permits research and proposal while keeping edits closed until approval (F014).
Review the boundary before reviewing implementation detail. A plan that includes a payment-processor edit needs a necessity explanation. A plan that proposes a dependency upgrade needs a reason tied to the goal. A plan that stays inside the target component still needs to show how shared behavior remains protected.
Useful approval questions include:
- Which proposed edit would change a protected behavior?
- Which file is outside the original target, and why is it necessary?
- Does the plan include cleanup that can be removed without affecting the goal?
- What evidence will show that the export and stored value stayed stable?
Plan approval establishes a human checkpoint, not automatic enforcement. If execution later crosses a boundary, compare the actual edit with the approved plan and the original brief.
The Claude Code plan mode approval guide provides the broader approve, revise, or stop method. Negative requirements make that review more specific because the plan must account for what should not change.
Reject unrelated changes after execution
After the edit, inspect scope separately from correctness. A change can be well implemented and still outside the request.
Start with changed paths, then inspect the behavioral diff. Formatting-only changes can be removed when they obscure the target. Shared-code changes need their approved justification. New dependencies need the separate approval described in the brief.
Do not reject a necessary change solely because it was not listed in the first file guess. Reject it when the necessity is absent, the impact was hidden, or the change creates unrelated behavior. The boundary is a decision aid, not a mechanical file allowlist.
| Post-edit finding | Decision | Reason |
|---|---|---|
| Target display changed; totals stable | Accept if behavior matches | Inside goal and boundary |
| Whole page reformatted | Remove or split out | Unrelated cleanup obscures review |
| Shared helper changed with approved caller impact | Accept after inspection | Necessary exception was reviewed |
| Export fields renamed without approval | Reject or restore | Protected interface changed |
| Dependency upgraded without necessity | Revert or review separately | Consequential scope expansion |
The Claude Code verification guide explains why a summary is not proof. For scope, the changed files and actual diff matter more than a claim that the edit was minimal.
Practical checklist
Apply these checks before asking for the edit and again when reviewing the result.
- Name the positive outcome. A boundary cannot protect an undefined target.
- List protected behavior. Focus on contracts a user, caller, or downstream system can observe.
- Name protected files and interfaces. Give a reason when the boundary is not obvious.
- Replace vague exclusions. Trade “keep it simple” for concrete statements.
- Allow necessary exceptions. Require an explanation instead of banning every adjacent change.
- Separate cleanup. Formatting, renaming, and unrelated refactoring need their own request.
- Review the plan. Check proposed paths and boundary crossings before approval.
- Inspect execution. Accept necessary work, remove unrelated work, and record unresolved conflicts.
| Brief element | Pass condition | Failure response |
|---|---|---|
| Protected behavior | Observable and relevant | Replace broad area names |
| File exclusion | Reason is clear | Narrow or explain the exception |
| Dependency rule | Necessity can be reviewed | Remove the absolute ban |
| Conflict path | Owner can decide | Pause the affected change |
| Post-edit scope | Diff matches approved boundary | Reject or split unrelated work |
The practical implication for a developer is to define the edge of the task with the same care as the center. A narrow outcome plus explicit protections is easier to review than either a vague goal or a long list of forbidden files.
Concrete win, honest loss, and implication
Win: In the due-date example, the requested display can change without turning into a page-wide date cleanup. The reviewer has named protections for totals, stored values, and export fields.
Loss: An exclusion can be too strong. If the only safe implementation requires a shared helper change, an absolute “do not touch shared code” rule can force duplication or delay the correct fix. F009 describes behavior preservation as a refactoring goal, not proof that a restricted edit achieved it.
Implication: Use negative requirements when nearby code invites unrelated improvement or when a small edit could affect a shared contract. Keep the list short, observable, and open to a justified exception.
The Claude Code refactoring scope guide develops the behavior-preserving case. For ordinary feature work, the same discipline applies: separate the requested structural or visual change from behavior that must remain stable.
Connect scope boundaries to the batch
Begin with observable outcomes for vague requirements, then use separate goal, rule, and example blocks to keep exclusions visible.
Representative behavior belongs in acceptance examples with observable results. Conflicts need clarification before choosing.
Concrete pointers help when naming files, symbols, and exceptions. Direction should pass plan mode approval before editing.
Unknown implementation paths benefit from exploration plans that resolve unknowns. Execution steps need checkable exit conditions.
Do not hide dependencies in the prose. Read-before-edit plan dependencies keeps necessary ordering explicit.
When evidence changes the boundary, use plan revision for new evidence. Sequence low-impact work through reversible planning with small steps.
Project-wide instructions belong in essential CLAUDE.md content, while narrow rules can follow progressive disclosure by path.
Evidence should stay relevant under context relevance and evidence selection. Contradictions need clear instruction precedence, not more emphasis.
Visual evidence does not define behavior alone. Pair it through image prompts with written constraints, and add file references without repository noise.
Audit existing inputs with the loaded-context review. Request investigation before an answer when the protected contract is unclear.
Independent reads may use parallel calls without conflicting edits. API integrations should respect structured briefs on supported surfaces.
Tool evidence needs result contracts rather than opaque status. Deferred loading and schemas remain API-specific in deferred tool discovery and unambiguous tool schemas.
Long tasks benefit from inspectable checkpoints. Precise edits use exact target blocks and local style patterns.
Structural work should preserve refactoring behavior contracts, then end at explicit stop conditions. A later engineer can recover the boundary through the session handoff guide.
Data gap and future update
The research register contains no verified benchmark for negative requirements, exact scope fences, or behavior-preserving generated edits. No reduction in diff size, defects, or review time is claimed.
The requirements guide is search-index evidence only, and the independent evidence base is narrower than the official product evidence. A future update can replace it with an accessible primary requirements source if one is verified.
Rolling documentation can change. Recheck the official pages before publication and preserve the distinction between an instruction boundary and deterministic enforcement.
One AI API Key option for OpenAI-format agents
One AI free IDs are not a Claude Code model source. Claude Code uses an Anthropic-format route, and the packet records Claude IDs as unavailable on 2026-11-27.
For a separate OpenAI-format agent, One AI API Key provides https://api.oneaiapikey.com/v1, one key, and 46 live free IDs. That option does not change Claude Code’s route or make its free IDs compatible. Review the free model list before selecting an agent integration.
FAQ
Are negative requirements automatically enforced?
No. F007 supports explicit wording but does not establish enforcement. Review the proposed plan and the actual edit against each boundary.
Should a dependency change always be forbidden?
No. A dependency change may be necessary. Require the plan to explain the need and impact, then approve or reject that exception separately from unrelated cleanup.
What makes a file exclusion useful?
A clear reason and an exception path. “Leave the public client unchanged because downstream callers depend on its fields” is more useful than “do not edit other files.”
Does behavior preservation prove a refactor is safe?
No. F009 defines behavior preservation as a refactoring goal. A generated edit still needs inspection, and structural similarity alone does not prove that behavior stayed stable.
Sources
- Official: Claude Code best practices, supporting precise file and symptom pointers (F016).
- Official: Claude prompting best practices, supporting explicit instructions and output formats (F007).
- Independent: Software requirements specification guide, search-index evidence only for constraints and assumptions (F008).
- Independent: Refactoring chapter, supporting the behavior-preservation definition and its limits (F009).
- Official: Claude Code tools reference, included as further reading; no unseen tool mechanics are asserted here.