AI Workflows Quy Trình AI · · 11 min read

Superpowers: The Engineering Methodology That Makes Coding Agents Reliable Superpowers: Phương Pháp Luận Kỹ Thuật Giúp Coding Agent Vận Hành Đáng Tin Cậy

An architectural deep-dive into Superpowers — the composable skill framework bringing Socratic brainstorming, Git worktree isolation, subagent-driven development, and strict TDD to autonomous AI coding. Phân tích chuyên sâu về Superpowers — khung kỹ năng giúp các coding agent lập trình tự trị thông qua tinh giản ý tưởng Socratic, phân lập Git worktree, điều phối subagent và kiểm thử TDD nghiêm ngặt.

Written by Nguyen Cong Ben Nguyễn Công Ben
Superpowers Agentic Software Engineering Methodology

1. 🌪️ The Pitfalls of Naive AI Coding Agents

In the early wave of LLM-assisted development, developers gave coding agents high-level prompts like “Build me a microservice for user authentication with JWT, rate limiting, and Stripe billing.”

Without a disciplined methodology, naive agents almost universally stumble into the same failure modes:

  1. Premature Coding: The agent jumps directly into generating hundreds of lines of code without validating architecture, edge cases, or user intent.
  2. Context Window Pollution & Degradation: As logs, error traces, and half-baked code fill the context window, the model’s reasoning degrades, resulting in repetitive loops and hallucinated APIs.
  3. Skipped or Superficial Testing: When tests fail, agents often modify or weaken assertions to make the suite pass rather than fixing the underlying flaw.
  4. Architectural Drift: In multi-step refactoring, the agent loses track of design invariants, creating spaghetti dependencies and breaking untouched files.

Superpowers, created by Jesse Vincent and the team at Prime Radiant, tackles this problem not with bigger models or longer prompts, but with a rigorous, composable software development methodology enforced through deterministic agent skills.


2. ⚡ The Superpowers Core Philosophy

Superpowers operates on four non-negotiable engineering principles:

Core PillarEngineering Principle & Execution
🧪 Test-Driven Dev (Strict TDD)Write failing tests first. Watch them fail. Write minimal code to pass. Refactor.
📐 Systematic > Ad-HocMandatory workflows & structured checklists instead of intuitive guessing.
🧹 Complexity Reduction (KISS & YAGNI)Radical simplicity, DRY, and YAGNI. Reject premature over-engineering.
🔍 Evidence > ClaimsNever assume code works; execute test suites and verify diffs with isolated reviewers.

When an agent is equipped with Superpowers, it does not just act as a text generator — it follows the structured discipline of an experienced staff engineer.


3. 🔄 The 7-Phase Superpowers Lifecycle

The complete lifecycle transforms vague prompts into battle-tested, verified production pull requests through seven distinct stages:

flowchart TD
    User(["👤 Developer Request"]) --> S1["💡 1. Brainstorming\n- Socratic dialogue\n- Requirement & edge-case clarification\n- Spec documentation"]
    
    S1 --> S2["🌿 2. Using Git Worktrees\n- Clean isolated branch & directory\n- Baseline test suite verification"]
    
    S2 --> S3["📝 3. Writing Plans\n- Atomic tasks (2-5 min scope)\n- Exact file paths & test commands\n- Step-by-step verification criteria"]
    
    S3 --> S4["🤖 4. Subagent-Driven Development (SDD)\n- Fresh subagent dispatched per atomic task\n- Zero context baggage from previous tasks"]
    
    S4 --> S5["🧪 5. Test-Driven Development (TDD)\n- Red: Failing unit/integration test\n- Green: Minimal code to pass\n- Refactor: Code cleanup & commit"]
    
    S5 --> S6["🧐 6. Two-Stage Code Review\n- Spec compliance review\n- Code quality & security review"]
    
    S6 --> S7["🚀 7. Finishing Development Branch\n- Full test suite run\n- Merge / PR / Worktree cleanup"]

