Habit · loads whenever its situation comes up, at any step

concurrency

about 3,100 tokens

concurrency as it installs, each line coloured by where its words came from.

  • 2 files
  • 0 edits
  • 129 sentences left out
  • 2 sources
  • last changed 2026-10-09

Replaces concurrency-method (retired 2026-10-08).

The text

SKILL.md

about 2,300 tokens
  • pstack
  • greenline

---

name: "concurrency"

description: "Decide whether code should be concurrent, reason about a concurrent design by its timelines, separate shared state before serializing it, and make an operation converge when a crash, a restart or a retry runs it twice, an idempotency key derived from the intent and claimed atomically. Use when adding threading, async, goroutines, workers or parallelism; when a race or an ordering bug appears; when two actors may write the same file, key or branch; and when a command, a step or a loop must survive crashes, restarts and retries."

---

greenlineOpens the habit: when it applies; found early, concurrency raises the mode

concurrency is the habit for the moment code is made concurrent or a race or an ordering bug appears, two actors may write the same state, or an operation must survive a crash, a restart or a retry, at whatever step the work is in, most often build. It writes no record of its own. Concurrency is a floor in AGENTS.md: found before the mode is proposed, it raises the proposal to the mode that floor names, and found later it is reported. Sections 1 to 5 reason about concurrent code; section 6 makes an operation that may run twice converge.

greenlineAsks three questions in order: warranted, how to reason, which laws hold

Three questions in order: whether concurrency is warranted, how to reason about the design, and which laws hold whatever the runtime is called. The last two are wasted on a program that failed the first.

greenlineDecides whether to go concurrent at all; the default is no

## 1. Decide, and the default is no

The burden of proof rests on the concurrency, never on the serial version: three languages agree that "this shiny feature" is where the danger sits (Latour), that many tasks do not need it (Matthews), and that short work loses to the cost of moving values (Bodner).

**Three properties qualify a workload, all of them:** parts doing I/O without interacting, a place where results combine, and a deadline that is a number. For I/O, interleaving pays only where waiting exceeds processing, and splitting a saturated resource degrades. Reason in orders of magnitude, and benchmark only where the order is genuinely unknown. **Decide up front,** since the choice is architectural and dearest after the second consumer. **Write it serially first, then benchmark both ways,** with the serial version as the control: one author's own benchmark refuted his own parallel tool, cheap arithmetic running longer in parallel (Matthews).

greenlineDraws timelines side by side so interference becomes visible

## 2. The instrument: draw the timelines

One author's method (Normand): section 1 has three witnesses, while sections 2, 3 and 5 have one, and rung three of section 3 a second, principle-separate-before-serializing-shared-state.

A timeline is a sequence of actions over time, and a diagram draws several side by side, which makes interference visible. Actions in order share a timeline; actions that can run at once or out of order go on separate ones. Calculations are left off, since their results do not depend on when they run, which keeps the diagram usably small. Three steps, and their order defends against drawing the diagram you already believe: identify the actions, draw each on a new timeline only where it can run in parallel, then simplify by platform guarantees. Draw before the code, redraw from zero after a change.

**Count the orderings and prune them; do not trace them all.** Two single-action timelines admit three orderings, two three-box timelines with one constrained start admit ten, and real systems generate thousands or millions. Tracing them all is impossible at realistic sizes, and that is the pivot: correctness comes from a structural guarantee that deletes orderings, never from green runs that may never see the interleaving a production week will.

**Only pairs touching the same resource need analysis.** Annotate every step with the resource it touches, then for each pair that shares one check all three relative orders: simultaneous, left first, right first. Decompose before you draw: an increment on a shared value is a read, a calculation, and a write, and one box hides the race the pair analysis exists to find. Explicit temporaries make it visible.

**Duration is never synchronisation:** the rare interleaving becomes common under load.

greenlineRanks remedies from removing the shared resource to managing it

## 3. The ladder

Ranked: earlier rungs remove the problem, later rungs manage it.

1. **Fewer timelines,** often outside your control.

2. **Shorter timelines,** by converting actions to calculations and reading shared values once into explicit parameters.

3. **Fewer shared resources,** preferring a single worker, which cuts the orderings you must think about rather than the orderings.

