From cape
Generate competing code interface designs (API surfaces, module boundaries, function signatures, type contracts) using parallel sub-agents with conflicting constraints. Use whenever the user asks to design an interface, API surface, module boundary, or type contract. Triggers on: "design an interface", "what should the API look like", "module boundary", "function signature", "type contract", "API surface", "how should callers interact with this", "what should this expose". Also triggers when brainstorm identifies the core design question as an interface shape question. Do NOT use for UI/UX design, full feature brainstorming where requirements are unclear (use cape:brainstorm), or implementing an already-designed interface (use cape:execute-plan).
npx claudepluginhub sqve/cape --plugin capeThis skill uses the workspace's default tool permissions.
<skill_overview> Generate competing interface designs under conflicting constraints, compare them
Guides Next.js Cache Components and Partial Prerendering (PPR) with cacheComponents enabled. Implements 'use cache', cacheLife(), cacheTag(), revalidateTag(), static/dynamic optimization, and cache debugging.
Guides building MCP servers enabling LLMs to interact with external services via tools. Covers best practices, TypeScript/Node (MCP SDK), Python (FastMCP).
Generates original PNG/PDF visual art via design philosophy manifestos for posters, graphics, and static designs on user request.
<skill_overview> Generate competing interface designs under conflicting constraints, compare them across depth, simplicity, flexibility, and implementation efficiency, then recommend the strongest. Inspired by Ousterhout's "Design It Twice" and the deep modules concept: a small interface hiding large implementation complexity is the goal; a large interface with thin implementation is the anti-pattern.
Core contract: no interface recommendation without at least 3 competing designs explored under different constraints, each with concrete code signatures, usage examples, and trade-off analysis. </skill_overview>
<rigidity_level> MEDIUM FREEDOM — The research phase, parallel constraint agents, comparison framework, and recommendation are non-negotiable. Research depth and number of agents (3 or 4) adapt to complexity. </rigidity_level>
<when_to_use>
Don't use for:
cape:brainstorm)cape:execute-plan)</when_to_use>
<critical_rules>
</critical_rules>
<the_process>
Research the codebase:
Dispatch cape:codebase-investigator to understand:
Dispatch cape:internet-researcher if the interface involves well-known external patterns
(Repository, Builder, Strategy, etc.) or external API conventions.
If agents aren't available, investigate manually with Glob/Grep/Read and WebSearch/WebFetch.
Collect requirements from the user:
Ask only what the codebase and research can't answer. Confirm:
Build a requirements brief from research findings and user answers. This brief is the shared context all design agents receive.
Present the requirements brief to the user before dispatching agents. STOP here. Ask: "Anything to add or correct before I generate designs?" Do NOT dispatch design agents until the user confirms.
Dispatch 3-4 parallel sub-agents via the Agent tool. Each receives:
| Agent | Constraint | Tendency |
|---|---|---|
| 1 | Minimize method count — 1-3 methods max | Deep module: small surface hiding large implementation |
| 2 | Maximize flexibility — support many cases | Extension points, generics, configuration, loose coupling |
| 3 | Optimize for the most common case | Fast path for the 80% case, convenience over generality |
| 4 | Ports & adapters (conditional) | Dependency inversion, testability, swappable implementations |
Agent 4 is conditional. Dispatch only when the interface mediates between domain logic and an external dependency (database, HTTP, filesystem, message queue, third-party API). Skip for pure domain interfaces.
Each agent must return:
Instruct agents to be concise. Signatures and examples only. No prose padding. Use
model: sonnet for design agents — constrained design exploration doesn't need the parent model.
When designs converge: If two or more agents produce essentially the same interface shape, that's confirmation the shape is right. Note the convergence in the comparison rather than manufacturing artificial differences. Convergence under conflicting constraints is a strong signal.
If agents aren't available, simulate the constraints yourself: design each approach sequentially under the stated constraint.
After all designs return, compare side by side across these dimensions:
| Dimension | What it measures |
|---|---|
| Simplicity | Method count, parameter count, concept count |
| Depth | Small interface hiding large complexity = good |
| Common-case ergonomics | Lines of code for the 80% use case |
| Flexibility | How many use cases supported without modification |
| Implementation cost | How complex the implementation behind the interface is |
| Codebase consistency | How well it fits existing patterns and conventions |
Start with a comparison table, then expand each design:
## Interface comparison
| Dimension | 1. Minimal | 2. Flexible | 3. Pragmatic | 4. P&A (if any) |
| ---------------------- | ---------------- | ------------------- | ------------------- | ------------------- |
| Simplicity | [methods, types] | [methods, types] | [methods, types] | [methods, types] |
| Depth | [rating] | [rating] | [rating] | [rating] |
| Common-case ergonomics | [N lines] | [N lines] | [N lines] | [N lines] |
| Flexibility | [assessment] | [assessment] | [assessment] | [assessment] |
| Implementation cost | [assessment] | [assessment] | [assessment] | [assessment] |
| Codebase consistency | [assessment] | [assessment] | [assessment] | [assessment] |
### 1. [Minimal] (1-3 methods)
[code block — interface signature in target language]
Trade-off: [one sentence]
### 2. [Flexible] (extension points)
[code block]
Trade-off: [one sentence]
### 3. [Pragmatic] (common case optimized)
[code block]
Trade-off: [one sentence]
### 4. [Ports & adapters] (if dispatched)
[code block]
Trade-off: [one sentence]
## Recommendation
I recommend design [N] because [rationale — especially codebase consistency and depth].
**Absorbed from other designs:**
- [Specific idea from a rejected design worth incorporating]
**Anti-patterns from this analysis:**
- NO [pattern] (reason: [insight from comparison])
Lead with the recommendation. Explain why. Note useful ideas from rejected designs worth absorbing into the recommended interface. Call out anti-patterns revealed by the exploration.
Standalone mode:
Present the recommended interface with its signature, usage examples, and anti-patterns.
Interface design complete.
To build this, continue with `cape:brainstorm` to create a full design
(the interface recommendation carries forward), or `cape:write-plan`
if a design summary already exists.
Called by brainstorm:
Return the comparison and recommendation to brainstorm's Step 2. The recommended interface becomes the "Chosen approach" in the design summary. Rejected designs become "Approaches considered."
</the_process>
<agent_references>
If agents aren't available, simulate constraints sequentially.
</agent_references>
Database access scattered across service filesUser: "Design the interface for our database access layer. We have PostgreSQL and raw SQL scattered across service files."
Wrong: Propose a Repository pattern with one method per entity. Skips constraint exploration. Produces a shallow interface (12 methods mirroring SQL queries) that hides nothing.
Right:
pkg/errors.goQuery(ctx, sql, args) → Rows + Exec(ctx, sql, args) → Result — 2 methodsRepository[T] with Find, Save, Delete, query builderStore interface with PostgresStore adapterUser: "What should the event system interface look like for our CLI tool?"
Wrong: Design a full pub/sub system with topics, filters, and replay. The CLI has 3 event types.
Right:
Emit(event) + On(type, handler) — 2 methodsEmit(event) + per-type OnBuild(handler), OnTest(handler) methodsUser starts with "I want to add a plugin system to our CLI tool." Brainstorm runs Step 1 (research, questions) and identifies the core question as "what does the plugin contract look like."
Wrong: Brainstorm runs its generic divergent mode. Produces 3 high-level architecture sketches without concrete plugin interface signatures.
Right: Brainstorm delegates to design-an-interface. Design-an-interface runs Steps 1-3 with
focused interface exploration. Returns a comparison with concrete signatures:
Plugin { Name() string; Run(ctx) error } recommended for depth. Brainstorm incorporates this as
the chosen approach in its design summary.
<key_principles>
</key_principles>