Stage Breakdown:

  1. brainstorming: Activates before a single line of code is written. Uses Socratic questioning to extract real user needs, explores architectural alternatives, and presents design specs in digestible sections.
  2. using-git-worktrees: Prevents dirty workspace collisions by spinning up a separate Git worktree on a dedicated branch with verified baseline tests.
  3. writing-plans: Deconstructs the approved spec into bite-sized tasks (2 to 5 minutes of execution time each), defining exact files, code changes, and verification commands.
  4. subagent-driven-development: Dispatches fresh, isolated subagents for each individual task, ensuring context remains 100% clean.
  5. test-driven-development: Enforces true Red-Green-Refactor. Any code written before a failing test exists is discarded.
  6. requesting-code-review / receiving-code-review: Employs an adversarial review subagent to inspect the work against the spec and quality standards.
  7. finishing-a-development-branch: Validates final test suites and provides structured PR/merge options.

4. 🧠 Subagent-Driven Development (SDD) & The Ruling Ledger

One of Superpowers’ most powerful innovations is Subagent-Driven Development (SDD).

sequenceDiagram
    autonumber
    actor LeadAgent as Coordinator Agent
    participant SubAgent as Fresh Implementer Subagent
    participant Reviewer as Task Reviewer Subagent
    participant Git as Git Worktree

    LeadAgent->>SubAgent: Dispatch task with isolated, curated context
    SubAgent->>Git: Write failing test (RED)
    SubAgent->>Git: Implement minimal code (GREEN)
    SubAgent->>Git: Commit atomic change
    SubAgent-->>LeadAgent: Task complete with diff & test proof
    LeadAgent->>Reviewer: Review package (Spec check + Code quality)
    Reviewer-->>LeadAgent: Review verdict (Pass or Actionable Findings)
    Note over LeadAgent: If conflict: Ledger ruling & continue autonomously
    LeadAgent->>LeadAgent: Append to Ledger & advance to next task

Why Fresh Subagents Prevent Context Rot

In traditional single-agent sessions, a long coding task causes the context window to accumulate dozens of failed compiler outputs, outdated tool responses, and discarded ideas.

By dispatching a fresh subagent per atomic task, SDD ensures:

  • Zero Hallucination Carryover: The implementer agent sees only the exact task description, interface contract, and target file.
  • Maximum Focus: The subagent’s attention mechanism is concentrated 100% on passing the specific unit test.
  • Coordinator Resilience: The parent agent coordinates high-level plan execution, tracking progress in an explicit ledger.

”Rulings, Not Stalls”

Superpowers adopts the Rulings, Not Stalls doctrine:

A running plan does not freeze to ask trivial questions. The spec is binding authority, the plan is its argument, and your judgment settles what neither answers.

If minor ambiguities or conflicts arise during execution, the coordinator makes a deterministic decision, logs it as:

Ruling: <what was decided> — <why> — <what it costs if wrong>

and continues execution without blocking the human developer.


5. 🌐 Universal Multi-Harness Ecosystem

Superpowers is engineered as an open, portable framework supporting virtually every modern AI coding harness:

Harness / PlatformInstallation CommandIntegration Mode
Claude Code/plugin install superpowers@claude-plugins-officialOfficial Plugin Marketplace
Antigravityagy plugin install https://github.com/obra/superpowersSession-start hook & native skills
OpenAI Codex/plugins → Search SuperpowersCodex Plugin Marketplace
Cursor/add-plugin superpowersCursor Agent Chat Plugin
Devin CLIdevin plugins install obra/superpowersDevin Plugin CLI
Factory Droiddroid plugin install superpowers@superpowersDroid Marketplace
Gemini CLIgemini extensions install https://github.com/obra/superpowersGemini Extensions
Grok Buildgrok plugin install superpowers@xai-official --trustxAI Plugin Marketplace
Kimi Code/plugins install https://github.com/obra/superpowersKimi Plugin Manager
OpenCodeFollow .opencode/INSTALL.mdOpenCode Runtime Plugin
Pipi install git:github.com/obra/superpowersNative Pi Package & Bootstrap
Hermes Agenthermes plugins install obra/superpowers --enableHermes Plugin System