4. **Coordinate the sharing that remains** with a primitive.

5. **Manipulate time as a first-class concept,** since a platform's implicit model of ordering and repetition rarely fits.

pstackprinciple-separate-before-serializing-shared-state/SKILL.md

When concurrent actors might share mutable state, first ask whether they need the same mutable object. If not, eliminate the sharing. When sharing is real, enforce serialization structurally: lockfiles, sequential phases, exclusive ownership. Instructions and conventions are not concurrency control.

pstackprinciple-separate-before-serializing-shared-state/SKILL.md

**Pattern:**

1. **Identify shared mutable state** (files both read and write, branches both push to, APIs both define and consume).

2. **Default: eliminate the shared write target.** Ask: do these actors need one canonical object, or are they publishing independent facts? Give each actor its own owned file, key, branch, or state directory, and merge only at the read/reporting boundary. Two workers writing their own `lastX` field into one `state.json` is still shared mutation. `indexer-state.json` + `metrics-state.json` is not.

3. **Only when one shared write target is a real invariant, serialize access structurally** (lockfiles, sequential phases, single-writer actor, or atomic compare-and-swap). Treat "we need a lock" as a design smell to check, not as the default answer.

greenlineStates the laws that hold whatever the runtime calls its scheduler

## 4. The laws that survive translation

**Never block the scheduler, whatever it is called.** Blocking is holding the scheduler from switching tasks for a long period; I/O counts, and so does long-running compute. Two remedies and no third: run it off the scheduler's own workers, or break it up with yield points. Scheduler throughput is the shared resource nobody names.

**Share by communicating where the language offers it.** "Share memory by communicating; do not communicate by sharing memory" (the Go community, via Bodner). Legibility is the argument before safety: a guarded value never says which worker owns it, while a passed value shows its flow. Convert passing to guarding only once it has caused a real performance problem.

**Bound everything unbounded.** Every queue, fan-out, and wait carries a ceiling that is a number a person chose for a reason they can say. Where only the latest result matters it may discard stale entries, correct only where discarded work has no independent effect.

**Whoever starts a unit of concurrency decides at the launch site how it stops.** Above leak-hygiene sits the method claim: an unterminated timeline never closes, so no cut across it, the line splitting timelines into halves that cannot interleave, holds, and its orderings never leave the set.

greenlineTreats primitives as shapes that remove undesirable orderings

## 5. Primitives, a vocabulary of shapes

A primitive lets timelines share a resource safely, and the mechanism is always the same one: it removes undesirable orderings from the set. **Linearize** lets one instance of a timeline run at a time, and is the name to teach: the queue is the implementation, the guarantee is the point. **The cut** runs across the ends of several timelines, splitting each into halves that cannot interleave.

A primitive is an action, deliberately. It holds mutable state, defended rather than hidden: any timeline may call it and get predictable behaviour from state closed where nothing outside reaches it. What is built from calculations is what it coordinates, rung two. **Use the primitive your language or platform ships,** since hand-built shapes teach the reasoning, not the library, and are safe only on the single-threaded platform they were written for.

pstackprinciple-make-operations-idempotent/SKILL.md

Design operations so they converge to the correct state regardless of how many times they run or where they start from. Every state-mutating operation should answer: "What happens if this runs twice? What happens if the previous run crashed halfway?"

pstackprinciple-make-operations-idempotent/SKILL.md

**The pattern:**

- Convergent startup: scan for existing state, clean stale artifacts, adopt live sessions

- Content-based cleanup: compare by content equivalence, not creation order

pstackprinciple-make-operations-idempotent/SKILL.md

- Idempotent scheduling: failed work respawns cleanly, fresh input regenerated after each cycle

**The test:**

1. What happens if this runs twice in a row?

2. What happens if the previous run crashed at every possible point?

3. Does re-execution converge to the same end state?

If any answer is "it depends on what state was left behind," the operation needs a reconciliation step.

greenlineA retried request carries an idempotency key; idempotency-key.md says how

Where a caller retries a request against your service, the request carries an idempotency key, and [idempotency-key.md](idempotency-key.md) says how to honour it: derived from the intent, claimed atomically, its payload guarded, the intent recorded before the effect, and kept as long as the longest retry chain.

