design-an-interface
vinvcn/mattpocock-skills-zh-cn
Generate multiple radically different interface designs for a module using parallel sub-agents.
What is design-an-interface?
This skill applies the "Design It Twice" principle from "A Philosophy of Software Design" to explore multiple fundamentally different interface approaches for a module. Use it when designing APIs, evaluating interface options, comparing module shapes, or when you want to avoid settling on a first idea.
- Gathers requirements before design (problem, callers, operations, constraints, encapsulation)
- Spawns 3+ parallel sub-agents to generate radically different interface approaches with distinct constraints
- Presents each design with signature, usage examples, and internal complexity trade-offs
- Compares designs across simplicity, generality, implementation efficiency, and depth dimensions
- Synthesizes insights from multiple options to inform the final interface choice
How to install design-an-interface
npx skills add https://github.com/vinvcn/mattpocock-skills-zh-cn --skill design-an-interfaceHow to use design-an-interface
- 1.Describe the module and its problem domain
- 2.Specify who will call it and what operations are needed
- 3.Let the skill gather any missing requirements (constraints, encapsulation boundaries)
- 4.Review the 3+ generated designs, each optimized for different constraints
- 5.Compare designs across simplicity, generality, efficiency, and depth
- 6.Synthesize the best elements from multiple options into your final interface
Use cases
- Designing a new API or module interface from scratch
- Exploring multiple architectural approaches before committing to implementation
- Comparing shallow vs. deep module designs to optimize encapsulation
- Evaluating flexibility vs. simplicity trade-offs for a given problem
- Applying "Design It Twice" principle to avoid premature convergence on a first idea
- Software architects designing new modules or APIs
- Developers evaluating interface trade-offs before implementation
- Teams exploring multiple design approaches for critical components
- Anyone applying "A Philosophy of Software Design" principles
design-an-interface FAQ
No. This skill focuses only on interface shape and trade-offs. Implementation comes after you've chosen or synthesized your preferred approach.
Radically different. Each sub-agent is constrained differently (e.g., minimize methods, maximize flexibility, optimize for common case, follow a specific paradigm) to force fundamentally distinct approaches.
A deep module with a small, simple interface that hides significant internal complexity, is easy to use correctly, and generalizes to future use cases without modification.
Yes. The synthesis step explicitly encourages merging insights from different options to create a hybrid approach that captures the best trade-offs for your specific use case.
Use it when designing APIs, exploring interface options, comparing module shapes, or whenever you want to avoid settling on your first design idea.
Full instructions (SKILL.md)
Source of truth, from vinvcn/mattpocock-skills-zh-cn.
name: design-an-interface description: 使用并行子代理为模块生成多个显著不同的接口设计。适用于用户想设计 API、探索接口选项、比较模块形状,或提到 “design it twice” 时。
Design an Interface
基于 “A Philosophy of Software Design” 中的 “Design It Twice”:你的第一个想法很可能不是最好的。生成多个根本不同的 designs,然后比较。
Workflow
1. Gather Requirements
设计前先理解:
- 这个 module 解决什么问题?
- callers 是谁?(other modules、external users、tests)
- key operations 是什么?
- 有哪些 constraints?(performance、compatibility、existing patterns)
- 什么应该隐藏在内部,什么应该暴露?
询问:“这个 module 需要做什么?谁会使用它?”
2. Generate Designs (Parallel Sub-Agents)
使用 Task tool 同时生成 3+ 个 sub-agents。每个都必须产出根本不同的 approach。
Prompt template for each sub-agent:
Design an interface for: [module description]
Requirements: [gathered requirements]
Constraints for this design: [assign a different constraint to each agent]
- Agent 1: "Minimize method count - aim for 1-3 methods max"
- Agent 2: "Maximize flexibility - support many use cases"
- Agent 3: "Optimize for the most common case"
- Agent 4: "Take inspiration from [specific paradigm/library]"
Output format:
1. Interface signature (types/methods)
2. Usage example (how caller uses it)
3. What this design hides internally
4. Trade-offs of this approach
3. Present Designs
每个 design 展示:
- Interface signature — types、methods、params
- Usage examples — callers 在实践中如何使用
- What it hides — 保持在内部的 complexity
顺序展示 designs,让用户能在比较前吸收每个 approach。
4. Compare Designs
展示所有 designs 后,按以下维度比较:
- Interface simplicity:更少 methods、更简单 params
- General-purpose vs specialized:flexibility vs focus
- Implementation efficiency:shape 是否允许高效 internals?
- Depth:小 interface 隐藏大量 complexity(好)vs 大 interface 配薄 implementation(坏)
- Ease of correct use vs ease of misuse
用 prose 讨论 trade-offs,不用 tables。突出 designs 分歧最大的地方。
5. Synthesize
最好的 design 往往结合多个 options 的 insights。询问:
- “哪个 design 最适合你的 primary use case?”
- “其他 designs 中是否有值得合并的 elements?”
Evaluation Criteria
来自 “A Philosophy of Software Design”:
Interface simplicity:更少 methods、更简单 params = 更容易学习和正确使用。
General-purpose:能不改动就处理未来 use cases。但要警惕 over-generalization。
Implementation efficiency:interface shape 是否允许高效 implementation?还是迫使 internals 变别扭?
Depth:小 interface 隐藏大量 complexity = deep module(好)。大 interface 配薄 implementation = shallow module(避免)。
Anti-Patterns
- 不要让 sub-agents 产出相似 designs;强制 radical difference
- 不要跳过 comparison;价值在 contrast
- 不要 implement;这里只讨论 interface shape
- 不要基于 implementation effort 评价
Related skills
More from vinvcn/mattpocock-skills-zh-cn and the wider catalog.

diagnose
Disciplined debugging loop: reproduce → minimize → hypothesize → instrument → fix → regression-test for tricky bugs and performance regressions.

diagnosing-bugs
Structured diagnostic loop for tricky bugs and performance regressions.

domain-modeling
Build and refine your project's domain model through active terminology and decision capture.

edit-article
Restructure and refine articles by reorganizing sections, improving clarity, and tightening prose.

git-guardrails-claude-code
Prevent destructive git operations in Claude Code by blocking dangerous commands before execution.

grill-me
Continuous questioning interview to refine plans or designs.