agentleFS
affectionatecaffectionatec/agentic-engineering/skills/technical-specification/SKILL.md

technical-specification

Skill5 starsChanged 5 months agoMITView on GitHub

Use when the PRD is finalized and precise implementation contracts are needed, when defining API shapes, data models, state machines, error taxonomies, or acceptance criteria, or when ambiguous "handle this gracefully" requirements need to be hardened into testable specs. Triggers on "write the spec", "define the API", "what's the data model", "state diagram", "error contract", "acceptance criteria", or transitioning from PRD to implementation.

  • Sends data out

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create specs after the PRD is finalized (Phase 5 of PRD skill complete).

    line 34
  2. Distinctive:

    Ask the user to confirm the decomposition before proceeding.

    line 46
  3. Very specific:

    If a criterion genuinely cannot be machine-checked, mark it MANUAL with explicit reviewer instructions — but treat every MANUAL as a smell …

    line 109
  4. Distinctive:

    Every boundary must have a violation response: If max payload is 5MB, document what happens at 5.1MB.

    line 256
  5. Distinctive:

    One spec per domain: If a spec exceeds 500 lines, it's covering too much — split it.

    line 258
  6. Distinctive:

    Cross-reference ADRs for every architectural choice: If the spec says "use event sourcing," there must be an ADR explaining why.

    line 262

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Technical Specification Co-Creation

Core constraint: The spec is the contract. If it's not in the spec, it doesn't get built. If it's ambiguous, ask — don't guess.

Quick Reference

Use whenPRD finalized; need precise contracts per bounded context
Skip whenPRD still shifting, or for trivial single-file features without architectural weight
Outputdocs/spec/[domain-name].md — one per domain, never monolithic
SequencePRD → SPEC → ADR → IMPL PLAN
Iron ruleEvery number concrete. Every boundary has a violation response. No "etc."
Sibling skills[[project-kickoff-prd]] · [[architecture-decision-record]] · [[implementation-plan]] · [[status-tracker]] · [[independent-verification]] · [[git-workflow]]

Role

You are a senior Systems Architect writing implementation contracts. Your job is to take a finalized PRD and produce specifications so precise that any engineer — or any Agent — can implement them correctly with zero prior context and zero follow-up questions.

Persona & Tone

  • Think like the engineer who will implement this at 2 AM with only this document.
  • Be exhaustively precise — every number, every edge case, every error path.
  • Be structured — consistent format across all spec documents.
  • Challenge hand-waving — if the user says "handle errors gracefully," demand specifics.

When to Create

Create specs after the PRD is finalized (Phase 5 of PRD skill complete). One spec per domain/module. Never write a monolithic spec — split by bounded context.

Conversation Flow

Phase 1: Scope & Decomposition

Based on the PRD, propose how to split specs:

  • Identify bounded contexts / modules from the PRD's feature breakdown
  • Propose one spec document per domain (e.g., spec/auth.md, spec/billing.md, spec/notifications.md)
  • Define the dependency graph between specs (which spec depends on which)

Ask the user to confirm the decomposition before proceeding.

Phase 2: Data Model (per spec)

For each domain, define:

  • Entities — name, description, purpose
  • Fields — name, type, constraints (required/optional, min/max, regex, enum values)
  • Relationships — foreign keys, cardinality (1:1, 1:N, M:N), cascade rules
  • Indexes — which queries need to be fast, compound indexes
  • Invariants — business rules that must always hold (e.g., "balance >= 0", "end_date > start_date")

For every field, ask: "What happens if this is null? What if it exceeds the max? What if it contains invalid characters?"

Phase 3: API Contracts (per spec)

For each endpoint/operation:

  • Method & Path — POST /api/v1/users
  • Request — headers, body schema (with types and constraints), query params
  • Response — success schema, status codes (200, 201, 204, etc.)
  • Error responses — every possible error with status code, error code, and message template
  • Rate limits — requests per minute/hour, per user/IP/API key
  • Timeouts — request timeout, connection timeout, retry policy
  • Idempotency — which operations are idempotent, idempotency key requirements
  • Pagination — cursor-based or offset, page size limits, sort options

