Superpowers: Forcing AI Coding Agents to Write Testable Code via TDD & Sub-Agents

Superpowers is an open-source skill library that injects mandatory TDD, sub-agent delegation, and two-phase code review into AI coding agents like Claude Code and Cursor, preventing 'works-on-my-machine' code by enforcing engineering discipline through workflow hooks rather than model upgrades.

Architecture Digest
Architecture Digest
Architecture Digest
Superpowers: Forcing AI Coding Agents to Write Testable Code via TDD & Sub-Agents

The Problem: AI Agents Cut Corners

The author asked Claude Code to add a CSV export feature. The agent delivered working code and passing tests in under a minute, but two days later the feature failed in production because the tests only covered ideal inputs — no escaping for commas inside fields. This mirrors a recurring pattern: AI agents write tests that merely rubber-stamp their own implementation, skipping edge cases and engineering rigor.

What Superpowers Does

Superpowers (GitHub: https://github.com/obra/superpowers) is not a model upgrade or a prompt pack. It is a collection of 15+ independent skill modules — each with its own trigger logic — that are injected into the agent's context at every new session via a SessionStart hook. The skills cover brainstorming, writing implementation plans, test-driven development, systematic debugging, sub-agent delegation, and two-phase code review. Because the skills are presented as mandatory context, the agent cannot opt out; the workflow forces compliance.

Core Enforcement: Test-Driven Development Skill

The test-driven-development skill mandates the full red–green–refactor cycle:

Write a failing test first.

Watch it run red.

Write the minimal code to make it green.

Only then refactor.

If the agent writes implementation code before a test, the skill requires it to delete that code and start over. This reverses the usual AI habit of writing tests that mirror the (possibly buggy) implementation, turning tests into a specification that the code must satisfy.

End-to-End Workflow

When a user proposes an idea, the flow proceeds as follows:

Brainstorming skill asks clarifying questions and produces a design doc for step-by-step confirmation.

Writing-plans breaks the design into small tasks (file paths, verification steps, each doable in minutes).

A new git worktree is created on a fresh branch, isolating the work.

Subagent-driven-development dispatches each task to a brand-new child agent that receives only the task spec and relevant code — no historical context baggage.

Two-phase review : first, checklist against the plan for completeness; second, code-quality gate. Severe issues are rejected immediately.

Only after all tasks pass does the agent propose a PR, direct merge, or further iteration.

The author notes that with this pipeline, agents can work for 1–2 hours without drifting, whereas long single-session contexts previously led to repeated mistakes.

Installation Across Tools

Superpowers supports multiple AI coding environments:

/plugin install superpowers@claude-plugins-official

For the author's own marketplace (faster updates):

/plugin marketplace add obra/superpowers-marketplace
/plugin install superpowers@superpowers-marketplace

Cursor: /add-plugin superpowers Gemini CLI:

gemini extensions install https://github.com/obra/superpowers

Codex, OpenCode, Kimi Code are also supported. No extra configuration is needed; skills auto-trigger.

Chinese Localization

A community fork superpowers-zh (https://github.com/jnMetaCode/superpowers-zh) provides full Chinese translation of all skills plus a few localized additions, installable via a single npx command into 20+ tools (MIT licensed).

When to Use (and Not Use) Superpowers

The author explicitly states Superpowers is not for throwaway scripts or quick prototypes — the overhead of brainstorming, planning, and review takes 10+ minutes for maybe 10 lines of code. It shines for code that will be maintained long-term, handed off to others, or must be auditable. Trade-offs include higher token consumption (each sub-agent rebuilds context) and a known issue where session compression on some platforms (e.g., Hermes Agent) can drop the skill injection; the workaround is to start a new session.

Author's Take

The author, historically skeptical of "AI gets smarter" tools, values Superpowers precisely because it does not claim to boost intelligence. Instead, it enforces discipline through process — something human teams struggle with, let alone agents with no KPI or shame. The verdict: "It doesn't make the agent smarter; it just stops it from being lazy. That's worth the stars."

Additional reference: https://github.com/superpowers-ai/superpower
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

code reviewopen sourceCursortest-driven developmentclaude-codeAI coding agentsSuperpowerssub-agents
Architecture Digest
Written by

Architecture Digest

Focusing on Java backend development, covering application architecture from top-tier internet companies (high availability, high performance, high stability), big data, machine learning, Java architecture, and other popular fields.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.