greenlineNames which author witnesses which section, and the other sources consulted

## Sources

Normand, _Grokking Simplicity_, is the sole witness behind sections 2 and 5 and the ladder of section 3, whose third rung also takes pstack's principle-separate-before-serializing-shared-state; section 6 is pstack's principle-make-operations-idempotent and addyosmani's api-and-interface-design. Other sources: Bodner, _Learning Go_ (3e early release, revisit April 2027); Latour, _Go Pocket Projects_; Matthews, _Code Like a Pro in Rust_. The maintainer's graded research records are provenance, not required installed support files. The complete method above is available here.

SKILL.md as installed, byte for byte SHA-256 97bdb1d950debba98c7d1d0fea8fadb90f665b03ff40416f25bbf0a2c356c482

idempotency-key.md

about 780 tokens
  • Addy Osmani's agent-skills
  • greenline

Addy Osmani's agent-skillsapi-and-interface-design/SKILL.md

Accepting an `Idempotency-Key` is the contract. Honouring it is the implementation, and it is where the money is lost — a key the server accepts but handles carelessly is worse than no key at all, because the client now believes retrying is safe.

**Derive the key from the intent, not the attempt.** The key must be stable across retries of one intent and different across distinct intents:

```typescript

crypto.randomUUID() // ✗ new key per attempt — every retry is a new charge

`${userId}:${amount}` // ✗ two legitimate $50 charges collapse into one

`${orderId}:${Date.now()}` // ✗ a timestamp is randomUUID() wearing a hat

req.headers['idempotency-key'] // ✓ client generates once, reuses on retry

`charge:v1:${orderId}` // ✓ derived from an immutable identifier

```

The key comes from the client or the initiating event — never from the layer doing the retrying.

**Claim atomically. A check followed by an act is a race:**

```typescript

// ✗ TOCTOU: two concurrent retries both read "not seen", both charge

if (!(await db.exists(key))) {

await chargeCard(amount);

await db.insert(key);

}

// ✓ let the unique constraint pick the winner

try {

await db.insert({ key, state: 'in_progress', requestHash });

} catch (e) {

if (isUniqueViolation(e)) return replayOrReject(key);

throw e;

}

const result = await chargeCard(amount);

await db.update({ key, state: 'succeeded', response: result });

```

The unique constraint *is* the mechanism. A store that cannot enforce uniqueness in one operation cannot back this.

**Guard the payload.** Same key with a different body is a client bug, and must fail loudly rather than serving the first response to a second request:

```typescript

if (existing.requestHash !== hash(req.body)) {

return res.status(422).json({ error: 'idempotency key reused with a different payload' });

}

```

**Decide what an in-flight duplicate gets.** The first request is still running when the second arrives — the common case under retry storms:

| Strategy | Response | Use when |

|---|---|---|

| Reject | `409 Conflict` | Client can retry later; simplest and safest |

| Wait | Block for the result, bounded | Caller needs it synchronously |

| Return pending | `202` + status URL | Long-running effects |

Never let the second caller through because the first "seems stuck". A stalled attempt whose fate is unknown is exactly when duplicating costs most.

**Every call has three outcomes, not two: success, failure, and _unknown_.** A timeout tells you nothing about whether the effect applied. Record the intent *before* calling out, so a crash between the call and the response leaves evidence something must resolve later — rather than a silently retried charge.

**Set retention from the longest retry chain**, not from disk cost. Keys must outlive every path that can re-deliver the same intent, including a dead-letter queue replayed a week later and any provider dispute window. A 24-hour key TTL behind a 7-day DLQ is a duplicate waiting to happen.

What greenline wrote

