principle-foundational-thinking
它能做什么
为智能体提供一条规则:在编写逻辑之前先设计数据结构和工作顺序。适合希望基础扎实、少返工的工程师。
适用场景
- ✓当你即将选择核心类型或数据结构的时候。
- ✓当你在决定设置工作是否应先于功能开发的时候。
- ✓当系统的多个部分可能修改同一份共享数据的时候。
技能链接
https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-foundational-thinking/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“在我们编写同步逻辑之前,请帮我把核心数据类型定对,这样其余部分就会很简单。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会先定义核心数据形状,追踪它是如何被访问的,并把测试和类型等共享设置排在功能之前。在添加新的基础之前,它会先删除死代码。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Foundational Thinking
Structural decisions protect option value. Code-level decisions protect simplicity.
Data structures first. Get the data shape right before writing logic. Define core types early, trace every access pattern, and choose structures that match the dominant paths.
At code level, DRY the structure, not every line. Types and data models should converge. Three similar statements still beat a premature abstraction. Prefer explicit over clever. Test behavior and edge cases, not line counts.
Concurrency corollary. Before sharing state between actors, ask "what happens if another actor modifies this concurrently?" If not "nothing", isolate.
Scaffold first. If something helps every later phase, do it first. Ask "does every subsequent phase benefit from this existing?" CI, linting, test infrastructure, and shared types are scaffold. Sequence for option value: setup before features, tests before fixes. Keep commits small and single-purpose.
Each increment should land a coherent abstraction or deepen one that exists. Do not spread a new capability across callers as special-case coordination.
Subtraction comes before scaffolding. Remove dead code first, then lay foundations.
常见问题
为什么要先把数据结构做对?
数据形状一旦符合主要路径,后续的代码往往会变得显而易见。
这是否意味着抽象一切?
不。该技能更倾向于明确的代码,并反对过早抽象。
共享状态怎么办?
在并发参与者共享状态之前,该技能会先问它们是否真的需要共享;如果不需要,就把它们隔离开。
详情
作者的原始描述
Apply before writing logic: choosing core types and data structures, sequencing scaffold-vs-feature work, asking what concurrent actors share. Get the data structures right so downstream code becomes obvious.
repo: cursor/plugins
热度
- GitHub 星标
- 15k
- 排名
- #10978
- 许可证
- —
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
advisor
15k如果你开启该功能,让你的智能体在关键节点咨询一个更强的第二模型,例如在重大决定之前,或在错误上卡住时。
check-agent-compatibility
15k全面检查 AI 编程智能体能否启动、验证和记录某个代码仓库,并返回一个兼容性评分以及主要问题。
cli-for-agents
15k教你的智能体设计或审查命令行工具,使 AI 智能体无需提示即可运行,并提供清晰的帮助文字和示例。
continual-learning
15k通过把回顾过往对话的工作交给专门的记忆更新程序,使你的 AGENTS.md 笔记保持最新。