behavior-safe-code-repair
Repair ESLint errors and TypeScript build failures using a behavior-safe, risk-aware workflow that preserves business logic and chooses appropriate test strategies based on impact.
适合你,如果经常修复 ESLint 或 TypeScript 错误且担心改坏业务逻辑
npx oh-my-skill add quanxiaoxiao/quan-skills/behavior-safe-code-repaircurl -fsSL https://oh-my-skill.com/install.sh | bash -s -- quanxiaoxiao/quan-skills/behavior-safe-code-repairnpx oh-my-skill verify quanxiaoxiao/quan-skills/behavior-safe-code-repair怎么用
商店整理自技能原文 · 版本 f6f857f · 表述以原文为准修复代码中的 ESLint 错误和 TypeScript 构建失败,同时保持业务逻辑不变。
当代码出现 ESLint 错误、TypeScript 类型检查或构建失败,或需要升级严格性时触发。
技能原文 SKILL.md
Behavior-Safe Code Repair
Repair lint, typecheck, and build failures without silently changing business behavior.
Use This Skill
Use this skill when the task involves:
- ESLint failures
- TypeScript typecheck or build failures
- strictness upgrades that surface latent defects
- refactors required only to satisfy lint or types
- repairs where green checks are necessary but not sufficient
When NOT to use
Do not use this skill when:
- the task is pure formatting or a safe lint autofix
- the user is asking for a feature or behavior change
- generated code should be fixed at the generator instead
- the work is really an architectural refactor rather than a scoped repair
Pre-Read Order
Read the target repository first:
README.mdpackage.json- the failing scripts and current error output
- existing tests that cover the affected area
Then load bundled guidance from this skill pack:
../../prompts/lint-build-repair.md../../checklists/lint-build-repair-checklist.mdreferences/risk-and-test-matrix.md
Workflow
- Classify the failure before editing. State whether the root cause is mechanical, behavior-preserving, or behavior-sensitive.
- Choose a test policy from the matrix. Pick between no new tests, fix-then-test, test-before-fix, or higher-level coverage. Explain why.
- Repair the root cause with the smallest justified diff. Fix upstream type or contract mismatches before downstream symptoms. Separate mechanical cleanup from logic edits when possible.
- Preserve runtime truth. Do not distort working behavior just to satisfy TypeScript. Avoid
any,as any, blind non-null assertions, swallowed errors, or weakened validation unless explicitly justified.
- Add or update protection only where it buys safety. Reuse meaningful existing tests first. Add targeted regression coverage when the repair touches branching, validation, lifecycle rules, or caller-visible behavior.
- Verify with repository scripts. Prefer the repository's own
lint,typecheck,build,test, integration, or Hurl commands over ad hoc substitutes.
Reference Guide
Load these only when needed:
references/risk-and-test-matrix.mdfor risk levels, test policies, heuristics, and stop conditions../../prompts/lint-build-repair-with-tests.mdwhen the task explicitly includes test authoring
Verification
Run the relevant repository scripts for the affected scope:
npm run lintnpm run typechecknpm run build- relevant test, integration, or Hurl commands when the repair is not purely mechanical
If a script does not exist or cannot run, report that explicitly and state the residual risk.
Output Contract
Return results in this order:
Issue SummaryRisk LevelTest DecisionChanges MadeValidation ResultsResidual Risk