用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/carrot-foundation/schemas --skill rule-code-preservation命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | rule-code-preservation |
| description | Preserve existing behavior during refactoring — no silent deletions or reversions |
Apply this rule whenever work touches:
*This rule governs how AI assistants interact with existing code. It exists because AI tools have a tendency to "clean up" code that looks unused, redundant, or suboptimal — often destroying intentional work in the process.
Every line of existing code was written intentionally. Do not remove, revert, or modify code outside the scope of the current task without explicit approval from the developer.
If code appears unused, redundant, or unnecessary, ask before removing it. What looks like dead code may be:
BAD behavior:
"I noticed `ExperimentalSchema` isn't used anywhere, so I removed it."
GOOD behavior:
"I noticed `ExperimentalSchema` doesn't appear to have any consumers
in this repo. Should I remove it, or is it used externally?"
Changes made in prior sessions represent completed work. Do not undo them even if they seem inconsistent with the current task.
BAD behavior:
Reverting a schema field addition from yesterday because today's task
doesn't reference it.
GOOD behavior:
Preserving all existing fields and adding the new ones requested in
the current task.
When making modifications, commit all intended changes required for the task. If incidental or out-of-scope edits are introduced, either revert them or isolate them in a clearly labeled follow-up commit/PR.
BAD behavior:
Only committing the new schema file while leaving formatting fixes
and import updates unstaged.
GOOD behavior:
Committing all modified files, noting in the commit message which
changes are auxiliary (e.g., "also fix import ordering in index.ts").
If tests fail or coverage drops, the correct response is to fix the code or add tests — never to remove existing tests.
BAD behavior:
Removing a failing test that covers an edge case to make the suite pass.
GOOD behavior:
Investigating why the test fails and fixing either the test or the
implementation to maintain coverage.
Before removing an import or export, verify it is truly unused. In a published npm package like @carrot-foundation/schemas, exports may be consumed by projects outside this repository.
BAD behavior:
Removing an export from index.ts because no internal file imports it.
GOOD behavior:
Asking the developer whether the export is consumed externally before
removing it from the public API.
When refactoring, maintain behavioral equivalence:
If existing code contains patterns that seem suboptimal, assume there is a reason. Common cases:
When in doubt, ask. Preserving working code is always safer than "improving" it based on incomplete context.
Stay within the boundaries of the current task:
Expanding scope requires explicit approval. Mention what you would like to change and why, then wait for confirmation.