agentleFS
popsiclelmlmpopsiclelmlm/skills-cn/skills/deprecated/design-an-interface/SKILL.md

design-an-interface

Skill0 starsChanged 6 months agoMITView on GitHub

使用 parallel sub-agents 为一个 module 生成多个激进不同的 interface designs。当用户想设计 API、探索 interface options、比较 module shapes,或提到 "design it twice" 时使用。

59 other projects use a version of this, 55 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use decision-mapping, batch-grill-me and 4 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • FabienDehopreSkill

    decision-mapping

    Turn a loose idea into a sequenced map of investigation tickets, then drive them to resolution one at a time.

    Also in 5 projects that use this

  • boyingliu01Skill

    batch-grill-me

    A relentless interview that asks every frontier question at once, round by round. Thin alias of `grilling` (#540) — upstream mattpocock/skills absorbed this protocol into grilling; XP-Gate keeps this name as the sprint-flow Phase 2 entry point so orchestration docs stay stable.

    Also in 5 projects that use this

  • HK-hubSkill

    prd-to-plan

    Turn a PRD into a multi-phase implementation plan using tracer-bullet vertical slices, saved as a local Markdown file in ./plans/. Use when user wants to break down a PRD, create an implementation plan, plan phases from a PRD, or mentions "tracer bullets".

    Also in 6 projects that use this

  • RoentekSkill

    loop-me

    Grill me about specs for the workflows I want to build, within this workspace.

    Also in 15 projects that use this

  • ShopifySkill

    triage-issue

    Triage a GitHub issue — classify priority (P0/P1/P2), search for duplicates, and apply labels.

    Also in 11 projects that use this

  • ryotaroh180105Skill

    claude-handoff

    Hand the current conversation off to a fresh background agent that picks up the work immediately.

    Also in 9 projects that use this

The file

Files
SKILL.md

Design an Interface

基于 "A Philosophy of Software Design" 中的 "Design It Twice":你的第一个想法不太可能是最好的。生成多个激进不同的 designs,然后比较。

Workflow

1. Gather Requirements

设计前,理解:

  • 这个 module 解决什么 problem?
  • Callers 是谁?(other modules、external users、tests)
  • Key operations 是什么?
  • 有哪些 constraints?(performance、compatibility、existing patterns)
  • 哪些应隐藏在内部,哪些应暴露?

询问:"What does this module need to do? Who will use it?"

2. Generate Designs(Parallel Sub-Agents)

使用 Task tool 同时 spawn 3+ sub-agents。每个都必须产出一个激进不同的方法。

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,并包含:

  1. Interface signature — types、methods、params
  2. Usage examples — callers 实际如何使用它
  3. What it hides — kept internal 的 complexity

按顺序展示 designs,让用户能在比较前吸收每种方法。

4. Compare Designs

展示所有 designs 后,按以下方面比较:

  • Interface simplicity:更少 methods、更简单 params
  • General-purpose vs specialized:flexibility vs focus
  • Implementation efficiency:shape 是否允许 efficient internals?
  • Depth:小 interface 隐藏显著 complexity(好)vs 大 interface 搭配 thin implementation(坏)
  • Ease of correct use vs ease of misuse

用 prose 讨论 trade-offs,不用 tables。突出 designs 差异最大的地方。

5. Synthesize

最好的 design 往往结合多个 options 的 insights。询问:

  • "Which design best fits your primary use case?"
  • "Any elements from other designs worth incorporating?"

Evaluation Criteria

来自 "A Philosophy of Software Design":

Interface simplicity:更少 methods、更简单 params = 更容易学习并正确使用。

General-purpose:能无需 changes 就处理 future use cases。但要警惕 over-generalization。

Implementation efficiency:Interface shape 是否允许 efficient implementation?还是强迫 awkward internals?

Depth:小 interface 隐藏显著 complexity = deep module(好)。大 interface 搭配 thin implementation = shallow module(避免)。

Anti-Patterns

  • 不要让 sub-agents 产出相似 designs;强制 radical difference
  • 不要跳过 comparison;价值在 contrast 中
  • 不要 implement;这里只讨论 interface shape
  • 不要基于 implementation effort 评估

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.