Community生产力与协作github.com

addyosmani/怀疑驱动开发

对每个非平凡决策进行全新环境下的对抗性审查,然后再定案。适用于正确性比速度更重要的情况,比如处理不熟悉的代码、高风险场景(生产环境、安全敏感逻辑、不可逆操作),或任何自信的输出现在验证比以后调试更划算的时候。

怀疑驱动开发 是什么?

该技能名为“怀疑驱动开发”(Doubt-Driven Development),旨在通过强制对所有非平凡决策进行对抗性审查,来提升代码质量和决策可靠性。它要求AI助手在做出每个重要决定前,先模拟一个“挑剔审查者”的角色,从全新视角审视当前逻辑,主动寻找潜在的缺陷、边界情况、安全漏洞或误解。这种机制特别适合高风险场景,如生产环境部署、安全相关代码修改、数据库迁移等不可逆操作,以及当开发人员不熟悉代码库时使用。该技能支持Claude Code、Cursor、Codex等主流AI编程助手,通过定义明确的审查流程和提示模板,引导AI在生成最终代码前先进行自我质疑和验证。使用此技能可以显著减少因过度自信导致的逻辑错误,降低后期调试成本,尤其能帮助开发者处理那些“看起来正确但实际有问题”的难以发现的缺陷。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/addyosmani/agent-skills/tree/main/skills/doubt-driven-development

Installed? Explore more 生产力与协作 skills: steipete/gemini, steipete/gh-issues, steipete/skill-creator · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

怀疑驱动开发 是做什么的?

对每个非平凡决策进行全新环境下的对抗性审查,然后再定案。适用于正确性比速度更重要的情况,比如处理不熟悉的代码、高风险场景(生产环境、安全敏感逻辑、不可逆操作),或任何自信的输出现在验证比以后调试更划算的时候。

动机

在软件开发中,许多错误源于过度自信——我们以为自己的推理是正确的,直到后来才发现缺陷。传统的“快速出结果”方法更注重速度而非正确性,这在处理复杂或高风险决策时可能带来高昂的后期成本。怀疑驱动开发(DDD)通过引入结构化的怀疑主义来缓解这一问题:在每个重要决策定案之前,强制进行对抗性审查,从相反角度寻找漏洞。

工作原理

  1. 识别非平凡决策:任何可能影响正确性、安全性或稳定性的决策(如算法选择、API设计、权限逻辑、数据处理流程)都应标记为“可疑”。
  2. 生成对抗性审查:系统提示AI助手扮演一个“挑剔审查者”角色,以全新视角审视当前方案。审查内容包括:
    • 逻辑谬误
    • 边界情况遗漏
    • 安全弱点
    • 性能陷阱
    • 可维护性问题
  3. 基于审查结果决策:根据审查反馈调整方案或接受原方案(如果审查未发现实质性缺陷)。

使用场景

  • 生产环境代码变更
  • 安全敏感逻辑(如认证、授权、加密)
  • 数据库迁移或数据操作
  • 货币或财务计算
  • 多线程/并发处理
  • 第三方集成逻辑
  • 不熟悉的代码库或技术栈
  • 任何“简单改动”可能导致级联故障的情况

提示模板示例

## 对抗性审查请求

**待决策事项**:[描述具体的决策或代码片段]

**审查角色**:我是AI助手,现在扮演“怀疑开发者”。我将严格审查此决策,寻找潜在缺陷。

**审查过程**:
1. 重新陈述决策目标,确保我理解正确。
2. 列出所有假设前提,逐一质疑其有效性。
3. 识别边界情况:输入值、状态、并发等。
4. 检查安全影响:注入、权限泄漏、数据暴露。
5. 评估性能影响:时间复杂度、资源消耗。
6. 提供改进建议或替代方案。

**输出格式**:首先给出“审查报告”,然后基于审查结果给出最终建议的代码或决策。

最佳实践

  • 不要跳过小决策:即使是看似简单的if-else分支,也可能隐藏错误。
  • 保持审查简短:专注于关键风险点,避免无限怀疑。
  • 记录审查结论:对于高风险决策,保留审查过程和结论以供后续参考。
  • 结合自动化测试:对抗性审查不能替代测试,但可以指导测试用例设计。

相关资源

贡献

欢迎通过Issue或PR提交改进建议。请确保你的变更符合本技能的核心原则:对每一个非平凡决策,都给予它应得的怀疑。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

addyosmani/agent-skills

Guides stable API and interface design. Use when designing APIs, module boundaries, or any public interface. Use when creating REST or GraphQL endpoints, defining type contracts between modules, or establishing boundaries between frontend and backend.

addyosmani/agent-skills

Prepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.

addyosmani/agent-skills

