Cursor rule
.cursor/rules/clean-code.mdcCursor rules
Quality
30/100
Scores the file, not the repository.Length
91 words
11 headings · 0 code blocksRepository
1
— · pushed 337 days agoLast changed
3 days ago
First indexed 3 days ago.123456---78description: 编写整洁、可维护且易于人类阅读的代码指南。在编写或审查代码时遵循这些规则,以确保代码的一致性与质量。9globs:1011---1213# 整洁代码规范1415## 常量优于魔法数字1617• 用命名常量替代硬编码值18• 使用描述性强的常量名,明确说明数值的用途19• 将常量置于文件顶部,或存入专用的常量文件中2021## 有意义的命名2223• 变量、函数与类名应直接体现其用途24• 名称需阐明其存在的意义及使用方式25• 避免使用缩写(除非是通用约定俗成的缩写)2627## 智能注释2829• 不要为代码的功能写注释——让代码自身具备文档性30• 用注释解释「为何这样做」而非「做了什么」31• 为 API、复杂算法及非直观的副作用添加文档说明3233## 单一职责3435• 每个函数仅负责完成一项具体任务36• 函数应保持短小精悍,聚焦单一目标37• 若一个函数需要额外注释解释其功能,则说明它需要拆分3839## DRY(不要重复自己)4041• 将重复代码提取为可复用的函数42• 通过合理抽象共享通用逻辑43• 维护单一数据源(避免多位置维护同一数据)4445## 整洁结构4647• 将相关代码集中存放48• 按逻辑层级组织代码49• 文件与文件夹命名保持统一规范5051## 封装5253• 隐藏具体实现细节54• 暴露清晰易懂的接口55• 将嵌套的条件判断拆分为命名良好的独立函数5657## 代码质量维护5859• 持续进行代码重构60• 尽早修复技术债务61• 确保离开时的代码比接手时更整洁6263## 测试6465• 修复 bug 前先编写测试用例66• 保持测试代码的可读性与可维护性67• 覆盖边界条件与异常场景的测试6869## 版本控制7071• 编写清晰的提交信息(说明修改内容与目的)72• 提交小而专注的变更(避免大而全的提交)73• 使用有业务含义的分支名(如 feature/login、fix/payment-error)74
Also in lzyyzznl/all_in_one_search
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| lzyyzznl/all_in_one_search.cursor/rules/common.mdc · 1 | Cursor rules | no sections | 50/100 | 3 days ago | |
| lzyyzznl/all_in_one_search.cursor/rules/git.mdc · 1 | Cursor rules | typesgit | 58/100 | 3 days ago | |
| lzyyzznl/all_in_one_search.cursor/rules/quality-rule.mdc · 1 | Cursor rules | no sections | 30/100 | 3 days ago | |
| lzyyzznl/all_in_one_search.cursor/rules/tailwind.mdc · 1 | Cursor rules | ui | 44/100 | 3 days ago | |
| lzyyzznl/all_in_one_search.cursor/rules/ts.mdc · 1 | Cursor rules | types | 44/100 | 3 days ago | |
| lzyyzznl/all_in_one_search.cursor/rules/vue.mdc · 1 | Cursor rules | typesapiui | 44/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago |
