docs: add coding agent rules (.cursor/rules + CLAUDE.md) #76

Merged
xiaomo merged 3 commits from chore/cursor-rules-from-conventions into main 2026-04-23 12:12:08 +00:00
Owner

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 保留作为人类可读的参考文档。

## 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` 保留作为人类可读的参考文档。
xiaomo added 1 commit 2026-04-23 12:01:18 +00:00
- .cursor/rules/global.mdc: coding conventions as Cursor agent rules
- CLAUDE.md: same conventions for Claude Code / Hermes agents
- Content derived from docs/coding-conventions.md
- Includes no-dynamic-import rule in CLAUDE.md for completeness
xiaomo added 1 commit 2026-04-23 12:03:18 +00:00
xiaomo added 1 commit 2026-04-23 12:05:33 +00:00
tuanzi reviewed 2026-04-23 12:08:09 +00:00
tuanzi left a comment
Owner

整体质量很高,Core Concepts 段写得清晰扎实 👍

几个小问题需要确认/修正,详见 comments。

整体质量很高,Core Concepts 段写得清晰扎实 👍 几个小问题需要确认/修正,详见 comments。
@@ -0,0 +1,189 @@
---

这里没有 no-dynamic-import 规则,描述里说 Cursor 有单独的 .cursor/rules/no-dynamic-import.mdc。这个文件是已存在于 main 的吗?如果不存在,是不是应该一并加上?

这里没有 no-dynamic-import 规则,描述里说 Cursor 有单独的 `.cursor/rules/no-dynamic-import.mdc`。这个文件是已存在于 main 的吗?如果不存在,是不是应该一并加上?
@@ -0,0 +1,180 @@
# Nerve Coding Conventions

PR 描述说「CLAUDE.md 额外包含了 no-dynamic-import 规则」,但实际上 .github/copilot-instructions.md 也有这段(两个文件 hash 一致 5972be8)。

要么:

  1. 从 copilot-instructions.md 中移除 no-dynamic-import 段(与描述一致)
  2. 或者修正 PR 描述,说明两者内容相同
PR 描述说「CLAUDE.md 额外包含了 no-dynamic-import 规则」,但实际上 `.github/copilot-instructions.md` 也有这段(两个文件 hash 一致 5972be8)。 要么: 1. 从 copilot-instructions.md 中移除 no-dynamic-import 段(与描述一致) 2. 或者修正 PR 描述,说明两者内容相同
@@ -0,0 +177,4 @@
type: feat | fix | refactor | docs | chore | test
scope: core | cli | daemon | rfc-001 | ...
```

三份文件内容几乎一致,以后改 conventions 要同步三处容易漏。

现阶段还好,后续如果频繁改动可以考虑一个 source of truth + 简单的生成脚本。

三份文件内容几乎一致,以后改 conventions 要同步三处容易漏。 现阶段还好,后续如果频繁改动可以考虑一个 source of truth + 简单的生成脚本。
Author
Owner

Review comments 已处理:

  1. PR 描述不准确 — 已修正。三份文件内容一致(CLAUDE.md 和 copilot-instructions.md 都包含 no-dynamic-import,global.mdc 不含因为 Cursor 有单独的 rule 文件)。

  2. no-dynamic-import.mdc — 已存在于 main 中 所以 global.mdc 没有重复包含。

  3. 同步维护 — 认同。当前改动频率低手动同步没问题,后续如果频繁变动可以加个生成脚本从 source of truth 生成三份。

Review comments 已处理: 1. **PR 描述不准确** — 已修正。三份文件内容一致(CLAUDE.md 和 copilot-instructions.md 都包含 no-dynamic-import,global.mdc 不含因为 Cursor 有单独的 rule 文件)。 2. **no-dynamic-import.mdc** — 已存在于 main 中 ✅ 所以 global.mdc 没有重复包含。 3. **同步维护** — 认同。当前改动频率低手动同步没问题,后续如果频繁变动可以加个生成脚本从 source of truth 生成三份。
xiaomo merged commit 9cdac05f2c into main 2026-04-23 12:12:08 +00:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No Label
2 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/nerve#76