file-size-limit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

文件行数限制规范

Code File Line Limit Specification

单个代码文件必须 ≤ 300 行,这是硬性限制,不允许例外。

A single code file must have ≤ 300 lines. This is a mandatory restriction with no exceptions.

⚠️ 核心强制要求

⚠️ Core Mandatory Requirements

单个代码文件必须 ≤ 300 行,不允许例外。
  • 检查时机:创建新文件时、修改现有文件后
  • 超限处理必须立即拆分,拆分前与用户讨论方案
  • 禁止行为:❌ 不允许以"功能复杂"等理由超过 300 行

A single code file must have ≤ 300 lines, no exceptions allowed.
  • Check timing: When creating a new file, after modifying an existing file
  • Overlimit handling: Must be split immediately, discuss the solution with the user before splitting
  • Prohibited actions: ❌ Exceeding 300 lines on grounds such as "complex functions" is not allowed

AI Agent 行为要求

AI Agent Behavior Requirements

创建/修改文件后

After creating/modifying files

  1. 立即检查行数
  2. 如果超过 300 行,必须停止并提出拆分建议
  3. 提供具体拆分方案(文件列表、职责划分)
  1. Check the number of lines immediately
  2. If it exceeds 300 lines, must stop and propose splitting suggestions
  3. Provide a specific splitting plan (file list, responsibility division)

代码审查时

During code review

  • 检查所有相关文件是否 ≤ 300 行
  • 发现超限文件必须立即指出

  • Check whether all relevant files have ≤ 300 lines
  • Must point out immediately if overlimit files are found

验收标准

Acceptance Criteria

  • 所有文件 ≤ 300 行(硬性要求)
  • 拆分后每个文件职责清晰

  • All files have ≤ 300 lines (mandatory requirement)
  • Each file has clear responsibilities after splitting

参考资料

References

  • references/splitting-guide.md
    - 文件拆分详细指南(拆分原则、流程、常见模式)
  • references/splitting-guide.md
    - Detailed guide to file splitting (splitting principles, processes, common patterns)