The full reason for every passage greenline wrote, in the order of the text.

  1. SKILL.md:6 rename

    The habit's title is its roster name, concurrency, which R22 gives the habit concurrency-method became.

  2. SKILL.md:8 scope

    One opening paragraph in the habit's own voice: the situations the block's rows key it by, that it writes no record of its own, the floor concurrency raises a proposal to, and the new section 6 the opening's three questions do not name.

  3. SKILL.md:10 method

    The title and opening: the three questions in their order, whether concurrency is warranted, how to reason about the design, and which laws hold on any runtime. R1

  4. SKILL.md:14 method

    Section 1: the decision whether to make code concurrent at all, with no as the default and the burden of proof on the concurrency. R1

  5. SKILL.md:32 method

    Section 2: the timeline diagram as the instrument for reasoning about a concurrent design. (S18a: rung three of section 3 gains a second witness, the grafted principle.) R1

  6. SKILL.md:66 method

    Section 3: the ladder of remedies, ranked from removing the shared-resource problem to managing it. R1

  7. SKILL.md:79 method

    principle-separate-before-serializing-shared-state strengthens the ladder's third rung, fewer shared resources, with its test of one canonical object against independent facts. R2

  8. SKILL.md:88 method

    Section 4: the laws that hold whatever the runtime calls its scheduler and tasks. R1

  9. SKILL.md:115 method

    Section 5: the primitives as a vocabulary of shapes that remove undesirable orderings. R1

  10. SKILL.md:132 method

    principle-make-operations-idempotent is the spine of a section of its own, with the idempotency core of api-and-interface-design grafted into it. R2

  11. SKILL.md:148 pointer

    api-and-interface-design's idempotency core lives on idempotency-key.md, read only where a caller retries a request, so the section names the page and what it holds.

  12. SKILL.md:150 method

    The sources: which author witnesses which section, and the other sources consulted. (S18a: the grafted rung and section 6 name their sources.) R1

    Credits: pstack and Addy Osmani's agent-skills

  13. idempotency-key.md:1 method

    api-and-interface-design's idempotency section joins the concurrency habit's section 6 as its page: the key is how a retried request converges. Its own heading carried that page's number. R2

What it left out

pstack

pstack, principle-separate-before-serializing-shared-state/SKILL.md: 2 of 15 sentences left out
  1. # Separate Before Serializing Shared State left out: The title becomes the rung's heading. replaced by line 79 of SKILL.md
  2. 4 sentences taken
  3. **Why:** Concurrent writes to shared state create race conditions that are intermittent, hard to reproduce, and expensive to debug. left out: The why restates the ladder's reason for removing the shared resource first.
pstack, principle-make-operations-idempotent/SKILL.md: 4 of 16 sentences left out
  1. # Make Operations Idempotent left out: The title becomes the section's heading. replaced by line 132 of SKILL.md
  2. 3 sentences taken
  3. **Why:** Commands, lifecycle operations, and processing loops run where crashes, restarts, and retries are normal.
  4. If partial state changes the next run's outcome, every restart becomes a debugging session. 2 sentences left out: The why restates the question the opening asks.
  5. 3 sentences taken
  6. Self-healing locks: use PID-based stale lock detection left out: PID-based stale lock detection gives way to the primitive the platform ships, section 5 (contradiction 31). R2

Addy Osmani's agent-skills