6. 📊 Concrete Example: The Superpowers Plan Format

Every implementation plan produced by Superpowers follows a standardized format designed for unambiguous subagent execution:

Task Definition Example:

  • Target File: src/core/rate_limiter.py
  • Spec Reference: docs/specs/rate_limiting.md
  • Dependencies: Standard time, threading (zero external packages)

Step 1 — Write Failing Test (RED):

# tests/test_rate_limiter.py
def test_token_bucket_exhaustion():
    bucket = TokenBucket(capacity=5, refill_rate=1.0)
    assert all(bucket.consume(1) for _ in range(5)) is True
    assert bucket.consume(1) is False  # 6th request must fail

Step 2 — Execute Test Command:

pytest tests/test_rate_limiter.py -v
# Expect: Failure - NameError: name 'TokenBucket' is not defined

Step 3 — Implement Minimal Code (GREEN):

Implement the TokenBucket class inside src/core/rate_limiter.py.

Step 4 — Verify & Commit:

pytest tests/test_rate_limiter.py -v
# Expect: 1 passed
git commit -m "feat(rate-limiter): add token bucket algorithm with unit test"

7. 🚀 Conclusion: Engineering Over Magic

AI coding agents are no longer just completion engines; they are autonomous software collaborators. However, autonomy without engineering discipline produces brittle code.

By combining:

  • Socratic Brainstorming to align requirements,
  • Git Worktree Isolation to safeguard working trees,
  • Subagent-Driven Development to eliminate context rot, and
  • Strict Test-Driven Development to prove correctness,

Superpowers provides the foundational framework needed to turn stochastic AI models into reliable, high-output engineering teams.

1. 🌪️ Những Cạm Bẫy Của Cách Tiếp Cận AI Coding Truyền Thống

Trong giai đoạn đầu của làn sóng AI hỗ trợ lập trình, các kỹ sư thường đưa ra những prompt chung chung như: “Hãy viết cho tôi một microservice xác thực người dùng bằng JWT, giới hạn tần suất (rate limiting) và tích hợp thanh toán Stripe.”

Nếu không có một phương pháp luận kỹ thuật chặt chẽ, các coding agent thông thường hầu như luôn mắc phải 4 cạm bẫy kinh điển:

  1. Lập trình vội vã (Premature Coding): Agent nhảy ngay vào viết hàng trăm dòng mã mà không hề làm rõ kiến trúc, ca biên (edge cases) hay mục tiêu thực sự của người dùng.
  2. Ô nhiễm & suy thoái ngữ cảnh (Context Degradation): Khi nhật ký lỗi, log terminal và các đoạn mã nháp tràn ngập cửa sổ ngữ cảnh, khả năng suy luận của mô hình bị phân tán, dẫn đến vòng lặp bế tắc và tạo ra các hàm không tồn tại (hallucination).
  3. Bỏ qua hoặc làm suy yếu kiểm thử (Weak Testing): Khi bài test thất bại, agent thường có xu hướng sửa đổi assertion của test để suite vượt qua thay vì sửa đúng lỗi logic bên trong mã nguồn.
  4. Trôi dạt kiến trúc (Architectural Drift): Khi thực hiện các đợt refactor nhiều bước, agent dễ đánh mất các ràng buộc thiết kế ban đầu, gây phá vỡ các tính năng khác trong dự án.

Superpowers, được phát triển bởi Jesse Vincent cùng đội ngũ Prime Radiant, giải quyết triệt để vấn đề này không phải bằng mô hình lớn hơn hay prompt dài hơn, mà bằng một phương pháp luận công nghệ phần mềm hoàn chỉnh và kỷ luật, được thực thi thông qua hệ thống kỹ năng tác tử (agent skills).


2. ⚡ Triết Lý Cốt Lõi Của Superpowers

Superpowers được xây dựng trên bốn trụ cột kỹ thuật bất biến:

