Chuyển đến nội dung
Skillpedia
Tài liệu kỹ thuật107k · #783

spec-driven-development

Skill này làm gì

Công cụ này giúp tạo một kế hoạch chi tiết (đặc tả) trước khi bạn bắt đầu viết code. Nó đảm bảo mọi người hiểu sẽ xây dựng gì, vì sao và làm sao biết khi nào hoàn thành.

Khi nào nên dùng

  • ✓Khi bạn bắt đầu một dự án hoặc tính năng mới.
  • ✓Khi ý tưởng về thứ cần xây dựng còn chưa rõ.
  • ✓Khi bạn chuẩn bị đưa ra các quyết định quan trọng về cấu trúc dự án.

Liên kết skill

https://github.com/addyosmani/agent-skills/blob/main/skills/spec-driven-development/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/addyosmani/agent-skills/blob/main/skills/spec-driven-development/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi cần một kế hoạch tạo hệ thống đăng nhập cho một website.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ hướng dẫn bạn xác định mục tiêu, các lệnh cần thiết, cấu trúc thư mục, phong cách code, cách kiểm thử và những việc nên làm hoặc không nên làm. Nó làm việc theo từng giai đoạn, có người xem xét ở mỗi bước.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Spec-Driven Development

Overview

Write a structured specification before writing any code. The spec is the shared source of truth between you and the human engineer — it defines what we're building, why, and how we'll know it's done. Code without a spec is guessing.

When to Use

  • Starting a new project or feature
  • Requirements are ambiguous or incomplete
  • The change touches multiple files or modules
  • You're about to make an architectural decision
  • The task would take more than 30 minutes to implement

When NOT to use: Single-line fixes, typo corrections, or changes where requirements are unambiguous and self-contained.

The Gated Workflow

Spec-driven development has four phases, preceded by a scope check (Phase 0) that activates only when one request bundles several independently testable capabilities. Do not advance to the next phase until the current one is validated.

SPECIFY ──→ PLAN ──→ TASKS ──→ IMPLEMENT
   │          │        │          │
   ▼          ▼        ▼          ▼
 Human      Human    Human      Human
 reviews    reviews  reviews    reviews

Phase 0: Scope Check

Most requests describe one capability. If this one does, skip this phase and go straight to Specify — Phase 0 exists for the exception, not the rule, and it puts no hierarchy on single-capability features.

Detection. Decompose before specifying when a single requirement bundles several independently testable capabilities:

  • The requirement names distinct capabilities with their own consumers or data (e.g. identity, billing, notifications, reporting)
  • Acceptance criteria cluster into groups that could ship and be verified separately
  • One capability could be cut or replaced without rewriting the others' requirements

Propose a capability map before writing any spec. Small and reviewable — a module table plus a build order, not a project plan:

# Capability Map: [Initiative Name]

| Module id | Responsibility | Depends on |
|---|---|---|
| identity | Accounts, sessions, SSO | — |
| billing | Plans, invoices, payments | identity |
| notifications | Email and webhook fan-out | identity |
| reporting | Usage dashboards | billing, notifications |

Build order: identity → billing, notifications → reporting
  • Stable module ids. Kebab-case, chosen once, never renamed mid-initiative. Specs, plans, and downstream commands select work by these ids instead of guessing which spec is active.
  • Dependency direction, no cycles. Arrows point one way. If two modules each need the other, they are one module.
  • Interfaces live at the boundary. The map records that billing depends on identity; the contract between them belongs in the provider module's spec (see api-and-interface-design for designing it).

The map is gated like every phase. The human reviews module boundaries, dependency direction, and build order before any module spec is written. Getting the map wrong is expensive; reviewing ten lines is not.

Then recurse per module. Run Specify → Plan → Tasks → Implement for each module in dependency order. Each module gets its own spec, scoped to that module's objective, boundaries, and success criteria. Save the approved map at the project root and each module's spec alongside it, named by module id (SPEC-identity.md, SPEC-billing.md) — the map, not filename guessing, is the index of what exists.

Phase 1: Specify

Start with a high-level vision. Ask the human clarifying questions until requirements are concrete.

Surface assumptions immediately. Before writing any spec content, list what you're assuming:

ASSUMPTIONS I'M MAKING:
1. This is a web application (not native mobile)
2. Authentication uses session-based cookies (not JWT)
3. The database is PostgreSQL (based on existing Prisma schema)
4. We're targeting modern browsers only (no IE11)
→ Correct me now or I'll proceed with these.

Don't silently fill in ambiguous requirements. The spec's entire purpose is to surface misunderstandings before code gets written — assumptions are the most dangerous form of misunderstanding.

Write a spec document covering these six core areas:

  1. Objective — What are we building and why? Who is the user? What does success look like?

  2. Commands — Full executable commands with flags, not just tool names.

    Build: npm run build
    Test: npm test -- --coverage
    Lint: npm run lint --fix
    Dev: npm run dev
    

…

Câu hỏi thường gặp

Khi nào KHÔNG nên dùng công cụ này?

Đừng dùng cho các sửa nhanh, như sửa một lỗi chính tả, hoặc khi yêu cầu rất đơn giản và hiển nhiên.

“Capability map” (bản đồ năng lực) là gì?

Đó là sơ đồ thể hiện các phần khác nhau của một dự án lớn và cách chúng kết nối, hữu ích khi một tác vụ gồm nhiều phần độc lập.

Vì sao phải nêu rõ “giả định”?

Nêu rõ những gì bạn đang giả định (ví dụ loại cơ sở dữ liệu, trình duyệt) giúp tránh hiểu lầm sau này, vì người khác có thể sửa bạn trước khi bắt đầu viết code.

Chi tiết

Mô tả gốc của tác giả

Creates specs before coding. Use when starting a new project, feature, or significant change and no specification exists yet. Use when drafting a PRD or requirements document with objectives and scope, or when requirements are unclear, ambiguous, or only exist as a vague idea. Use when a single requirement spans several independently testable capabilities and needs decomposing into a capability ma

repo: addyosmani/agent-skills

Độ phổ biến

Sao GitHub
107k
Vị trí xếp hạng
#783
Giấy phép
MIT
Cập nhật
13/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự