Skip to content

docs(api): add idempotency-key implementation guidance to api-and-interface-design - #479

Merged
addyosmani merged 1 commit into
addyosmani:mainfrom
abhisheksharma2411:feat/idempotency-and-exactly-once-skill
Aug 14, 2026
Merged

addyosmani merged 1 commit into
addyosmani:mainfrom
abhisheksharma2411:feat/idempotency-and-exactly-once-skill

Conversation

@abhisheksharma2411

@abhisheksharma2411 abhisheksharma2411 commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Reworked as an addition to api-and-interface-design, per @addyosmani's review. One file, +73, no new skill.

Where the seam is

#241 covers the contract: which methods are idempotent, accepting an Idempotency-Key header, replaying the stored result. This picks up where that stops — what the server has to do so the guarantee actually holds. A key you accept but handle carelessly is worse than no key, because the client now believes retrying is safe.

Added as ### 6. Honouring an Idempotency Key under Core Principles:

  • Derive the key from the intent, not the attempt — with the patterns that look right and aren't: randomUUID() per call, a timestamp, user + amount
  • Claim atomically — a SELECT then an INSERT is a race; the unique constraint is the mechanism
  • Guard the payload — same key, different body must fail loudly rather than replay the wrong response
  • Decide what an in-flight duplicate gets — 409 / wait / 202, deliberately, rather than whatever falls out of the control flow
  • Unknown is a third outcome, distinct from failure — record intent before calling out so a crash leaves evidence
  • Retention comes from the longest re-delivery path, including DLQ replay, not from disk cost

Plus 3 rationalizations, 4 red flags and 5 verification items, so it's enforceable rather than advisory.

On the overlap

You were right that a standalone skill was the wrong shape, and the repo's own tooling agreed more than I expected. When I ran the evals with the separate skill in place, its description outranked debugging-and-error-recovery on that skill's own prompt ("this test passed yesterday and fails today") — a false positive I couldn't tune away, because design-time failure analysis and diagnosing a live break genuinely share vocabulary.

Folding it in removes that entirely. Rank-1 routing goes from 85% to 86%, better than either the baseline or the standalone version.

Sequencing

#241 is still open and touches the same skill, though a different section — it adds an ### Idempotency subsection under REST/HTTP semantics, and this sits in Core Principles. I've deliberately not touched the frontmatter description or the README row, since #241 already updates both.

If #241 lands first I'll rebase; if this lands first #241 should apply cleanly. Happy to reorder or to merge the two into one section if you'd rather have a single home for it — just say which.

node scripts/validate-skills.js          → 24 skills, 0 errors, 0 warnings
node scripts/validate-reference-links.js → 0 errors
node scripts/run-evals.js --min-rank1 80 → 124 checks, 0 errors, rank-1 86%

Thanks for the steer — the folded version is tighter than what I first sent.

@abhisheksharma2411
abhisheksharma2411 force-pushed the feat/idempotency-and-exactly-once-skill branch from 3e1b82a to 07e2c0e Compare August 10, 2026 06:50

@addyosmani addyosmani left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid content, but idempotency and exactly-once overlap api-and-interface-design, which already covers idempotency (expanded in #241). I'd rather fold the distributed-systems depth into that skill than stand up a parallel one. Can you rework it as an addition to api-and-interface-design? Holding as its own skill for now.

Reworked from a standalone skill into an addition to api-and-interface-design,
per review feedback on addyosmani#479.

addyosmani#241 covers the contract surface: which methods are idempotent, accepting an
Idempotency-Key header, replaying the stored result. This picks up where that
stops -- what the server has to do so the guarantee actually holds:

  * derive the key from the intent, not the attempt, with the patterns that
    look right and are not (randomUUID per call, timestamps, user+amount)
  * claim atomically; a SELECT then an INSERT is a race, and the unique
    constraint is the mechanism
  * guard the payload, so a reused key with a different body fails loudly
    instead of replaying the wrong response
  * decide deliberately what an in-flight duplicate receives -- 409, wait, or
    202 -- rather than accepting whatever falls out of the control flow
  * treat unknown as a third outcome distinct from failure, and record intent
    before calling out so a crash leaves evidence
  * set key retention from the longest re-delivery path, including DLQ replay

Adds three rationalizations, four red flags and five verification items so the
guidance is enforceable rather than advisory.

Validators: validate-skills 24 skills 0 errors 0 warnings,
validate-reference-links 0 errors, run-evals --min-rank1 80 -> 124 checks,
0 errors, rank-1 86%.
@abhisheksharma2411
abhisheksharma2411 force-pushed the feat/idempotency-and-exactly-once-skill branch from 07e2c0e to ce89b03 Compare August 13, 2026 00:04
@abhisheksharma2411 abhisheksharma2411 changed the title feat(skills): add idempotency-and-exactly-once docs(api): add idempotency-key implementation guidance to api-and-interface-design Aug 13, 2026

@addyosmani addyosmani left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the right shape now, folded into api-and-interface-design as I'd hoped, and 'derive the key from the intent, not the attempt' is genuinely useful. One coordination note: #241 also expands this skill's idempotency coverage, so whichever lands first the other needs a quick rebase. Approving the content.

@addyosmani
addyosmani merged commit 65f696c into addyosmani:main Aug 14, 2026
hillemacher pushed a commit to hillemacher/agent-skills that referenced this pull request Aug 17, 2026
Reworked from a standalone skill into an addition to api-and-interface-design,
per review feedback on addyosmani#479.

addyosmani#241 covers the contract surface: which methods are idempotent, accepting an
Idempotency-Key header, replaying the stored result. This picks up where that
stops -- what the server has to do so the guarantee actually holds:

  * derive the key from the intent, not the attempt, with the patterns that
    look right and are not (randomUUID per call, timestamps, user+amount)
  * claim atomically; a SELECT then an INSERT is a race, and the unique
    constraint is the mechanism
  * guard the payload, so a reused key with a different body fails loudly
    instead of replaying the wrong response
  * decide deliberately what an in-flight duplicate receives -- 409, wait, or
    202 -- rather than accepting whatever falls out of the control flow
  * treat unknown as a third outcome distinct from failure, and record intent
    before calling out so a crash leaves evidence
  * set key retention from the longest re-delivery path, including DLQ replay

Adds three rationalizations, four red flags and five verification items so the
guidance is enforceable rather than advisory.

Validators: validate-skills 24 skills 0 errors 0 warnings,
validate-reference-links 0 errors, run-evals --min-rank1 80 -> 124 checks,
0 errors, rank-1 86%.
nad-au added a commit to dbc-tech/agent-skills that referenced this pull request Aug 21, 2026
* docs(security): add data privacy & compliance section

Adds a Data Privacy & Compliance section to security-and-hardening: PII/sensitive
classification, data minimization + purpose, retention/deletion paths (incl. backups),
data-subject rights (GDPR/CCPA), consent for third-party/vendor sharing, and data
residency. Complements the hardening content (can an attacker read it) with the
privacy question (should we hold it, and for how long).

* fix(security): trim frontmatter description to clear eval routing regression

The privacy trigger phrase used generic verbs (collecting, storing, retaining,
deleting, sharing) that pulled the security skill's routing rank above other
skills on unrelated prompts. Replacing with a tight 'personal data or privacy
compliance' phrase preserves discoverability without over-triggering.

* evals: make the TDD behavioral case discriminate skill effect

Replace the invoice fixture with a split-payment project where the
obvious remainder-dump fix passes the existing suite and the reported
case but violates a README fairness invariant. Neutral eval-1 prompt
(no test-first hint), pressure eval-2 now dictates the wrong one-liner
under a hotfix deadline. Expectations pin the exact earliest-shares
arrays so every remainder-dump variant is distinguishable, and the
schema example in evals/README.md is synced to the new eval 1.

* fix(evals): reject incomplete grader results

* fix(hooks): emit the standard SessionStart envelope (addyosmani#465)

The session-start hook emitted {"priority", "message"} JSON on all three
of its output paths. Codex CLI validates SessionStart hook output and
fails the hook on that shape ('hook returned invalid session start JSON
output', addyosmani#465); the documented contract for both Codex and Claude Code is

  {"hookSpecificOutput": {"hookEventName": "SessionStart",
                          "additionalContext": "..."}}

Switch all three paths (meta-skill injection, jq-missing fallback,
meta-skill-missing fallback) to that envelope. Verified each path emits
valid JSON of the new shape: happy path via jq shape assertion, jq-missing
via PATH='' run, meta-skill-missing via a copy outside the repo.

* feat(spec): add Phase 0 scope check — capability map for multi-capability requirements (addyosmani#431)

Implements the v1 scope agreed in addyosmani#431: when one requirement bundles
several independently testable capabilities, spec-driven-development now
runs a bounded front-step before Specify — detect multi-capability scope,
propose a capability map (stable module ids, one-way dependency direction,
build order), gate it on human approval, then recurse the gated workflow
per module in dependency order.

Kept deliberately small per the maintainer's scoping:
- detection + module map + stable identity only; no per-module artifact
  tree — module specs reuse the root-level SPEC-<id>.md naming so the
  layout follows the delta-spec direction in addyosmani#383 rather than leading it
- the simple path is preserved: single-capability requests skip Phase 0
  entirely, and the section says so first
- non-goals held: no PM framework, no forced hierarchy on small features

Also:
- description gains the decomposition vocabulary so realistic asks route
  here (both new positive triggers rank #1)
- /spec command wrappers (.claude, commands/, .gemini) gain one matching
  step, kept in parity
- eval case: +2 positive triggers, +1 owner-negative guarding the
  planning-and-task-breakdown boundary, +1 execution eval backed by a new
  multi-capability fixture (portal-brief.md)

Verification: validate-skills 24/24, validate-commands 8/8, run-evals
127 checks 0 errors 0 warnings, rank-1 86% (67/78) over floor 80,
behavioral dry-run resolves both spec evals.

* docs(antigravity): correct plugin install path per Issue addyosmani#445

The setup doc claimed plugins install to ~/.gemini/antigravity-cli/plugins/
but on current agy releases they land in ~/.gemini/config/plugins/. Issue
addyosmani#445 reporter confirmed the plugin lives under config/ on disk. Update the
path and add a note so users check the right location first.

Signed-off-by: Yunare Maia <yunare@gmail.com>

* fix(planning): define a single pluggable task list target (addyosmani#482)

The task list destination was hardcoded as tasks/todo.md in five places
across planning-and-task-breakdown, plus once more in
spec-driven-development's Phase 2 output convention. Projects tracking
tasks in an external tracker (bd/beads, Jira, Linear, GitHub Issues) had
to hand-edit every reference in a local fork.

Define the target once in a Task List Target section: default remains
the tasks/todo.md markdown checklist (downstream /build behavior is
unchanged), and projects can designate an external tracker via their
agent rules. All other references now defer to that single definition,
and spec-driven-development points at it instead of restating the path.

* docs(api): add idempotency-key implementation guidance

Reworked from a standalone skill into an addition to api-and-interface-design,
per review feedback on addyosmani#479.

addyosmani#241 covers the contract surface: which methods are idempotent, accepting an
Idempotency-Key header, replaying the stored result. This picks up where that
stops -- what the server has to do so the guarantee actually holds:

  * derive the key from the intent, not the attempt, with the patterns that
    look right and are not (randomUUID per call, timestamps, user+amount)
  * claim atomically; a SELECT then an INSERT is a race, and the unique
    constraint is the mechanism
  * guard the payload, so a reused key with a different body fails loudly
    instead of replaying the wrong response
  * decide deliberately what an in-flight duplicate receives -- 409, wait, or
    202 -- rather than accepting whatever falls out of the control flow
  * treat unknown as a third outcome distinct from failure, and record intent
    before calling out so a crash leaves evidence
  * set key retention from the longest re-delivery path, including DLQ replay

Adds three rationalizations, four red flags and five verification items so the
guidance is enforceable rather than advisory.

Validators: validate-skills 24 skills 0 errors 0 warnings,
validate-reference-links 0 errors, run-evals --min-rank1 80 -> 124 checks,
0 errors, rank-1 86%.

* chore(release): bump plugin manifests to 0.6.7

* docs(specs): anchor spec paths to repository root (/specs/**)

Models resolved specs/<feature>/ inconsistently — some as repo-root,
others relative to the current working directory (apps/specs/...).
All pipeline paths now use the leading-/ form (/specs/<feature>/SPEC.md,
/specs/<feature>/tasks/{plan,todo}.md) with an explicit Path Anchoring
note in spec-driven-development and planning-and-task-breakdown, and
repo-root qualifiers in the /spec, /plan, and /issue-build commands.
Legacy root fallbacks (SPEC.md, tasks/) and historical docs unchanged.

* feat(issue-pr): apply the build label to implementation PRs

issue-create labels build issues 'build' but the PRs that resolve them
were unlabelled, so implementation PRs and spec PRs were inseparable
in GitHub's filter view. issue-pr now ensures the label exists
(gh label create build --force, same convention as issue-create) and
passes --label build to gh pr create. Skill steps renumbered (label
step inserted as Step 6), rationalizations/red flags/verification
updated, and the behavioural eval expects the label.

* feat(issue-pr): prefix implementation PR titles with [BUILD]

The PR title now keeps the [BUILD] prefix from the build issue
(previously stripped), so implementation PRs group with their build
issues in listings and search, and are distinguishable from [SPEC]
PRs. Custom titles get the prefix too. Red flags and verification
checklist updated; behavioural eval expects the prefixed title.

---------

Signed-off-by: Yunare Maia <yunare@gmail.com>
Co-authored-by: Arun Kumar Thiagarajan <arunkt.bm14@gmail.com>
Co-authored-by: Federico Bartoli <federico.bartoli@madisoft.it>
Co-authored-by: NgoQuocViet2001 <ngoquocviet2001@gmail.com>
Co-authored-by: ayobamiseun <adegokeayobamiseun@gmail.com>
Co-authored-by: Addy Osmani <addyosmani@gmail.com>
Co-authored-by: Yunare Maia <yunare@gmail.com>
Co-authored-by: Abhishek Sharma <abhicse24@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants