coding-guidelines
它能做什么
这个技能为 AI 在编写或修改代码时设定行为准则。它要求 AI 说明假设、保持方案简单,并且只改动任务所需的部分。适合希望 AI 编写的代码谨慎、专注的任何人。
适用场景
- ✓当 AI 为功能或缺陷修复编写、修改或审查代码时。
- ✓当你注意到 AI 添加了你没有要求的功能或抽象时。
- ✓当你希望代码改动保持较小,并与现有风格相符时。
技能链接
https://github.com/tech-leads-club/agent-skills/blob/main/packages/skills-catalog/skills/(development)/coding-guidelines/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请修复这个缺陷,但保持改动很小,不要触碰无关的代码;如果你对任何事情不确定,请告诉我。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能要求 AI 提出其中的假设,选择可行的最简单方案,并进行与现有风格相符的精准编辑。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Coding Guidelines
Behavioral guidelines to reduce common LLM coding mistakes. These principles bias toward caution over speed—for trivial tasks, use judgment.
1. Think Before Coding
Don't assume. Don't hide confusion. Surface tradeoffs.
Before implementing:
- State assumptions explicitly. If uncertain, ask.
- If multiple interpretations exist, present them—don't pick silently.
- If a simpler approach exists, say so. Push back when warranted.
- If something is unclear, stop. Name what's confusing. Ask.
- Disagree honestly. If the user's approach seems wrong, say so—don't be sycophantic.
2. Simplicity First
Minimum code that solves the problem. Nothing speculative.
- No features beyond what was asked.
- No abstractions for single-use code.
- No "flexibility" or "configurability" that wasn't requested.
- No error handling for impossible scenarios.
- If you write 200 lines and it could be 50, rewrite it.
Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.
3. Surgical Changes
Touch only what you must. Clean up only your own mess.
When editing existing code:
- Don't "improve" adjacent code, comments, or formatting.
- Don't refactor things that aren't broken.
- Match existing style, even if you'd do it differently.
- If you notice unrelated dead code, mention it—don't delete it.
When your changes create orphans:
- Remove imports/variables/functions that YOUR changes made unused.
- Don't remove pre-existing dead code unless asked.
The test: Every changed line should trace directly to the user's request.
4. Goal-Driven Execution
Define success criteria. Loop until verified.
Transform tasks into verifiable goals:
- "Add validation" → "Write tests for invalid inputs, then make them pass"
- "Fix the bug" → "Write a test that reproduces it, then make it pass"
- "Refactor X" → "Ensure tests pass before and after"
For multi-step tasks, state a brief plan:
1. [Step] → verify: [check]
2. [Step] → verify: [check]
3. [Step] → verify: [check]
Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
常见问题
它适用于架构或文档吗?
不适用。它面向代码任务,而不是架构设计或文档编写。
它会阻止 AI 提问吗?
不会。它鼓励在事情不清楚时提问。
它也适用于简单的任务吗?
这些准则倾向于谨慎,AI 会对简单任务进行判断。
详情
作者的原始描述
Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, modifying, or reviewing code — implementation tasks, code changes, refactoring, bug fixes, or feature development. Do NOT use for architecture design, documentation, or non-code tasks.
热度
- GitHub 星标
- 7.1k
- 排名
- #13523
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
component-common-domain-detection
7.1k帮你的智能体找出代码库中多个部分重复的业务逻辑,并建议如何合并。
component-flattening-analysis
7.1k帮你的智能体找出位置不当的代码,并整理杂乱的组件文件夹结构,让每个部分都放在应在的位置。
component-identification-sizing
7.1k帮你的智能体梳理代码库的各个组成部分并测量其规模,以找出应首先拆分的模块。
coupling-analysis
7.1k帮你的智能体检查代码库各部分之间的依赖有多紧密,并找出应优先放松的连接。