Addy Osmani's agent-skills, api-and-interface-design/SKILL.md: 123 of 152 sentences left out
  1. # API and Interface Design
  2. ## Overview
  3. Design stable, well-documented interfaces that are hard to misuse.
  4. Good interfaces make the right thing easy and the wrong thing hard.
  5. This applies to REST APIs, GraphQL schemas, module boundaries, component props, and any surface where one piece of code talks to another.
  6. ## When to Use
  7. Designing new API endpoints
  8. Defining module boundaries or contracts between teams
  9. Creating component prop interfaces
  10. Establishing database schema that informs API shape
  11. Changing existing public interfaces
  12. ## Core Principles
  13. ### Hyrum's Law
  14. 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.
  15. This means: every public behavior — including undocumented quirks, error message text, timing, and ordering — becomes a de facto contract once users depend on it.
  16. Design implications:
  17. **Be intentional about what you expose.**
  18. Every observable behavior is a potential commitment.
  19. **Don't leak implementation details.**
  20. If users can observe it, they will depend on it.
  21. **Plan for deprecation at design time.**
  22. See `deprecation-and-migration` for how to safely remove things users depend on.
  23. **Tests are not enough.**
  24. Even with perfect contract tests, Hyrum's Law means "safe" changes can break real users who depend on undocumented behavior.
  25. ### The One-Version Rule
  26. Avoid forcing consumers to choose between multiple versions of the same dependency or API.
  27. Diamond dependency problems arise when different consumers need different versions of the same thing.
  28. Design for a world where only one version exists at a time — extend rather than fork.
  29. ### 1. Contract First
  30. Define the interface before implementing it.
  31. The contract is the spec — implementation follows.
  32. ```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: string): Promise<Task>; // Partial update — only provided fields change updateTask(id: string, input: UpdateTaskInput): Promise<Task>; // Idempotent delete — succeeds even if already deleted deleteTask(id: string): Promise<void>; } ```
  33. ### 2. Consistent Error Semantics
  34. Pick one error strategy and use it everywhere:
  35. ```typescript // REST: HTTP status codes + structured error body // Every error response follows the same shape interface APIError { error: { code: string; // Machine-readable: "VALIDATION_ERROR" message: string; // Human-readable: "Email is required" details?: unknown; // Additional context when helpful }; } // Status code mapping // 400 → Client sent invalid data // 401 → Not authenticated // 403 → Authenticated but not authorized // 404 → Resource not found // 409 → Conflict (duplicate, version mismatch) // 422 → Validation failed (semantically invalid) // 500 → Server error (never expose internal details) ```
  36. **Don't mix patterns.**
  37. If some endpoints throw, others return null, and others return `{ error }` — the consumer can't predict behavior.
  38. ### 3. Validate at Boundaries
  39. Trust internal code.
  40. Validate at system edges where external input enters:
  41. ```typescript // Validate at the API boundary app.post('/api/tasks', async (req, res) => { const result = CreateTaskSchema.safeParse(req.body); if (!result.success) { return res.status(422).json({ error: { code: 'VALIDATION_ERROR', message: 'Invalid task data', details: result.error.flatten(), }, }); } // After validation, internal code trusts the types const task = await taskService.create(result.data); return res.status(201).json(task); }); ```
  42. Where validation belongs:
  43. API route handlers (user input)
  44. Form submission handlers (user input)
  45. External service response parsing (third-party data -- **always treat as untrusted**)
  46. Environment variable loading (configuration)
  47. **Third-party API responses are untrusted data.**
  48. Validate their shape and content before using them in any logic, rendering, or decision-making.
  49. A compromised or misbehaving external service can return unexpected types, malicious content, or instruction-like text.
  50. Where validation does NOT belong:
  51. Between internal functions that share type contracts
  52. In utility functions called by already-validated code
  53. On data that just came from your own database
  54. ### 4. Prefer Addition Over Modification
  55. Extend interfaces without breaking existing consumers:
  56. ```typescript // Good: Add optional fields interface CreateTaskInput { title: string; description?: string; priority?: 'low' | 'medium' | 'high'; // Added later, optional labels?: string[]; // Added later, optional } // Bad: Change existing field types or remove fields interface CreateTaskInput { title: string; // description: string; // Removed — breaks existing consumers priority: number; // Changed from string — breaks existing consumers } ```
  57. ### 5. Predictable Naming
  58. | Pattern | Convention | Example |
  59. |---------|-----------|---------|
  60. | REST endpoints | Plural nouns, no verbs | `GET /api/tasks`, `POST /api/tasks` |
  61. | Query params | camelCase | `?sortBy=createdAt&pageSize=20` |
  62. | Response fields | camelCase | `{ createdAt, updatedAt, taskId }` |
  63. | Boolean fields | is/has/can prefix | `isComplete`, `hasAttachments` |
  64. | Enum values | UPPER_SNAKE | `"IN_PROGRESS"`, `"COMPLETED"` | 64 sentences left out: API design, Hyrum's law, versioning, error semantics, REST naming, pagination and the TypeScript interface patterns are knowledge consulted for an engineering choice, handed to garden's maintainer; only the idempotency core joins this habit. R2
  65. ### 6. Honouring an Idempotency Key left out: The section's heading carried that page's number. R2 replaced by line 1 of idempotency-key.md
  66. 29 sentences taken
  67. ## REST API Patterns
  68. ### Resource Design
  69. ``` GET /api/tasks → List tasks (with query params for filtering) POST /api/tasks → Create a task GET /api/tasks/:id → Get a single task PATCH /api/tasks/:id → Update a task (partial) DELETE /api/tasks/:id → Delete a task GET /api/tasks/:id/comments → List comments for a task (sub-resource) POST /api/tasks/:id/comments → Add a comment to a task ```
  70. ### Pagination
  71. Paginate list endpoints:
  72. ```typescript // Request GET /api/tasks?page=1&pageSize=20&sortBy=createdAt&sortOrder=desc // Response { "data": [...], "pagination": { "page": 1, "pageSize": 20, "totalItems": 142, "totalPages": 8 } } ```
  73. ### Filtering
  74. Use query parameters for filters:
  75. ``` GET /api/tasks?status=in_progress&assignee=user123&createdAfter=2025-01-01 ```
  76. ### Partial Updates (PATCH)
  77. Accept partial objects — only update what's provided:
  78. ```typescript // Only title changes, everything else preserved PATCH /api/tasks/123 { "title": "Updated title" } ```
  79. ## TypeScript Interface Patterns
  80. ### Use Discriminated Unions for Variants
  81. ```typescript // Good: Each variant is explicit type TaskStatus = | { type: 'pending' } | { type: 'in_progress'; assignee: string; startedAt: Date } | { type: 'completed'; completedAt: Date; completedBy: string } | { type: 'cancelled'; reason: string; cancelledAt: Date }; // Consumer gets type narrowing function getStatusLabel(status: TaskStatus): string { switch (status.type) { case 'pending': return 'Pending'; case 'in_progress': return `In progress (${status.assignee})`; case 'completed': return `Done on ${status.completedAt}`; case 'cancelled': return `Cancelled: ${status.reason}`; } } ```
  82. ### Input/Output Separation
  83. ```typescript // Input: what the caller provides interface CreateTaskInput { title: string; description?: string; } // Output: what the system returns (includes server-generated fields) interface Task { id: string; title: string; description: string | null; createdAt: Date; updatedAt: Date; createdBy: string; } ```
  84. ### Use Branded Types for IDs
  85. ```typescript type TaskId = string & { readonly __brand: 'TaskId' }; type UserId = string & { readonly __brand: 'UserId' }; // Prevents accidentally passing a UserId where a TaskId is expected function getTask(id: TaskId): Promise<Task> { ... } ```
  86. ## Common Rationalizations
  87. | Rationalization | Reality |
  88. |---|---|
  89. | "We'll document the API later" | The types ARE the documentation. Define them first. |
  90. | "We don't need pagination for now" | You will the moment someone has 100+ items. Add it from the start. |
  91. | "PATCH is complicated, let's just use PUT" | PUT requires the full object every time. PATCH is what clients actually want. |
  92. | "We'll version the API when we need to" | Breaking changes without versioning break consumers. Design for extension from the start. |
  93. | "Nobody uses that undocumented behavior" | Hyrum's Law: if it's observable, somebody depends on it. Treat every public behavior as a commitment. |
  94. | "We can just maintain two versions" | Multiple versions multiply maintenance cost and create diamond dependency problems. Prefer the One-Version Rule. |
  95. | "Internal APIs don't need contracts" | Internal consumers are still consumers. Contracts prevent coupling and enable parallel work. |
  96. | "Accepting the Idempotency-Key header is enough" | The header is the contract; storing the key against the result is the implementation. A key you accept but don't honour tells the client retrying is safe when it isn't. |
  97. | "Our queue guarantees exactly-once delivery" | No queue does across a consumer crash — the broker's ack and your side effect are not in one transaction. Design for at-least-once with idempotent processing. |
  98. | "Duplicate requests are rare" | They're *correlated*. Retries spike exactly when a dependency is degraded — the moment duplicates are most likely and most expensive. |
  99. ## Red Flags
  100. Endpoints that return different shapes depending on conditions
  101. Inconsistent error formats across endpoints
  102. Validation scattered throughout internal code instead of at boundaries
  103. Breaking changes to existing fields (type changes, removals)
  104. List endpoints without pagination
  105. Verbs in REST URLs (`/api/createTask`, `/api/getUsers`)
  106. Third-party API responses used without validation or sanitization
  107. A `SELECT` for an idempotency key followed by an `INSERT` — that's a race, not a guard
  108. An idempotency key derived from a UUID, timestamp, or anything else regenerated per attempt
  109. The same key accepted with a different request body, silently returning the first response
  110. A key retention window shorter than the longest path that can re-deliver the request
  111. ## Verification
  112. After designing an API:
  113. [ ] Every endpoint has typed input and output schemas
  114. [ ] Error responses follow a single consistent format
  115. [ ] Validation happens at system boundaries only
  116. [ ] List endpoints support pagination
  117. [ ] New fields are additive and optional (backward compatible)
  118. [ ] Naming follows consistent conventions across all endpoints
  119. [ ] API documentation or types are committed alongside the implementation
  120. [ ] State-changing endpoints either honour an idempotency key or are documented as unsafe to retry
  121. [ ] The key is claimed in one atomic operation, guarded by a unique constraint
  122. [ ] A reused key with a different payload fails loudly rather than replaying the wrong response
  123. [ ] The in-flight-duplicate response is a deliberate choice (409, wait, or 202) rather than whatever falls out
  124. [ ] Key retention outlives the longest retry path, including dead-letter replay 58 sentences left out: API design, Hyrum's law, versioning, error semantics, REST naming, pagination and the TypeScript interface patterns are knowledge consulted for an engineering choice, handed to garden's maintainer; only the idempotency core joins this habit. R2