Trụ cột kỹ thuậtNguyên lý & Thực thi thực tế
🧪 Phát triển hướng kiểm thử (Strict TDD)Luôn viết test trước. Chứng kiến test fail. Viết mã tối giản để pass. Tái cấu trúc mã.
📐 Có hệ thống > Tùy tiệnQuy trình bắt buộc và checklist rõ ràng thay vì phỏng đoán ngẫu nhiên.
🧹 Tối giản hóa độ phức tạp (KISS & YAGNI)Đề cao tính tinh gọn, áp dụng triệt để DRY và YAGNI; loại bỏ mã thừa thãi.
🔍 Minh chứng > Tuyên bốKhông bao giờ giả định mã đã chạy; luôn chạy test suite và kiểm duyệt chéo qua subagent.

Khi agent được nạp bộ kỹ năng Superpowers, nó không chỉ là một công cụ sinh chữ mà hoạt động như một kỹ sư phần mềm cao cấp (Staff Engineer) với kỷ luật nghiêm ngặt.


3. 🔄 Vòng Đời 7 Giai Đoạn Trong Superpowers

Quy trình Superpowers chuyển hóa một ý tưởng sơ khai thành mã nguồn hoàn chỉnh, sẵn sàng tạo Pull Request thông qua 7 giai đoạn:

flowchart TD
    User(["👤 Yêu cầu từ Developer"]) --> S1["💡 1. Brainstorming\n- Đối thoại Socratic\n- Làm rõ yêu cầu & ca biên\n- Soạn thảo tài liệu đặc tả (Spec)"]
    
    S1 --> S2["🌿 2. Using Git Worktrees\n- Tạo nhánh & thư mục làm việc cô lập\n- Xác minh bộ test nền tảng trước khi code"]
    
    S2 --> S3["📝 3. Writing Plans\n- Chia nhỏ task nguyên tử (2-5 phút/task)\n- Đường dẫn file & lệnh test chính xác\n- Tiêu chí xác minh rõ ràng"]
    
    S3 --> S4["🤖 4. Subagent-Driven Development (SDD)\n- Khởi tạo subagent mới tinh cho từng task\n- Không bị ô nhiễm ngữ cảnh từ task trước"]
    
    S4 --> S5["🧪 5. Test-Driven Development (TDD)\n- Red: Viết unit test thất bại trước\n- Green: Viết mã tối thiểu để vượt qua\n- Refactor: Tối ưu & commit"]
    
    S5 --> S6["🧐 6. Kiểm duyệt mã 2 tầng (Two-Stage Review)\n- Tầng 1: Đúng đặc tả kỹ thuật (Spec)\n- Tầng 2: Chất lượng mã & bảo mật"]
    
    S6 --> S7["🚀 7. Finishing Development Branch\n- Chạy toàn bộ test suite\n- Quyết định Merge / PR / Dọn dẹp Worktree"]

Chi Tiết Từng Giai Đoạn:

  1. brainstorming (Khơi thông & tinh chỉnh ý tưởng): Kích hoạt trước khi viết bất kỳ dòng mã nào. Dùng phương pháp hỏi đáp Socratic để làm rõ mục tiêu thực tế, đánh giá các phương án kiến trúc và chia nhỏ bản đặc tả để người dùng duyệt từng phần.
  2. using-git-worktrees (Phân lập không gian làm việc): Tự động tạo một Git worktree riêng biệt trên một nhánh mới, đảm bảo mã nguồn hiện tại không bị ảnh hưởng và chạy kiểm thử baseline ban đầu.
  3. writing-plans (Lập kế hoạch nguyên tử): Phân rã tài liệu thiết kế thành các nhiệm vụ nhỏ độc lập (thời gian thực thi 2-5 phút mỗi task), nêu rõ đường dẫn file, mã nguồn cần viết và lệnh kiểm thử tương ứng.
  4. subagent-driven-development (Phát triển hướng Subagent): Khởi tạo subagent với ngữ cảnh sạch hoàn toàn cho từng nhiệm vụ riêng biệt.
  5. test-driven-development (Phát triển hướng kiểm thử TDD): Bắt buộc chu trình Red-Green-Refactor. Mọi dòng mã viết ra trước khi có bài kiểm thử thất bại đều bị loại bỏ.
  6. requesting-code-review / receiving-code-review (Phản biện & duyệt mã): Subagent phản biện độc lập sẽ rà soát mã nguồn so với kế hoạch ban đầu và tiêu chuẩn kỹ thuật.
  7. finishing-a-development-branch (Hoàn thiện nhánh phát triển): Chạy kiểm thử toàn diện, đưa ra các lựa chọn merge/tạo PR và thu hồi worktree an toàn.

