Minimal first implementation

From Kevin-Liu-01/Agent-Machines · View interactive version

Minimal first implementation is an AI agent skill from the GitHub repository Kevin-Liu-01/Agent-Machines. Build the smallest correct version first. Name every case, implement only what has a real consumer, return typed errors for the rest. Use when designing new systems, extracting shared packages, or deciding how much to build before shipping.

How to use this skill

Skill file

Minimal-First Implementation

The Rule

Build the smallest thing that is correct, tested, and fail-closed. Do not

build the smallest thing that compiles.

What This Means

1. Name every case up front

The decision logic should be exhaustive from day one. If there are three

resize strategies, define all three variants now. The decision tree should

be complete even when execution is partial.

This is not speculative design. It is documenting the problem space so

the code tells the truth about what it handles and what it does not.

2. Implement only the cases that have a real consumer today

A named variant with no execution path returns a typed error:

match action {
    ResizeAction::Hotplug => hotplug(spec),
    ResizeAction::LiveMigration => Err(ResizeError::NotImplemented),
    ResizeAction::ColdMigration => Err(ResizeError::NotImplemented),
}

That is not incomplete. That is the correct first version. The variant

exists so the compiler and tests can prove the decision logic is

exhaustive. The execution exists only when someone needs it.

3. Unimplemented cases fail loudly, not silently

Never return Ok(()) for a path you have not built. Never log a warning

and continue. Return a typed error that the caller can match on. This is

the intersection with fail-closed case matching: if a resize request

routes to LiveMigration and that path is not wired, the user gets a

clear rejection, not a silent no-op.

4. No framework ahead of a second consumer

Do not add:

until there is a real second consumer that would benefit. The first

consumer should use concrete types, free functions, and direct calls.

If a pattern emerges after the second consumer, extract it then.

5. Shared packages only after the core stabilizes

A shared package (packages/go/...) is justified only when:

adjacent second consumer)

If only one app uses it, keep it local. Extract when the boundary proves

itself, not when you hope it will.

6. Tests cover the decision logic exhaustively

Even when execution is partial, the decision logic should be fully

tested. Table-driven tests with one row per named case prove that:

This is how you ship a partial implementation without shipping partial

correctness.

Why This Works

The alternative is building the full system up front, which means:

Minimal-first avoids all of that by making the first version honest about

what it does and what it does not do. The decision tree is complete. The

execution is partial. The errors are explicit. The tests are real.

Reference Examples

cold migration), exhaustive resolver, tested with table-driven cases.

serde round-trip tests. No execution logic in the schema crate.

extracted to a shared package after the API stabilized and compaction

became a second consumer.

packing heuristic simple (scalar best-fit-decreasing) because vector

demand is not a real need yet.

Anti-Patterns

path has a real second consumer

failed in production

approach has been tried

codebase already releases AssignedHost on sleep convergence

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.