Skip to content

参考文献

本页收录与 cursor-rules 设计理念相关的研究论文、技术报告和行业调查。这些文献为规则工程的合理性提供了学术背书。


第一部分:Prompt 工程基础

[1] Brown et al. (2020) — Language Models are Few-Shot Learners

来源Advances in Neural Information Processing Systems 33, OpenAI
链接arxiv.org/abs/2005.14165

GPT-3 论文首次系统性地证明了通过 in-context learning(上下文学习)可以显著改变模型的输出行为,无需微调。这是"规则注入"机制的理论基础——通过在提示词中提供约束,引导模型遵循特定规范。

"A few examples in the prompt can steer the model toward a desired behavior without gradient updates."

与规则工程的关联.mdc 规则文件的注入本质上是 in-context learning 的工程化应用。每次 AI 交互都携带着"few-shot examples"(规则约定),引导模型生成符合项目约定的代码。

BibTeX:

bibtex
@inproceedings{brown2020language,
  title={Language models are few-shot learners},
  author={Brown, Tom and others},
  booktitle={Advances in Neural Information Processing Systems},
  volume={33},
  pages={1877--1901},
  year={2020}
}

[2] Wei et al. (2022) — Chain-of-Thought Prompting Elicits Reasoning in Large Language Models

来源NeurIPS 2022, Google Research
链接arxiv.org/abs/2201.11903

研究表明,为 LLM 提供清晰的推理步骤(而非仅提供答案示例)能显著提高代码生成质量。

与规则工程的关联:规则正文的"原则 + 示例"结构,比纯粹的"做什么"清单更有效。规则文件中增加"为什么"和"如何"的说明,可以提升 AI 遵循率。

BibTeX:

bibtex
@inproceedings{wei2022chain,
  title={Chain-of-thought prompting elicits reasoning in large language models},
  author={Wei, Jason and others},
  booktitle={Advances in Neural Information Processing Systems},
  volume={35},
  pages={24824--24837},
  year={2022}
}

[3] Liu et al. (2023) — Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in NLP

来源ACM Computing Surveys, arXiv:2107.13586
链接arxiv.org/abs/2107.13586

对 Prompt 工程方法的系统综述,涵盖 hard prompt、soft prompt、instruction tuning 等技术路线。

与规则工程的关联.mdc 规则文件属于 "hard prompt template" 范畴——静态的、人工编写的指令文本。本综述提供了理解这一范畴优缺点的理论框架。


第二部分:AI 辅助编码

[4] Copilot: GitHub Copilot Research Report (2022)

来源:GitHub / Microsoft Research
链接github.blog

GitHub 的研究报告显示,使用 Copilot 的开发者完成任务速度提升 55%,但代码质量和一致性在缺少上下文时会下降。

与规则工程的关联:报告隐含地说明了上下文质量对 AI 辅助编码效果的重要性。规则文件是系统性提升上下文质量的工程手段。


[5] Chen et al. (2021) — Evaluating Large Language Models Trained on Code (HumanEval)

来源:OpenAI
链接arxiv.org/abs/2107.03374

Codex 模型(GitHub Copilot 的基础)论文,引入 HumanEval 基准测试。论文分析了代码生成中的"specification following"问题——模型能否准确理解并遵循自然语言规格说明。

与规则工程的关联:规则文件是一种轻量级的"规格说明"机制,将项目约定以自然语言形式提供给模型。HumanEval 的分析框架可以用来评估规则遵循的有效性。

BibTeX:

bibtex
@article{chen2021evaluating,
  title={Evaluating large language models trained on code},
  author={Chen, Mark and others},
  journal={arXiv preprint arXiv:2107.03374},
  year={2021}
}

[6] Jiang et al. (2023) — Self-planning Code Generation with Large Language Models

来源:arXiv:2303.06689
链接arxiv.org/abs/2303.06689

