본문으로 건너뛰기
cccskills
무료GitHub에 공개

idempotency-handling

Implement idempotency keys and handling to ensure operations can be safely retried without duplicate effects. Use when building payment systems, APIs with retries, or distributed transactions.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구StripeRedis
설치 방법 보기

포함된 파일(8)

  • SKILL.md3.4 KB
  • references/database-based-idempotency.md2.7 KB
  • references/express-idempotency-middleware.md4.3 KB
  • references/message-queue-idempotency.md2.6 KB
  • references/stripe-style-idempotency.md5.1 KB
  • references/upstream.md1.3 KB
  • scripts/validate-api.sh438 B
  • templates/api-scaffold.yaml467 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

This repository (Asymmetric-al/core)

Subordinate to docs/ai/rules/backend.md and docs/guides/architecture/data-access-boundary.md. Pair with Stripe/payment work using ecosystem skills under .agents/skills/ when installed.

Repo touchpoints:

  • Donor API idempotency header validation: packages/api/src/donate/idempotency.ts (idempotency-key / x-idempotency-key).
  • Prefer existing monorepo patterns (Next.js route handlers, Supabase, Stripe) over copying generic Express/Redis examples from this skill verbatim.

Refresh: references/upstream.md.

Idempotency Handling

Table of Contents

Overview

Implement idempotency to ensure operations produce the same result regardless of how many times they're executed.

When to Use

  • Payment processing
  • API endpoints with retries
  • Webhooks and callbacks
  • Message queue consumers
  • Distributed transactions
  • Bank transfers
  • Order creation
  • Email sending
  • Resource creation

Quick Start

Minimal working example:

import express from "express";
import Redis from "ioredis";
import crypto from "crypto";

interface IdempotentRequest {
  key: string;
  status: "processing" | "completed" | "failed";
  response?: any;
  error?: string;
  createdAt: number;
  completedAt?: number;
}

class IdempotencyService {
  private redis: Redis;
  private ttl = 86400; // 24 hours

  constructor(redisUrl: string) {
    this.redis = new Redis(redisUrl);
  }

  async getRequest(key: string): Promise<IdempotentRequest | null> {
    const data = await this.redis.get(`idempotency:${key}`);
    return data ? JSON.parse(data) : null;
  }
// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Express Idempotency MiddlewareExpress Idempotency Middleware
Database-Based IdempotencyDatabase-Based Idempotency
Stripe-Style IdempotencyStripe-Style Idempotency
Message Queue IdempotencyMessage Queue Idempotency

Best Practices

✅ DO

  • Require idempotency keys for mutations
  • Store request and response together
  • Set appropriate TTL for idempotency records
  • Validate request body matches stored request
  • Handle concurrent requests gracefully
  • Return same response for duplicate requests
  • Clean up old idempotency records
  • Use database constraints for atomicity

❌ DON'T

  • Apply idempotency to GET requests
  • Store idempotency data forever
  • Skip validation of request body
  • Use non-unique idempotency keys
  • Process same request concurrently
  • Change response for duplicate requests

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Audit and fix accessibility in Core UI. Use when changing or reviewing buttons, links, forms, validation, dialogs, menus, tabs, tables, keyboard interactions, focus management, accessible names, announcements, contrast, touch targets, reduced motion, or WCAG/a11y behavior.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Asymmetric-al/core3812026년 10월 19일 업데이트

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Asymmetric-al/core3812026년 10월 19일 업데이트

Use when building any system where email content triggers actions — AI agent inboxes, automated support handlers, email-to-task pipelines, or any workflow processing untrusted inbound email. Always use this skill when the user wants to receive emails and act on them programmatically, even if they don't mention "agent" — the skill contains critical security patterns (sender allowlists, content filtering, sandboxed processing) that prevent untrusted email from controlling your system.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Asymmetric-al/core3812026년 10월 19일 업데이트

anim

무료

Tasteful, subtle web UI animation following Emil Kowalski / animations.dev principles. Use when adding or reviewing interface motion — hover and press feedback, entrances and exits, modals, toasts, menus, loading and skeleton states, staggered reveals, page or view transitions — so motion stays refined and purposeful, not decorative. Covers CSS, Web Animations, and React timing/easing. Pair with the motion skill for motion/react API specifics.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Asymmetric-al/core3812026년 10월 19일 업데이트

animate

무료

Build an animation from scratch, making the decisions in the order that determines whether it feels right — should it animate at all, what purpose, which tool, which properties, which curve and duration, how it interrupts, how it exits. Writes the implementation. Use when asked to animate something, add motion, make a component feel alive, or build a transition. For critiquing existing motion use review-animations; for auditing a whole codebase use improve-animations. Only runs when explicitly invoked; it does not trigger on its own.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Asymmetric-al/core3812026년 10월 19일 업데이트

Build animations for Expo and React Native only, using Reanimated, Gesture Handler, Expo Router, and expo-haptics. Use when the target runtime is an Expo or React Native app. Do not use it for Core Next.js web motion; use `animate` for web. Only runs when explicitly invoked; it does not trigger on its own.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Asymmetric-al/core3812026년 10월 19일 업데이트

Asymmetric-al의 스킬 모두 보기

이 스킬의 문제 신고