4. 🧠 Mô Hình Subagent-Driven Development (SDD) & Cơ Chế “Rulings, Not Stalls”

Một trong những cải tiến có tính đột phá nhất của Superpowers là mô hình Subagent-Driven Development (SDD).

sequenceDiagram
    autonumber
    actor LeadAgent as Agent Điều Phối (Coordinator)
    participant SubAgent as Subagent Thực Thi (Implementer)
    participant Reviewer as Subagent Đánh Giá (Reviewer)
    participant Git as Git Worktree

    LeadAgent->>SubAgent: Giao nhiệm vụ với ngữ cảnh chọn lọc tối thiểu
    SubAgent->>Git: Viết test thất bại trước (RED)
    SubAgent->>Git: Viết mã tối thiểu để vượt qua (GREEN)
    SubAgent->>Git: Tạo git commit nguyên tử
    SubAgent-->>LeadAgent: Báo cáo kết quả kèm diff & log test
    LeadAgent->>Reviewer: Gửi gói kiểm duyệt (Spec check + Code quality)
    Reviewer-->>LeadAgent: Đánh giá (Đạt hoặc Yêu cầu sửa đổi)
    Note over LeadAgent: Nếu có xung đột: Ghi nhận Ruling vào sổ cái và chạy tiếp
    LeadAgent->>LeadAgent: Cập nhật Ledger & chuyển sang task tiếp theo

Tại Sao Cần Subagent Ngữ Cảnh Sạch (Fresh Subagent)?

Trong các phiên làm việc đơn lẻ kéo dài, ngữ cảnh của LLM bị quá tải bởi hàng tá dòng log lỗi, các câu lệnh thử nghiệm thất bại và các giả định lỗi thời.

Bằng cách phân phối từng task nguyên tử cho một subagent hoàn toàn mới, SDD đem lại:

  • Triệt tiêu nguy cơ ảo tưởng (Hallucination): Subagent thực thi chỉ nhận đúng mô tả task, định nghĩa interface contract và file mục tiêu cần sửa.
  • Sự tập trung tuyệt đối: Toàn bộ cơ chế chú ý (attention) của mô hình chỉ dành cho việc làm bài unit test vượt qua.
  • Agent điều phối bền bỉ: Agent chính đóng vai trò nhạc trưởng điều phối kế hoạch lớn, duy trì tiến độ qua sổ cái (Ledger) minh bạch.

Triết Lý “Rulings, Not Stalls” (Đưa Ra Quyết Định, Không Dừng Đột Ngột)

Superpowers áp dụng nguyên tắc hành động liên tục:

Một kế hoạch đang thực thi không dừng lại vô cớ để hỏi người dùng những câu hỏi vụn vặt. Bản đặc tả kỹ thuật là thẩm quyền tối cao, kế hoạch là luận điểm, và óc phán đoán của agent sẽ giải quyết những gì chưa rõ.

Nếu có sự không đồng nhất nhỏ nảy sinh, agent điều phối sẽ tự đưa ra phán quyết, ghi chú vào sổ nhật ký:

Ruling: <quyết định đưa ra> — <lý do> — <chi phí khắc phục nếu phán quyết sai>

và tiếp tục hoàn thành các nhiệm vụ tiếp theo mà không làm gián đoạn dòng suy nghĩ của lập trình viên.


5. 🌐 Hệ Sinh Thái Hỗ Trợ Đa Nền Tảng

