busirocket-refactor-workflow

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Refactor Workflow

重构工作流

Strict, step-by-step refactoring guidance for maintaining code quality.
用于维持代码质量的严格、分步式重构指南。

When to Use

适用场景

Use this skill when:
  • Refactoring files with multiple exports (use
    @file
    workflow)
  • Splitting components/hooks/utils into smaller files
  • Moving inline types to
    types/
  • Enforcing post-refactor quality checks
在以下场景中使用本技能:
  • 重构包含多个导出的文件(使用
    @file
    工作流)
  • 将组件/钩子/工具函数拆分为更小的文件
  • 将内联类型迁移至
    types/
    目录
  • 强制执行重构后质量检查

Non-Negotiables (MUST)

不可妥协的规则(必须遵守)

  • After any refactor: run the project's standard checks (e.g.
    yarn check:all
    ) as a mandatory quality gate.
  • If a file has multiple responsibilities, split immediately.
  • If a hook/component contains helpers, extract them.
  • If a file declares types inline, move them to
    types/
    .
  • Never use index/barrel files; import from concrete modules only.
  • 任何重构完成后:运行项目的标准检查(例如
    yarn check:all
    ),这是强制性的质量检查环节。
  • 如果一个文件承担多项职责,立即拆分。
  • 如果钩子/组件中包含辅助函数,将其提取出来。
  • 如果文件中声明了内联类型,将其迁移至
    types/
    目录。
  • 绝不使用索引/桶文件;仅从具体模块导入。

@file Refactor Workflow

@file 重构工作流

When referencing
@file
for a one-shot refactor:
  • Exactly one exported symbol per file.
  • No inline
    interface
    /
    type
    declarations in non-type files.
  • No helper functions inside components/hooks.
当引用
@file
进行一次性重构时:
  • 每个文件恰好包含一个导出符号。
  • 非类型文件中不得存在内联
    interface
    /
    type
    声明。
  • 组件/钩子内部不得包含辅助函数。

Rules

规则

@file Refactor Workflow

@file 重构工作流

  • refactor-file-workflow
    - @file refactor workflow (strict constraints)
  • refactor-mandatory-checks
    - Mandatory checks after refactor
  • refactor-file-workflow
    - @file重构工作流(严格约束)
  • refactor-mandatory-checks
    - 重构后必须执行的检查

Refactoring TypeScript/React

TypeScript/React 重构

  • refactor-goals
    - Goals for refactoring (many small files, one export per file)
  • refactor-decision-rules
    - Decision rules for when to split files
  • refactor-never-index-files
    - Never use index files
  • refactor-post-refactor-checks
    - Post-refactor checks (MANDATORY)
  • refactor-goals
    - 重构目标(拆分为多个小文件,每个文件一个导出)
  • refactor-decision-rules
    - 文件拆分的判定规则
  • refactor-never-index-files
    - 绝不使用索引文件
  • refactor-post-refactor-checks
    - 重构后检查(必须遵守)

Post-Refactor Checks

重构后检查

  • refactor-golden-path
    - Golden path for post-refactor checks
  • refactor-file-size-guidelines
    - File size targets and max lines
  • refactor-if-something-fails
    - What to do if checks fail
  • refactor-when-to-split
    - Fast heuristics for when to split files
  • refactor-golden-path
    - 重构后检查的标准流程
  • refactor-file-size-guidelines
    - 文件大小目标与最大行数限制
  • refactor-if-something-fails
    - 检查失败时的处理方式
  • refactor-when-to-split
    - 文件拆分的快速判定准则

Related Skills

相关技能

  • busirocket-core-conventions
    - File structure and boundaries
  • busirocket-typescript-standards
    - TypeScript standards to enforce
  • busirocket-react
    - Component/hook patterns
  • busirocket-core-conventions
    - 文件结构与边界规范
  • busirocket-typescript-standards
    - 需强制执行的TypeScript标准
  • busirocket-react
    - 组件/钩子模式

How to Use

使用方法

Read individual rule files for detailed explanations and code examples:
rules/refactor-file-workflow.md
rules/refactor-decision-rules.md
rules/refactor-post-refactor-checks.md
Each rule file contains:
  • Brief explanation of why it matters
  • Code examples (correct and incorrect patterns)
  • Additional context and best practices
阅读单个规则文件以获取详细说明与代码示例:
rules/refactor-file-workflow.md
rules/refactor-decision-rules.md
rules/refactor-post-refactor-checks.md
每个规则文件包含:
  • 规则重要性的简要说明
  • 代码示例(正确与错误模式)
  • 额外背景信息与最佳实践