agentleFS
RidhuanDEVRidhuanDEV/claude-skills/shadow-integrate/SKILL.md

shadow-integrate

Skill1 starsChanged yesterdayMITView on GitHub

External & Third-Party Integration Engineering. Use when integrating payment gateways (SNAP BI, Midtrans, Xendit, Stripe), HMAC webhooks with replay protection, SMTP/WhatsApp gateways, retries/circuit breakers, or Transactional Outbox.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 5 are distinctive, and 2 are 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.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill whenever integrating external services: payment gateways (Midtrans, Xendit, Stripe, SNAP BI), messaging/SMTP (WhatsApp, …

    line 8
  2. Distinctive:

    Every outbound HTTP call to an external provider MUST enforce:

    line 14
  3. Very specific:

    Never make an outbound fetch / axios / httpx / http.Client call with an infinite default timeout.

    line 16
  4. Distinctive:

    When receiving webhooks from external providers (Payment status, GitHub/GitLab, WhatsApp, courier tracking):

    line 29
  5. Distinctive:

    When a database transaction must trigger an email, webhook, or message queue event:

    line 43
  6. Distinctive:

    Do NOT send the email/HTTP call inside the DB transaction.

    line 44
  7. Very specific:

    Instead, insert an outbox_events record inside the same DB transaction, and hand off durable locking, retry budgets, DLQ, and …

    line 45

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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

Shadow Integrate (/shadow-integrate) — Resilient Third-Party APIs, Webhooks & Outbox

Use this skill whenever integrating external services: payment gateways (Midtrans, Xendit, Stripe, SNAP BI), messaging/SMTP (WhatsApp, Email, FCM), government/enterprise APIs (SatuSehat, BSrE, Dukcapil, ERP), or incoming/outgoing webhooks.


1. Outbound Third-Party API Calls (Never Trust External Networks)

Every outbound HTTP call to an external provider MUST enforce:

  1. Explicit Connection & Read Timeouts:
    • Never make an outbound fetch / axios / httpx / http.Client call with an infinite default timeout. Set explicit timeouts (e.g., connectTimeout: 3000ms, responseTimeout: 8000ms).
  2. Bounded Retry with Exponential Backoff + Full Jitter:
    • Retry ONLY transient failures (408, 429 Too Many Requests respecting Retry-After, 502, 503, 504, network timeout).
    • Never retry 400, 401, 403, 404, or 422 validation errors.
    • Attach an Idempotency-Key when retrying mutating POST requests so a network timeout after server execution never double-charges a user.
  3. Anti-Corruption Adapter Layer:
    • Wrap every third-party SDK/API behind a clean internal interface (PaymentProvider, NotificationGateway) and validate raw external JSON responses at the boundary before mapping into internal domain types.
    • Redact API keys, Authorization headers, and PII from all request/response integration logs.

2. Inbound Webhook Security & Idempotency Protocol

When receiving webhooks from external providers (Payment status, GitHub/GitLab, WhatsApp, courier tracking):

  1. Verify Cryptographic Signature (HMAC-SHA256 / Asymmetric Signature) on Raw Body:
    • Compare signatures using constant-time comparison (crypto.timingSafeEqual / hmac.compare_digest).
  2. Replay Attack Protection:
    • Reject webhook payloads whose timestamp header is older than 5 minutes.
  3. Deduplicate by Provider event_id (webhook_events Ledger):
    • Providers deliver webhooks at-least-once. Insert provider_event_id with a UNIQUE constraint before processing; if already processed, return 200 OK immediately without re-running side effects.
  4. Fast 200 OK + Async Queue Processing:
    • Persist the verified webhook payload and enqueue background processing so the webhook endpoint responds within < 500ms.

3. Transactional Outbox Pattern (For Reliable Side Effects)

When a database transaction must trigger an email, webhook, or message queue event:

  • Do NOT send the email/HTTP call inside the DB transaction.
  • Instead, insert an outbox_events record inside the same DB transaction, and hand off durable locking, retry budgets, DLQ, and crash-before-ack idempotency semantics to /shadow-concurrency.
  1. Reconciliation & Partial Failure Safety:
    • Pair asynchronous payment/ERP webhooks with scheduled reconciliation jobs (querying provider status APIs for unresolved PENDING transactions beyond SLA) so dropped webhooks or partial outages never leave ledger mismatches.

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.