跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
开发与测试

minimal-code-changes

Enforce minimal, narrowly scoped modifications when implementing features, fixing bugs, changing tests, updating configuration, or otherwise editing an existing codebase — no opportunistic renaming, reformatting, abstraction, dependency upgrades, architecture changes, or unrelated fixes; an explicitly requested refactor is allowed but kept strictly within the named scope. Use when the user explicitly asks for a minimal change — "minimal diff", "minimal code changes", "smallest possible change", "surgical change", "only change what's needed", "don't touch anything else", "don't touch unrelated code", "keep the existing structure", "no refactors", or "cambios mínimos". Not for ordinary edits that don't ask for a minimal scope.

glrodasz · 已有静态检查记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add glrodasz/dotfiles --skill minimal-code-changes

技能说明


name: minimal-code-changes description: > Enforce minimal, narrowly scoped modifications when implementing features, fixing bugs, changing tests, updating configuration, or otherwise editing an existing codebase — no opportunistic renaming, reformatting, abstraction, dependency upgrades, architecture changes, or unrelated fixes; an explicitly requested refactor is allowed but kept strictly within the named scope. Use when the user explicitly asks for a minimal change — "minimal diff", "minimal code changes", "smallest possible change", "surgical change", "only change what's needed", "don't touch anything else", "don't touch unrelated code", "keep the existing structure", "no refactors", or "cambios mínimos". Not for ordinary edits that don't ask for a minimal scope.

Minimal Code Changes

Implement the requested behavior with the smallest correct semantic diff.

Treat code outside the necessary change boundary as read-only. Set the default refactor budget to zero. Do not improve code merely because an improvement becomes apparent while working nearby.

Minimal does not mean cryptic or fragile. Keep the patch correct, maintainable, and consistent with the existing local style without expanding its scope.

Priorities

Apply these priorities in order:

  1. Satisfy the requested behavior correctly.
  2. Preserve existing behavior outside the request.
  3. Minimize the semantic and textual diff.
  4. Follow the codebase's existing local conventions.
  5. Improve elegance only within the lines that must change.

Refactor gate

Permit a refactor only when every condition below is true:

  1. It is directly necessary to implement the requested behavior correctly or to prevent a regression introduced by the patch.
  2. No narrower implementation is reasonably available.
  3. It remains inside the smallest enclosing function, component, module, or explicitly requested area.
  4. It preserves external behavior except for the requested change.
  5. It can be validated with focused checks.

Code cleanliness, stylistic preference, duplication reduction, modernization, or future flexibility alone are not sufficient reasons.

When a broader refactor is truly unavoidable, keep it as small as possible and explicitly explain why it was required. Do not use it to include adjacent improvements.

Changes forbidden by default

Do not perform any of the following unless explicitly requested or required by the refactor gate:

  • Rename variables, functions, types, files, directories, or public symbols.
  • Move code between files or reorganize modules.
  • Extract helpers, introduce generalized abstractions, or redesign interfaces.
  • Replace design patterns, libraries, frameworks, or APIs.
  • Add, remove, or upgrade dependencies.
  • Change public contracts, schemas, data models, or configuration shapes.
  • Reformat untouched code or reorder imports across unrelated sections.
  • Run repository-wide formatters, linters with auto-fix, codemods, or generators that create broad churn.
  • Fix unrelated bugs, warnings, type errors, security findings, spelling, comments, or dead code.
  • Expand error handling beyond the path affected by the request.
  • Rewrite tests simply to make them cleaner.
  • Modify generated files when changing their source is sufficient.

A serious unrelated issue, including a pre-existing one that blocks validation, may be reported as a separate follow-up, but must not be folded into the patch without authorization unless leaving it untouched would make the requested implementation immediately unsafe.

Examples

Add a timeout to one request

Do: Pass the timeout through the existing client call and update the focused test.

Do not: Introduce a new HTTP client factory, rename environment variables, centralize all request settings, or upgrade the HTTP library.

Fix a null-value crash in a parser

Do: Add the narrowest guard at the failing path and add a regression test.

Do not: Rewrite the parser, redesign its return type, rename neighboring fields, or clean up unrelated branches.

Add one field to an existing response

Do: Update the responsible mapping, its type only if required, and focused tests.

Do not: Reorganize the response layer, replace the serializer, or normalize every related endpoint.

Explicitly requested refactor

Do: Refactor only the named service, component, or pattern and preserve behavior with focused validation.

Do not: extend the refactor into adjacent modules simply because they use similar code.

Phase 1 — Define the change contract

Before editing, identify:

  • The exact requested outcome.
  • The narrowest relevant file, symbol, function, component, or configuration entry.
  • The existing behavior that must remain unchanged.
  • The focused validation needed to prove the change.

When the request is ambiguous, choose the least expansive reasonable interpretation and state the assumption. Do not silently broaden the task.

Phase 2 — Inspect narrowly

Read enough surrounding code to understand the target and its immediate dependencies. Search for existing patterns that the patch should follow.

Do not turn repository exploration into a cleanup exercise.

Phase 3 — Establish the change boundary

Use this default boundary:

  • Primary boundary: the exact function, class, component, module, or configuration entry responsible for the requested behavior.
  • Secondary boundary: immediate callers, dependencies, types, or tests only when the primary change cannot work correctly without them.
  • Outside the boundary: read-only unless the user explicitly expands the scope.

Prefer changing an existing condition, branch, argument, or local implementation over introducing a new abstraction.

Phase 4 — Implement surgically

阅读完整来源 ↗