The ledger entry

greenline's ledger logs how each skill was made and changed, with a reason for each entry.

2026-10-09 2026-10-09-concurrency-gists

Every account gets a short gist for the website

Adds a gist of at most twelve words, for the website's edition, to every account of the recipe whose reason is stated. No text, measure or method changes.

Authorised by
2026-10-09 J-59, on the operator's words of 2026-10-09 ('okay then implement all of this'): a gist of at most twelve words on every account whose reason is stated; no text, measure or method changes
Pages it touched
none
Rulings, R1 to R8
  1. No docs/DECISIONS.md row and no entry of the old chain rules this skill; the move changes no method, under the row of 2026-10-04 (modes-records-recipes, Q1): the existing roster skills move to recipes first, as they stand, and are re-cut afterwards by editing recipes, in the operator's words "okay then lock in what you recommend"
  2. the operator's rulings of 2026-10-08 on the intake R3 ("everything is good", and "yes go ahead" on the portable forms of R21), the verdicts standing and every contradiction ruled as recommended: principle-make-operations-idempotent is the spine of an idempotency section, its PID lock line dropped for the primitive the platform ships (contradiction 31); the idempotency core of api-and-interface-design joins it, its API design, versioning and HTTP rules garden's; and principle-separate-before-serializing-shared-state strengthens the ladder's third rung
  3. The method items carry the operator's rulings of 2026-10-08 on the intake R3 ("everything is good", and "yes go ahead" on the portable forms of R21), the verdicts standing and every contradiction ruled as recommended: principle-make-operations-idempotent is the spine of an idempotency section, its PID lock line dropped for the primitive the platform ships (contradiction 31); the idempotency core of api-and-interface-design joins it, its API design, versioning and HTTP rules garden's; and principle-separate-before-serializing-shared-state strengthens the ladder's third rung
  4. the operator's ruling R22 of 2026-10-08 on the re-cut brief, "yes amend, with one change": the roster table's names stand, deep-modules, domain-and-types, boundaries, concurrency, secrets and prose among them, tdd and ponytail keeping theirs
  5. the operator's rulings of 2026-10-04, "cool then lock everything in": every change has one record its steps write, and a habit writes none of its own
  6. R16 of 2026-10-07, a habit loaded when its situation arises at any step ("update the agents md created by greenline product to mention the kind with the skill table and also prose about when to use what kind skill")
  7. the sections taken from concurrency-method change no method, under the row of 2026-10-04 (Q1), in the operator's words "okay then lock in what you recommend"
  8. J-59, on the operator's words of 2026-10-09 ('okay then implement all of this'): a gist of at most twelve words on every account whose reason is stated; no text, measure or method changes
1 earlier entry
  1. 2026-10-08 2026-10-08-concurrency-recipe

    Concurrency-method renamed, with a new section on running twice

    Pages it touched: SKILL.md, idempotency-key.md