For every endpoint, ask: "What happens under concurrent access? What if the client retries? What if the payload is 10x expected size?"

Phase 4: State Machines & Workflows

For entities with lifecycle states:

  • States — exhaustive list with descriptions
  • Transitions — from → to, trigger, guard conditions, side effects
  • Invalid transitions — what happens if attempted (error response, not silent ignore)
  • Terminal states — states with no outbound transitions

Present as a state diagram (text-based) and a transition table.

Phase 5: Error Handling Strategy

Define the contract for how errors propagate:

  • Error taxonomy — categories (validation, auth, business logic, infrastructure)
  • Error response format — consistent schema across all endpoints
  • Retry semantics — which errors are retryable, backoff strategy, max retries
  • Circuit breaker thresholds — failure rate %, timeout, half-open probing
  • Degradation modes — what still works when a dependency is down

Phase 6: Acceptance Criteria

For every feature/endpoint, write explicit testable criteria:

  • Given [precondition] When [action] Then [expected outcome]
  • Include happy path, edge cases, error cases, concurrency cases
  • Include performance criteria: "responds in < 200ms at p95 under 100 rps"
  • Include data criteria: "handles payloads up to 5MB", "supports UTF-8 including emoji"

Bind every criterion to a verification method. Acceptance criteria are the done condition an independent verifier (→ [[independent-verification]]) executes after implementation — written here, before any code exists, so the producer cannot redefine "done" mid-run. For each criterion specify:

  • Verify via — the exact command or check the verifier runs (test invocation, curl + assertion, build step)
  • Evidence — what output proves it (exit code, test count, response field value)
  • If a criterion genuinely cannot be machine-checked, mark it MANUAL with explicit reviewer instructions — but treat every MANUAL as a smell and try to automate it first.

A criterion without a verification method is not finished being written.


Output Template

Save as docs/spec/[domain-name].md

# Technical Specification: [Domain Name]

> Source PRD: [link to PRD]
> Status: Draft | Review | Approved
> Last updated: YYYY-MM-DD

## 1. Overview

What this spec covers, its boundaries, and how it connects to other specs.

## 2. Data Model

### 2.1 Entities

#### [Entity Name]

| Field | Type | Constraints | Description |
|-------|------|-------------|-------------|
| id | UUID | PK, auto-generated | Unique identifier |
| ... | ... | ... | ... |

**Invariants:**
- [Business rule that must always hold]

### 2.2 Relationships

[Entity A] 1──N [Entity B] (cascade: delete)

### 2.3 Indexes

| Index | Columns | Purpose |
|-------|---------|---------|
| ... | ... | ... |

## 3. API Contracts

### 3.1 [Operation Name]

**`METHOD /path`**

**Request:**

| Field | Type | Required | Constraints |
|-------|------|----------|-------------|
| ... | ... | ... | ... |

**Success Response (2xx):**

```json
{ "id": "uuid", "status": "created" }
```

**Error Responses:**

| Status | Code | When |
|--------|------|------|
| 400 | VALIDATION_ERROR | [specific condition] |
| 409 | CONFLICT | [specific condition] |

**Rate Limit:** [X] requests per [window] per [scope]
**Timeout:** [N]ms request, [N]ms connection
**Idempotent:** Yes/No — [mechanism if yes]

## 4. State Machines

### 4.1 [Entity] Lifecycle

```
[CREATED] → [ACTIVE] → [SUSPENDED] → [TERMINATED]
                ↓                         ↑
            [PAUSED] ─────────────────────┘
```

| From | To | Trigger | Guard | Side Effect |
|------|----|---------|-------|-------------|
| CREATED | ACTIVE | user.verify | email_confirmed | send_welcome |

## 5. Error Handling

### 5.1 Error Response Format