Superpowers được thiết kế theo cấu trúc mở, có thể cài đặt và kích hoạt trên hầu hết các nền tảng lập trình AI hiện nay:

Nền tảng / Công cụLệnh cài đặtChế độ tích hợp
Claude Code/plugin install superpowers@claude-plugins-officialMarketplace Plugin chính thức
Antigravityagy plugin install https://github.com/obra/superpowersHook khởi tạo phiên & Kỹ năng gốc
OpenAI Codex/plugins → Tìm SuperpowersCodex Plugin Marketplace
Cursor/add-plugin superpowersPlugin Agent Chat trong Cursor
Devin CLIdevin plugins install obra/superpowersQuản lý plugin qua CLI Devin
Factory Droiddroid plugin install superpowers@superpowersDroid Marketplace
Gemini CLIgemini extensions install https://github.com/obra/superpowersGemini Extensions
Grok Buildgrok plugin install superpowers@xai-official --trustxAI Marketplace
Kimi Code/plugins install https://github.com/obra/superpowersTrình quản lý Plugin Kimi
OpenCodeLàm theo hướng dẫn .opencode/INSTALL.mdOpenCode Runtime Plugin
Pipi install git:github.com/obra/superpowersGói Pi Package & Cơ chế Bootstrap
Hermes Agenthermes plugins install obra/superpowers --enableHệ sinh thái Plugin Hermes

6. 📊 Minh Họa: Định Dạng Kế Hoạch Chuẩn Trong Superpowers

Mỗi kế hoạch triển khai được sinh ra bởi Superpowers đều tuân theo cấu trúc cực kỳ rõ ràng để subagent có thể thực thi chính xác:

Ví Dụ Định Nghĩa Nhiệm Vụ:

  • File mục tiêu: src/core/rate_limiter.py
  • Tài liệu thiết kế: docs/specs/rate_limiting.md
  • Phụ thuộc: Thư viện chuẩn time, threading (không dùng gói ngoài)

Bước 1 — Viết kiểm thử thất bại trước (RED):

# tests/test_rate_limiter.py
def test_token_bucket_exhaustion():
    bucket = TokenBucket(capacity=5, refill_rate=1.0)
    assert all(bucket.consume(1) for _ in range(5)) is True
    assert bucket.consume(1) is False  # Yêu cầu thứ 6 bắt buộc phải fail

Bước 2 — Chạy lệnh kiểm thử:

pytest tests/test_rate_limiter.py -v
# Kết quả mong đợi: Thất bại - NameError: name 'TokenBucket' is not defined

Bước 3 — Viết mã tối thiểu để vượt qua (GREEN):

Cài đặt class TokenBucket trong file src/core/rate_limiter.py.

Bước 4 — Xác minh & Commit:

pytest tests/test_rate_limiter.py -v
# Kết quả: 1 passed
git commit -m "feat(rate-limiter): add token bucket algorithm with unit test"

7. 🚀 Lời Kết: Kỷ Luật Công Nghệ Hóa Thay Vì Phép Màu

Các coding agent ngày nay không còn là những công cụ sinh văn bản đơn thuần; chúng đã trở thành những cộng sự lập trình tự trị đắc lực. Tuy nhiên, tự trị mà thiếu đi kỷ luật kỹ nghệ phần mềm sẽ chỉ tạo ra những hệ thống mong manh và dễ gãy vỡ.

Bằng việc kết hợp hài hòa giữa:

  • Đối thoại Socratic Brainstorming để làm rõ yêu cầu,
  • Phân lập không gian Git Worktree để bảo vệ kho mã nguồn,
  • Mô hình Subagent-Driven Development để triệt tiêu thoái hóa ngữ cảnh, và
  • Quy trình TDD nghiêm ngặt để minh chứng tính đúng đắn của logic,

Superpowers định hình một khung làm việc mẫu mực, giúp chuyển hóa sức mạnh ngẫu nhiên của các mô hình AI thành năng lực sản xuất phần mềm bền vững và chuẩn xác ở quy mô lớn.