Builds production-quality, accessible, responsive user-facing UIs. Use when building or modifying interfaces and pages, creating components, implementing layouts, meeting WCAG accessibility requirements, managing state, or when the output needs to look and feel production-quality rather than AI-generated.

addyosmani/browser-testing-with-devtools

Tests in real browsers via Chrome DevTools MCP. Use when building or debugging anything that runs in a browser. Use when you need to inspect the DOM, capture console errors, analyze network requests, profile performance, or verify visual output with real runtime data. Requires the chrome-devtools MCP server to be configured.

addyosmani/ci-cd-and-automation

Automates CI/CD pipeline setup. Use when setting up or modifying build and deployment pipelines. Use when you need to automate quality gates, configure test runners in CI, or establish deployment strategies.

addyosmani/code-review-and-quality

Conducts multi-axis code review. Use before merging any change. Use when reviewing code written by yourself, another agent, or a human. Use when you need to assess code quality across multiple dimensions before it enters the main branch.

addyosmani/code-simplification

Simplifies code for clarity. Use when refactoring code for clarity without changing behavior. Use when code works but is harder to read, maintain, or extend than it should be. Use when reviewing code that has accumulated unnecessary complexity.

addyosmani/constraint-driven-development

Establishes a project's quality bar as a written contract and stops agents quietly lowering it. Interviews the user on which dimensions matter, supplies sane default thresholds when they have no number in mind, records everything in CONSTRAINTS.md, and watches the diff for a weakened bar — new @ts-ignore or eslint-disable suppressions, skipped or deleted tests, assertions stripped out, unimplemented stubs, thresholds edited down. Use when no quality bar is written down, when the user says "set up constraints" or "define our standards", when the user wants dimensions they care about — accessibility, web performance, coverage — set up as enforced constraints, when an agent keeps silencing checks or skipping tests to get to green, when you need a coverage or performance threshold and don't know what number to pick, or when an agent writes more code than anyone will read.

addyosmani/debugging-and-error-recovery

Guides systematic root-cause debugging. Use when tests fail, builds break, behavior doesn't match expectations, or you encounter any unexpected error. Use when you need a systematic approach to finding and fixing the root cause rather than guessing.

addyosmani/deprecation-and-migration

Manages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when deciding whether to maintain or sunset existing code.

addyosmani/documentation-and-adrs

Records decisions and documentation. Use when making architectural decisions, changing public APIs, shipping features, or when you need to record context that future engineers and agents will need to understand the codebase.

addyosmani/git-workflow-and-versioning

Structures git workflow practices. Use when making any code change. Use when committing, branching, resolving conflicts, or when you need to organize work across multiple parallel streams.

addyosmani/idea-refine

Refines raw ideas into sharp, actionable concepts through structured divergent and convergent thinking. Use when an idea is still vague, when you need to stress-test assumptions before committing to a plan, or when you want to expand options before converging on one. Triggers on "ideate", "refine this idea", or "stress-test my plan".

addyosmani/incremental-implementation

Delivers changes incrementally. Use when implementing any feature or change that touches more than one file. Use when you're about to write a large amount of code at once, or when a task feels too big to land in one step.

addyosmani/interview-me

Extracts what the user actually wants instead of what they think they should want. Achieves this through one-question-at-a-time interview until ~95% confidence about the underlying intent. Use when an ask is underspecified ("build me X" without "for whom" or "why now"), when the user explicitly invokes ("interview me", "grill me", "are we sure?", "stress-test my thinking"), or when you catch yourself silently filling in ambiguous requirements before any plan, spec, or code exists.

addyosmani/observability-and-instrumentation

Instruments code so production behavior is visible and diagnosable. Use when adding logging, metrics, tracing, or alerting. Use when shipping any feature that runs in production and you need evidence it works. Use when production issues are reported but you can't tell what happened from the available data.

addyosmani/performance-optimization

Optimizes application performance. Use when performance requirements exist, when you suspect performance regressions, or when Core Web Vitals or load times need improvement. Use when profiling reveals bottlenecks that need fixing.

addyosmani/planning-and-task-breakdown

Breaks work into ordered tasks. Use when you have a spec or clear requirements and need to break work into implementable tasks. Use when a task feels too large to start, when you need to estimate scope, or when parallel work is possible.

addyosmani/security-and-hardening

Hardens code against vulnerabilities. Use when handling user input, authentication, data storage, or external integrations. Use when building any feature that accepts untrusted data, manages user sessions, or interacts with third-party services.

addyosmani/source-driven-development

Grounds every implementation decision in official documentation. Use when you want authoritative, source-cited code free from outdated patterns. Use when building with any framework or library where correctness matters.

相关技能