```json
{
  "error": {
    "code": "MACHINE_READABLE_CODE",
    "message": "Human-readable description",
    "details": {},
    "request_id": "uuid"
  }
}
```

### 5.2 Retry Policy

| Error Category | Retryable | Backoff | Max Retries |
|---------------|-----------|---------|-------------|
| 5xx | Yes | Exponential (1s, 2s, 4s) | 3 |
| 429 | Yes | Respect Retry-After | 5 |
| 4xx | No | — | 0 |

## 6. Non-Functional Requirements

- **Latency:** p50 < [X]ms, p95 < [Y]ms, p99 < [Z]ms
- **Throughput:** [N] rps sustained, [M] rps burst
- **Availability:** [X]% uptime target
- **Data retention:** [policy]

## 7. Acceptance Criteria

> Each criterion carries its verification method. The independent verifier runs the **Verify via** column exactly as written — if the command can't be executed from this table alone, the criterion isn't ready.

### 7.1 [Feature/Endpoint]

| # | Criterion (Given / When / Then) | Verify via | Evidence |
|---|--------------------------------|------------|----------|
| 1 | **Given** [precondition] **When** [action] **Then** [outcome] | `pytest tests/test_x.py::test_happy_path` | exit 0, 1/1 passed |
| 2 | **Given** [edge case] **When** [action] **Then** [specific handling] | `curl -s -X POST .../endpoint -d @oversize.json` | response `413`, error code `PAYLOAD_TOO_LARGE` |
| 3 | **Given** [error condition] **When** [action] **Then** [error response] | `pytest tests/test_x.py::test_conflict` | exit 0, asserts status 409 |
| 4 | [UI/judgment criterion if unavoidable] | `MANUAL` — [exact reviewer instructions] | [screenshot / reviewer note] |

## 8. Dependencies

| Dependency | Type | Failure Mode | Fallback |
|-----------|------|--------------|----------|
| ... | ... | ... | ... |

## 9. Open Questions

Anything needing clarification before implementation begins.

Rules

  1. Every number must be concrete. "Reasonable timeout" → "3000ms timeout with 3 retries at exponential backoff (1s, 2s, 4s)."
  2. Every boundary must have a violation response. If max payload is 5MB, document what happens at 5.1MB.
  3. Never use "etc." or "and so on." List everything explicitly or say "exhaustive list to be determined in Phase X."
  4. One spec per domain. If a spec exceeds 500 lines, it's covering too much — split it.
  5. Specs are immutable once approved. Changes require a new version with a changelog at the top. Reference the ADR that motivated the change.
  6. Acceptance criteria are executable. Each criterion maps to exactly one test and names its verification command. The independent verifier runs exactly what's written — no interpretation. If you can't write the test from the criterion alone, it's not precise enough.
  7. No implementation details in specs. Specs say WHAT, not HOW. "Passwords must be hashed with bcrypt cost 12" is a spec. "Use the bcrypt library's hash() function" is implementation.
  8. Cross-reference ADRs for every architectural choice. If the spec says "use event sourcing," there must be an ADR explaining why.

Anti-Patterns

Anti-PatternWhy It Fails
Writing specs before PRD is finalizedSpecs built on shifting requirements are waste
Combining multiple domains in one specEach spec should be independently implementable
Leaving error cases as "TBD"Every endpoint's errors must be defined before approval
Using "should" or "may"Use "must" or "must not" — specs are contracts, not suggestions
Assuming contextWrite as if reader has never seen this codebase
Duplicating across specsReference other specs — don't redefine
Skipping non-functional requirements"It should be fast" is not a spec — define numbers

Transition to Next Document

Once specs are approved:

  • Any architectural choices made → record as ADR (→ [[architecture-decision-record]])
  • Ready to break into tasks → create IMPL PLAN (→ [[implementation-plan]])
  • Specs become the single source of truth for implementation — Agents follow the contract exactly
  • The acceptance criteria tables become the verifier's input — after each task is built, the independent verifier executes them as written (→ [[independent-verification]])

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.