研究通过让 LLM 先规划再编码来提升生成质量。发现显式的结构约束(如"先设计接口,再实现细节")能显著提升代码一致性。

与规则工程的关联:规则文件中的架构约定(如"先定义接口"、"使用仓储模式")实质上是在引导模型的内部规划过程。


第三部分:软件工程与 AI 对齐

[7] Felten et al. (2023) — The Labor Market Impact of AI

来源Princeton University, Princeton Policy Perspectives
链接nber.org/papers/w31051

分析 AI 对软件工程职业的影响,发现 AI 在标准化任务上效率最高,在需要深度上下文理解的任务上仍需要人类引导。

与规则工程的关联:为 AI 提供精准的项目上下文(即规则)可以将更多"需要上下文理解"的任务转化为"标准化任务",扩大 AI 的有效使用范围。


[8] Ouyang et al. (2022) — Training language models to follow instructions with human feedback (InstructGPT)

来源NeurIPS 2022, OpenAI
链接arxiv.org/abs/2203.02155

RLHF(人类反馈强化学习)论文,说明通过人工标注的偏好数据可以显著提升模型对指令的遵循质量。

与规则工程的关联:基于 RLHF 训练的模型(ChatGPT、Claude、GPT-4)对明确指令的遵循能力显著优于基础模型,这使得规则文件的指令式写法更加有效。

BibTeX:

bibtex
@inproceedings{ouyang2022training,
  title={Training language models to follow instructions with human feedback},
  author={Ouyang, Long and others},
  booktitle={Advances in Neural Information Processing Systems},
  volume={35},
  pages={27730--27744},
  year={2022}
}

第四部分:技术文章与行业洞察

[9] Simon Willison (2023) — Prompt Injection Attacks Against GPT-4

链接simonwillison.net

讨论 prompt injection 攻击——恶意输入覆盖系统级指令的安全问题。

与规则工程的关联:了解规则注入的安全边界。用户代码中的注释或字符串字面量理论上可以干扰规则注入的效果,这是规则工程需要意识到的局限性。


[10] Andrej Karpathy (2015) — The Unreasonable Effectiveness of Recurrent Neural Networks

链接karpathy.github.io

虽然是 2015 年的文章,但其"语言模型是文本的统计模拟"的基本观点至今仍有启发性:模型生成的代码反映了其训练语料的统计特性。

与规则工程的关联:规则文件通过在提示词中引入高质量的示例文本,相当于在 inference 时"引导"模型朝向高质量代码分布的区域。


延伸阅读

以下资源不在直接引用范围内,但与本话题高度相关:


导出引用

BibTeX 格式

bibtex
@misc{cursor-rules,
  author = {LessUp},
  title = {Cursor Rules: A Curated .mdc Rule Library for AI-Assisted Coding},
  year = {2025},
  publisher = {GitHub},
  url = {https://github.com/LessUp/cursor-rules}
}

@inproceedings{brown2020language,
  title={Language models are few-shot learners},
  author={Brown, Tom and others},
  booktitle={Advances in Neural Information Processing Systems},
  volume={33},
  pages={1877--1901},
  year={2020}
}

@inproceedings{wei2022chain,
  title={Chain-of-thought prompting elicits reasoning in large language models},
  author={Wei, Jason and others},
  booktitle={Advances in Neural Information Processing Systems},
  volume={35},
  pages={24824--24837},
  year={2022}
}

@article{chen2021evaluating,
  title={Evaluating large language models trained on code},
  author={Chen, Mark and others},
  journal={arXiv preprint arXiv:2107.03374},
  year={2021}
}

@inproceedings{ouyang2022training,
  title={Training language models to follow instructions with human feedback},
  author={Ouyang, Long and others},
  booktitle={Advances in Neural Information Processing Systems},
  volume={35},
  pages={27730--27744},
  year={2022}
}

延伸阅读

26 curated .mdc rules for better AI coding assistance.