Keep functionality unchanged, simplify code, and improve readability. Prioritize real duplication, nesting, and indirection; do not sacrifice clarity or meaningful abstractions just to reduce line count.
Scope and authorization
- By default, only handle the scope specified by the user or recent changes; expanding the scope requires user authorization.
- This Skill does not perform defect review. When the user asks to find bugs, regressions, or risks, use
review; when a suspected defect is found during simplification, do not change behavior along the way. - Actual modifications, verification, and delivery follow the current request and repository rules; invoking this Skill does not automatically authorize writes or external operations.
Simplification requirements
- First understand the callers, tests, configuration, and data formats; keep functionality, output, public API, naming, compatibility, serialization, error semantics, and user-visible text unchanged.
- Preserve necessary error handling, boundary behavior, state transitions, and abstractions that isolate side effects and express domain concepts.
- Follow the existing conventions of the target project, language, framework, and runtime; do not apply one platform's rules to other projects.
- Merge duplicate logic and reduce unnecessary nesting; use clear naming and control flow, and avoid dense one-liners with nested ternaries or hidden side effects.
- Keep responsibility-related logic together; do not force unrelated responsibilities to be merged. Comments explain intent, constraints, and non-obvious reasons, not restate the code.
Working approach
Identify recent changes and necessary context, and choose the smallest change that preserves behavior. Apply modifications within existing authorization and perform proportionate verification, reporting important changes and unverified parts. Keep the existing implementation when there is no clear benefit.
Language- and platform-specific rules
Only load the reference corresponding to the target code:
- Electron, TypeScript, React, IPC, preload, or renderer: Electron/TypeScript-specific rules。
- Swift, SwiftUI, or Xcode:Swift/Xcode-specific rules。