docs: add coding agent rules (.cursor/rules + CLAUDE.md) #76
Reference in New Issue
Block a user
Delete Branch "chore/cursor-rules-from-conventions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
将
docs/coding-conventions.md转化为 coding agent 可直接读取的格式:.cursor/rules/global.mdc— Cursor Agent 自动加载的项目规则CLAUDE.md— Claude Code / Hermes Agent 自动加载的项目规则.github/copilot-instructions.md— GitHub Copilot 自动加载的项目规则三份文件内容一致。
.cursor/rules/global.mdc不含 no-dynamic-import 规则,因为 Cursor 已有单独的.cursor/rules/no-dynamic-import.mdc(已在 main 中)。CLAUDE.md 和 copilot-instructions.md 包含该规则以保证独立完整。同时在文件头部增加了 Core Concepts 段,介绍 Sense → Signal → Reflex → Workflow → Log 因果链和架构规则。
Why
Coding agent(Cursor、Claude Code、GitHub Copilot 等)在编码时会自动读取这些文件,确保生成的代码符合项目约定,减少人工纠正。
原始
docs/coding-conventions.md保留作为人类可读的参考文档。整体质量很高,Core Concepts 段写得清晰扎实 👍
几个小问题需要确认/修正,详见 comments。
@@ -0,0 +1,189 @@---这里没有 no-dynamic-import 规则,描述里说 Cursor 有单独的
.cursor/rules/no-dynamic-import.mdc。这个文件是已存在于 main 的吗?如果不存在,是不是应该一并加上?@@ -0,0 +1,180 @@# Nerve Coding ConventionsPR 描述说「CLAUDE.md 额外包含了 no-dynamic-import 规则」,但实际上
.github/copilot-instructions.md也有这段(两个文件 hash 一致 5972be8)。要么:
@@ -0,0 +177,4 @@type: feat | fix | refactor | docs | chore | testscope: core | cli | daemon | rfc-001 | ...```三份文件内容几乎一致,以后改 conventions 要同步三处容易漏。
现阶段还好,后续如果频繁改动可以考虑一个 source of truth + 简单的生成脚本。
Review comments 已处理:
PR 描述不准确 — 已修正。三份文件内容一致(CLAUDE.md 和 copilot-instructions.md 都包含 no-dynamic-import,global.mdc 不含因为 Cursor 有单独的 rule 文件)。
no-dynamic-import.mdc — 已存在于 main 中 ✅ 所以 global.mdc 没有重复包含。
同步维护 — 认同。当前改动频率低手动同步没问题,后续如果频繁变动可以加个生成脚本从 source of truth 生成三份。