🇨🇳 中文 | 🇬🇧 English
A Claude Code skill that enforces engineering discipline through eight behavioral principles — inspired by the "Eight Honors & Eight Shames" (八荣八耻) framework. This skill runs as a persistent behavioral constraint across all coding tasks, ensuring Claude follows best practices before writing a single line of code.
一套以"八荣八耻"为框架的 Claude Code 行为约束技能,将编码工作准则固化为 AI 编程助手的自动行为规范,在所有编码任务中持续生效。
- The Eight Principles · 八条准则
- Why This Exists · 为什么需要它
- Installation · 安装
- Usage · 使用
- Repository Structure · 仓库结构
- Contributing · 贡献
- License · 许可
| # | Honor · 荣 | Shame · 耻 | Core Constraint · 核心约束 |
|---|---|---|---|
| 1 | 查档求证 Verify Before Assuming |
臆猜接口 Guessing Interfaces |
API/参数以实际代码为准,不凭记忆猜测 Base API usage on actual code, not memory |
| 2 | 对齐需求 Align Before Building |
模糊开工 Vague Kickoffs |
需求不清时确认,不自行脑补 Confirm ambiguous requirements, don't fill gaps |
| 3 | 请示规则 Ask About Business Rules |
脑补业务 Fabricating Domain Logic |
业务逻辑向人确认,不自行假设 Confirm business rules with humans, don't assume |
| 4 | 复用存量 Reuse Existing Code |
新增冗余 Adding Redundancy |
先搜已有实现,不重复造轮子 Search before creating, don't reinvent the wheel |
| 5 | 完备测例 Complete Test Cases |
省略校验 Skipping Edge Cases |
边界/错误/空值全量覆盖 Cover boundaries, errors, nulls, not just happy path |
| 6 | 恪守规范 Follow Conventions |
乱改架构 Arbitrary Refactoring |
遵循项目 conventions,不凭偏好重构 Follow project patterns, don't refactor on preference |
| 7 | 坦诚存疑 Admit Uncertainty |
不懂装懂 Pretending to Know |
不确定就说,不编造答案 Say "I'm not sure", don't fabricate answers |
| 8 | 分步迭代 Iterate Incrementally |
批量乱改 Bulk Chaotic Changes |
小步可验证,不一口气改多模块 Small verifiable steps, not mass changes |
The problem: In day-to-day coding, AI assistants commonly exhibit problematic behaviors:
| Problem | Example |
|---|---|
| Guessing APIs from memory | Using foo.bar() without ever reading foo's definition |
| Filling in vague requirements | Assuming "add auth" means JWT when the user meant OAuth |
| Fabricating business logic | Deciding a discount rule is 10% without asking |
| Reinventing the wheel | Writing a date parser when the project already has one |
| Happy-path-only thinking | Forgetting null checks, error handling, empty states |
| Arbitrary refactoring | Renaming all files to match personal preference |
| Hallucinating answers | Giving a confident but entirely wrong explanation |
| Bulk destructive changes | Editing 15 files in one go, breaking 8 of them |
The fix: This skill loads the Eight Principles as always-on behavioral constraints, so Claude self-corrects before these patterns emerge.
AI 助手常见问题: 凭记忆猜接口、脑补需求、重复造轮子、只写 happy path、不懂装懂、一口气改十几个文件。这个 skill 将八条准则作为持续生效的行为约束加载到 Claude Code 中,让 Claude 在每个任务中自动遵循最佳实践。
# Clone the repository
git clone https://github.com/oyj123321/claude-code-eight-principles.git
# Link into Claude Code skills — project-level (current project only)
mkdir -p .claude/skills
# Linux / macOS
ln -s $(pwd)/claude-code-eight-principles .claude/skills/eight-principles
# Windows (PowerShell, as Administrator)
New-Item -ItemType SymbolicLink -Path .claude/skills/eight-principles -Target (Resolve-Path claude-code-eight-principles)
# Or: user-level (all projects)
# Linux / macOS
ln -s $(pwd)/claude-code-eight-principles ~/.claude/skills/eight-principlesnpx openskills install oyj123321/claude-code-eight-principlescp -r claude-code-eight-principles .claude/skills/eight-principlesAutomatic activation · 自动激活: The skill activates automatically on coding tasks, code reviews, or when keywords like "engineering discipline", "coding standards", or "八荣八耻" are mentioned.
Manual invocation · 手动调用:
/eight-principles
Once loaded, the eight behavioral directives constrain all subsequent actions in the session. Claude will:
- Search the codebase before using any API
- Ask clarifying questions instead of assuming
- Reuse existing code instead of duplicating
- Cover edge cases in tests
- Follow project conventions
- Admit uncertainty honestly
- Break work into small, verifiable steps
claude-code-eight-principles/
├── SKILL.md # Core skill file · 核心技能文件 (Claude Code entry point)
├── README.md # This document · 本文档 (bilingual human-readable docs)
├── CHANGELOG.md # Version history · 版本历史
├── LICENSE # MIT License · MIT 许可
└── .gitignore # Git ignore rules
This skill is intentionally minimal — eight principles, eight directives. If you have ideas for improvement:
- Open an issue to discuss before submitting a PR
- Keep the SKILL.md under 200 lines (Claude Code has description budget limits)
- Maintain full bilingual parity — every Chinese sentence needs an English equivalent, and vice versa
Contributions are welcome under the MIT license.
MIT — see LICENSE for full text.
随意使用、修改、分发。Use freely, modify, distribute.