工程基础

写作 社区

技能解读

当前原文的自动摘译,尚未人工审校。

主题

主题 · 何时使用 · 参考 TDD · 编写单元测试、e2e 测试、修复失败测试 · reference/tdd.md 领域建模 · 通过业务规则、状态转换实现丰富的领域模型 · reference/domain-model.md 代码审查 · 审查 PR、验证代码质量、自我审查 · reference/code-review.md 要求 · 收集需求、澄清业务逻辑、定义范围 · reference/requirements.md

陷阱

工程方法中克劳德特有的故障模式:测试中的硬编码日期——克劳德最持久的坏习惯。始终使用动态日期生成(new Date(),相对偏移)。从来没有'2024-01-15'。修改现有测试以使其通过——当测试失败时,Claude 的本能是“修复”测试。而是修复应用程序代码。仅当需求发生变化时才修改测试。在 e2e 测试中模拟内部模块 - 为了方便起见,Claude 模拟了所有内容。在 e2e 测试中,仅模拟外部服务(支付 API、身份验证提供商)。内部服务、处理程序、警卫和存储库必须是真实的。

一般原则

原则 · 做什么 澄清限制 · 规模?预算?现有系统?时间表? MVP 还是生产?优先考虑简单性·最简单、最有效的解决方案。 “最好的代码就是没有代码。”设计安全性 · 最低权限、加密、输入验证、参数化查询 现有选项 · 2-3 个需要权衡的选项。那就推荐一款吧。

快速决策指南

资料来源:anpham1925/claude-marketplace — 由 TomeVault 分发。

流狐档案 运行与权限由流狐静态检查推断,不代表作者声明或实际测试结果。
领域
写作
作者声明的智能体
未找到明确声明;不据此推断已兼容或已测试
静态检查
88 / 100 · 启发式扫描,不代表运行安全
运行环境证据
未执行;当前没有隔离运行测试证据
作者 / 版本 / 许可证
@tomevault-io · 未声明许可证
上下文用量评级
低消耗
接入复杂程度
即装即用
是否需要外部接口密钥
不需要
兼容的系统
未声明(默认跨平台)
运行环境要求
未检出明确要求
检测到的文件与系统行为
  • 只读
  • 允许写入 / 修改
网络行为
仅限本地
安装命令数
无(仅作为资料)

需要注意: 未声明工具权限范围;实际权限由运行环境决定。

作者说明文件(原文) SKILL.md

> **Recommended model: Opus** — This skill involves deep reasoning, architecture decisions, or code review.

Opinionated, language-agnostic engineering methodology. Before applying any topic, read its reference file in `reference/`.

## Topics

| Topic | When to Use | Reference |
|---|---|---|
| **TDD** | Writing unit tests, e2e tests, fixing failing tests | `reference/tdd.md` |
| **Domain Modeling** | Implementing rich domain models with business rules, state transitions | `reference/domain-model.md` |
| **Code Review** | Reviewing PRs, validating code quality, self-review | `reference/code-review.md` |
| **Requirements** | Gathering requirements, clarifying business logic, defining scope | `reference/requirements.md` |
| **Architecture Planning** | Planning features, making architectural decisions, designing solutions | `reference/architecture.md` |
| **Deep Modules** | Judging interface-vs-implementation ratio, choosing where to draw module boundaries, classifying dependencies | `reference/deep-modules.md` |
| **ADR Writing** | Documenting significant architectural decisions | `reference/adr.md` |

## Gotchas

Claude-specific failure modes in engineering methodology:

- **Hardcoding dates in tests** — Claude's most persistent bad habit. Always use dynamic date generation (`new Date()`, relative offsets). Never `'2024-01-15'`.
- **Modifying existing tests to make them pass** — When a test fails, Claude's instinct is to "fix" the test. Fix the application code instead. Only modify tests if the requirements changed.
- **Mocking internal modules in e2e tests** — Claude mocks everything for convenience. In e2e tests, only mock external services (payment APIs, auth providers). Internal services, handlers, guards, and repositories must be real.
- **One giant PR with no intermediate commits** — Claude builds everything then commits once. Commit after each TDD Green phase.
- **Designing from scratch when patterns exist** — Claude invents new architectures instead of finding the closest existing implementation in the codebase. Always search for similar code first.
- **Presenting only one option** — Architecture planning requires 2-3 options with trade-offs. Claude tends to present its preferred approach as the only option.
- **ADRs with no "Rejected Alternatives"** — Claude writes ADRs that only describe the chosen approach. The rejected alternatives section is the most valuable part.
- **Skipping the "what's out of scope" section** — Requirements must explicitly define what is NOT being built. Claude omits this, leading to scope creep.

## General Principles

| Principle | What to Do |
|---|---|
| **Clarify Constraints** | Scale? Budget? Existing systems? Timeline? MVP or production? |
| **Prioritize Simplicity** | Simplest solution that works. "The best code is no code." |
| **Security by Design** | Least privilege, encryption, input validation, parameterized queries |
| **Present Options** | 2-3 options with trade-offs. Then recommend one. |

## Quick Decision Guide

```
Need to write/fix tests?
  -> Read reference/tdd.md

Need to design a domain model?
  -> Read reference/domain-model.md

Need to review code?
  -> Read reference/code-review.md

Need to gather or clarify requirements?
  -> Read reference/requirements.md

Need to plan a feature or make architecture decisions?
  -> Read reference/architecture.md

Need to judge a module boundary, or decide if something is "too shallow"?
  -> Read reference/deep-modules.md

Need to document a significant decision?
  -> Read reference/adr.md
```

---
> Source: [anpham1925/claude-marketplace](https://github.com/anpham1925/claude-marketplace) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-22 -->

讨论

基于 GitHub Discussions。登录 GitHub 即可参与讨论、点赞、订阅更新。