Skip to content
Agentmart
Submit a tool

api-and-interface-design

Guides stable API and interface design for REST endpoints, GraphQL schemas, module boundaries, and component contracts.

Skill by jankneumann

IndexedMIT★ 4
Write a review

Chalk Labs

Need help deploying api-and-interface-design?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/jankneumann-api-and-interface-design

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Guides stable API and interface design for REST endpoints, GraphQL schemas, module boundaries, and component contracts. Use when designing new APIs, defining type contracts between modules, establishing boundaries between frontend and backend, or modifying existing public interfaces. Covers Hyrum's Law, contract-first design, the One-Version Rule, REST resource patterns, pagination, PATCH semantics, and idiomatic type-system patterns in both TypeScript (discriminated unions, branded types) and Python (Pydantic discriminated unions, NewType branded types, FastAPI route shapes, frozen dataclasses).

Use cases: documents, design, frontend, backend

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/api-and-interface-design

What's inside

Skill name
api-and-interface-design
Description
Guides stable API and interface design for REST endpoints, GraphQL schemas, module boundaries, and component contracts. Use when designing new APIs, defining type contracts between modules, establishing boundaries between frontend and backend, or modifying existing public interfaces. Covers Hyrum's Law, contract-first design, the One-Version Rule, REST resource patterns, pagination, PATCH semantics, and idiomatic type-system patterns in both TypeScript (discriminated unions, branded types) and Python (Pydantic discriminated unions, NewType branded types, FastAPI route shapes, frozen dataclasses).
License
MIT
Instructions
503 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • body: 503 lines (spec recommends under 500)
  • files: referenced but missing: references/security-checklist.md

Files (1)

  • SKILL.md

SKILL.md (first lines)

# API and Interface Design

## Overview

Design stable, well-documented interfaces that are hard to misuse. Good interfaces make the right thing easy and the wrong thing hard. This applies to REST APIs, GraphQL schemas, module boundaries, component props, function signatures, and any surface where one piece of code talks to another.

This skill ships with **TypeScript and Python examples side-by-side**. Pick the one that matches the codebase you are working in; the principles are identical.

## When to Use

- Designing new API endpoints
- Defining module boundaries or contracts between teams
- Creating component prop interfaces or function signatures
- Establishing database schema that informs API shape
- Changing existing public interfaces

## Core Principles

### Hyrum's Law

> With a sufficient number of users of an API, all observable behaviors of your system will be depended on by somebody, regardless of what you promise in the contract.

Every observable behavior — including undocumented quirks, error message text, response ordering, and timing — becomes a de facto contract once users depend on it. Design implications:

- **Be intentional about what you expose.** Every observable behavior is a potential commitment.
- **Don't leak implementation details.** If users can observe it, they will depend on it.
- **Plan for deprecation at design time.** Versioning, sunset headers, and migration paths are part of the original design, not a later cleanup.
- **Tests are not enough.** Even with perfect contract tests, "safe" changes can break real users who depend on undocumented behavior.

### The One-Version Rule

Avoid forcing consumers to choose between multiple versions of the same dependency or API. Diamond dependency problems arise when different consumers need different versions of the same thing. Design for a world where only one version exists at a time — extend rather than fork.

### 1. Contract First

Define the interface before implementing it. The contract is the spec; implementation follows.

**TypeScript:**

```typescript
// Define the contract first
interface TaskAPI {
  // Creates a task and returns the created task with server-generated fields
  createTask(input: CreateTaskInput): Promise<Task>;

  // Returns paginated tasks matching filters
  listTasks(params: ListTasksParams): Promise<PaginatedResult<Task>>;

  // Returns a single task or throws NotFoundError
  getTask(id: TaskId): Promise<Task>;

  // Partial update — only provided fields change
  updateTask(id: TaskId, input: UpdateTaskInput): Promise<Task>;

  // Idempotent delete — succeeds even if already deleted
  deleteTask(id: TaskId): Promise<void>;
}
```

**Python (Protocol-style contract):**

```python
from typing import Protocol
from .models import Task, TaskId, CreateTaskInput, UpdateTaskInput, ListTasksParams, Page

class TaskAPI(Protocol):
    async def create_task(self, payload: CreateTaskInput) -> Task: ...
    async def list_tasks(self, params: ListTasksParams) -> Page[Task]: ...
    async def get_task(self, task_id: TaskId) -> Task: ...
    async def update_task(self, task_id: TaskId, patch: UpdateTaskInput) -> Task: ...
    async def delete_task(self, task_id: TaskId) -> None: ...
```

A `Protocol` documents the contract independently of any concrete implementation, and both ASGI handlers and in-process callers can satisfy the same shape.

### 2. Consistent Error Semantics

Pick one error strategy and apply it everywhere.

**TypeScript:**

```typescript
interface APIError {
  error: {
    code: string;        // Machine-readable: "VALIDATION_ERROR"
    message: string;     // Human-readable: "Email is required"
    details?: unknown;   // Additional context when helpful
  };
}
```

**Python (FastAPI exception handler):**

```python
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
from pydantic import BaseModel

class APIErrorBody(BaseModel):
    code: str
    message: str
    details: dict | None = None

class APIError(Exception):
    def __init__(self, status: int, code: str, message: str, details: dict | None = None):
        self.status = status
        self.body = APIErrorBody(code=code, message=message, details=details)

app = FastAPI()

@app.exception_handler(APIError)
async def api_error_handler(_: Request, exc: APIError) -> JSONResponse:
    return JSONResponse(status_code=exc.status, content={"error": exc.body.model_dump()})
```

HTTP status mapping (same in any language):

| Status | Meaning |
|---|---|

From jankneumann/agentic-coding-tools, MIT.

More from jankneumann/agentic-coding-tools

Signals

Stars
4
Forks
1
Open issues
129
Last commit (this folder)
May 1, 2026 (6 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from jankneumann

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get api-and-interface-design running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying api-and-interface-design?

CallGet help
Cite this page

api-and-interface-design skill. Agent Mart. https://agentmart.dev/skills/jankneumann-api-and-interface-design (last updated 2026-10-24)