跳到正文
Skillpedia
通用编程15k · #10978

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-foundational-thinking/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能