Skip to main content
skill Claude Code CX Codex Cursor GitHub Copilot

insforge-integrations — Claude Code skill: what it does, install

A skill that walks your agent through hooking a third-party auth provider into InsForge and through taking x402 payments on an HTTP endpoint.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add InsForge/insforge-skills --skill insforge-integrations -a claude-code
Open on GitHub

What insforge-integrations does

The skill hands the agent a separate reference per auth provider: Clerk, Auth0, WorkOS, Kinde, Stytch, Better Auth. It opens the matching file under references/ and follows the steps — provider dashboard setup, a JWT carrying the user ID, the token passed to createClient() as accessToken (the edgeFunctionToken alias is deprecated), RLS policies built on requesting_user_id().

The other half is x402 payments with OKX as facilitator. The server answers with 402 Payment Required and a base64 challenge in the PAYMENT-REQUIRED header, the client signs an EIP-3009 authorization, the server forwards it to /verify and /settle and records the settled payment in a table with a realtime trigger.

Prepare two things first. The JWT secret comes from npx -y @insforge/cli secrets get JWT_SECRET, and OKX wants a Web3 API key from its dev portal, not an exchange trading key. External providers hand out string IDs, so user_id columns must be TEXT; UUID columns stop policy creation. With Better Auth, run the one-time REVOKE after migrate or the user table stays exposed through PostgREST.

What it helps with

  • wire Clerk into InsForge without server-side token signing
  • move RLS policies off auth.uid() onto requesting_user_id()
  • charge USDG on X Layer for a single HTTP endpoint
  • block duplicate payment rows with UNIQUE on tx_hash
  • run the whole payment flow locally against MOCK_OKX_FACILITATOR

Example prompts for the agent

  • Hook up Clerk to InsForge: JWT template, `accessToken` in the client, RLS policy on `requesting_user_id()`.
  • Wrap this endpoint in `402 Payment Required` and forward the signed authorization to OKX at `/verify` and `/settle`.
  • Audit my payments table: `tx_hash` needs `UNIQUE`, and the `insert` error after settlement has to be logged.

How to install insforge-integrations

1Skills CLI (Vercel)

npx skills add InsForge/insforge-skills --skill insforge-integrations -a claude-code

2Manually: put the files in place

~/.claude/skills/insforge-integrations/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/insforge-integrations/

Similar

engineering-advanced-skills Alireza Rezvani An index of 37 engineering skills for architecture, automation, reliability, and platform work. Use it when a project needs task-specific engineering workflows. Claude Code 2,019installs agents elevenlabs The skill builds voice AI agents on ElevenLabs: sets first_message, prompt, LLM and voice through CLI or SDK. Useful for voice assistants and support bots. Claude Code CX Codex Cursor +1 11,000installs software-design-philosophy wondelai A design-review skill that rates module depth, information leakage and comment quality, then names the fix for each failed check. Claude Code CX Codex Cursor +1 6,100installs minecraft-plugin-development official github Builds and debugs Minecraft server plugins for Paper, Spigot, and Bukkit. Handles commands, listeners, configs, and minigame states. GitHub Copilot 485installs senior-backend Alireza Rezvani Scaffolds backend APIs, detects database bottlenecks, and runs load tests. Useful when designing Express routes, optimizing PostgreSQL, or preparing for production. Claude Code 1,674installs aws-solution-architect Alireza Rezvani Designs AWS architectures, produces IaC templates, and reviews cloud costs. Use it for serverless builds, AWS migration work, or CI/CD planning. Claude Code 1,586installs mcp-builder official anthropics This skill walks through building an MCP server in TypeScript or Python, from reading the protocol spec to writing tests and evaluation questions. Claude Code Claude.ai 130,949installs google-agents-cli-adk-code official Google A reference skill for building ADK agents with tools, callbacks, state, and workflows. Use it when an agent project needs concrete API patterns or code examples. Claude Code CX Codex Cursor +1 511,400installs

Questions about insforge-integrations

How do I install insforge-integrations in Claude Code?

Run npx skills add InsForge/insforge-skills --skill insforge-integrations -a claude-code. The skill lands at ~/.claude/skills/insforge-integrations/SKILL.md.

What does insforge-integrations do?

It turns a third-party auth provider's JWT into InsForge RLS policies, and its second part covers x402 pay-per-use billing through OKX. Provider dashboard setup, server and client code, and database schema all come with examples.

Does the OKX part need a trading account?

No. An exchange trading API key is the wrong credential here; you create a Web3 API key at the OKX dev portal. For local work the skill describes a MOCK_OKX_FACILITATOR flag that skips real funds and returns fake tx hashes.

Source text

SKILL.md · Apache-2.0
---
name: insforge-integrations
description: >-
  Use when wiring an external auth provider (Clerk, Auth0, WorkOS, Kinde,
  Stytch, Better Auth) into InsForge for JWT-based RLS, or when adding the
  OKX x402 payment facilitator for onchain pay-per-use billing.
license: Apache-2.0
---

# InsForge Integrations

This skill covers integrating **third-party providers** with InsForge. Currently two categories are supported: **auth providers** (RLS via JWT claims) and **payment facilitators** (x402 HTTP payment protocol). Each provider has its own guide under this directory.

## Auth Providers

| Provider | Guide | When to use |
|----------|-------|-------------|
| [Clerk](references/clerk.md) | Clerk JWT Templates + InsForge RLS | Clerk signs tokens directly via JWT Template — no server-side signing needed |
| [Auth0](references/auth0.md) | Auth0 Actions + InsForge RLS | Auth0 uses a post-login Action to embed claims into the access token |
| [WorkOS](references/workos.md) | WorkOS AuthKit + InsForge RLS | WorkOS AuthKit middleware + server-side JWT signing with `jsonwebtoken` |
| [Kinde](references/kinde.md) | Kinde + InsForge RLS | Kinde token customization for InsForge integration |
| [Stytch](references/stytch.md) | Stytch + InsForge RLS | Stytch session tokens for InsForge integration |
| [Better Auth](references/better-auth.md) | Better Auth + InsForge RLS | Self-hosted auth running in your InsForge Postgres — no third-party SaaS, no per-MAU cost |

## Payment Facilitators

| Provider | Guide | When to use |
|----------|-------|-------------|
| [OKX x402](references/okx-x402.md) | OKX as x402 facilitator (USDG on X Layer) | Pay-per-use HTTP endpoints settled onchain with zero gas for the payer |

## Common Patterns

### Auth providers
1. **Provider signs or issues a JWT** containing the user's ID
2. **JWT is passed to InsForge** via `accessToken` in `createClient()` (deprecated alias: `edgeFunctionToken`)
3. **InsForge exposes claims** through `auth.jwt()` in SQL
4. **RLS policies** use a `requesting_user_id()` function to enforce row-level security

### Payment facilitators (x402)
1. **Server returns `402 Payment Required`** with a JSON challenge base64-encoded in `PAYMENT-REQUIRED` header
2. **Client signs an EIP-3009 authorization** using the stablecoin's EIP-712 domain
3. **Server forwards the signed payload** to the facilitator's `/verify` + `/settle` endpoints
4. **Server records the settled payment** in an InsForge table with a realtime trigger for live dashboards

## Choosing a Provider

**Auth**
- **Clerk** — Simplest setup; JWT Template handles signing, no server code needed
- **Auth0** — Flexible; uses post-login Actions for claim injection
- **WorkOS** — Enterprise-focused; AuthKit middleware + server-side JWT signing
- **Kinde** — Developer-friendly; built-in token customization
- **Stytch** — API-first; session-based token flow
- **Better Auth** — Self-hosted in your Postgres; no SaaS vendor; you own the user table. Pairs cleanly with InsForge's Postgres via a connection string + a small bridge route. Requires a one-time `REVOKE` after migrate to seal PostgREST exposure.

**Payment facilitators**
- **OKX x402** — Onchain pay-per-use via USDG on X Layer; zero gas for the payer

## Setup

1. Identify which provider the project uses
2. Read the corresponding reference guide from the tables above
3. Follow the provider-specific setup steps

## Usage Examples

Each provider guide includes full code examples for:
- Provider dashboard configuration (API keys, application settings, etc.)
- Server and client code (JWT utilities for auth; facilitator client + signing utilities for payments)
- Database setup (RLS for auth; payment table + realtime trigger for payments)
- Environment variable setup

Refer to the specific `references/<provider>.md` file for complete examples.

## Best Practices

**Auth**
- All auth provider user IDs are strings (not UUIDs) — always use `TEXT` columns for `user_id`
- Use `requesting_user_id()` instead of `auth.uid()` for RLS policies
- Pass the JWT via `accessToken` — a static string, not a function; for short-lived tokens (Clerk) sync refreshes with `client.setAccessToken(token, AuthChangeEvent.TOKEN_REFRESHED)` after the initial same-user sign-in
- Always get the JWT secret via `npx -y @insforge/cli secrets get JWT_SECRET`

**Payment facilitators (x402)**
- Always check the result of the database `insert(...)` after settlement — settlement takes money onchain before the insert runs; a silent DB failure loses the record
- Add `UNIQUE` to the `tx_hash` column to prevent duplicate records from retries
- Verify EIP-712 domain (`name`, `version`) against the token contract's on-chain `DOMAIN_SEPARATOR` — wrong values produce `Invalid Authority` errors
- Use a `MOCK_OKX_FACILITATOR` env flag for local dev so the full flow can be exercised without real funds

## Common Mistakes

**Auth**

| Mistake | Solution |
|---------|----------|
| Using `auth.uid()` for RLS | Use `requesting_user_id()` — third-party IDs are strings, not UUIDs |
| Using UUID columns for `user_id` | Use `TEXT` — all supported providers use string-format IDs |
| Hardcoding the JWT secret | Always retrieve via `npx -y @insforge/cli secrets get JWT_SECRET` |
| Missing `requesting_user_id()` function | Must be created before RLS policies will work |

**Payments (x402)**

| Mistake | Solution |
|---------|----------|
| Using an OKX exchange trading API key | Create a separate Web3 API key at `web3.okx.com/onchainos/dev-portal` |
| Wrong EIP-712 domain values | Read the token contract's `DOMAIN_SEPARATOR` — for USDG on X Layer use `name: "Global Dollar"`, `version: "1"` |
| Ignoring DB insert error after settlement | Always destructure `{ error }` and log/handle it — money has already moved |
| `MOCK_OKX_FACILITATOR=true` in production | Mock mode is demo-only; it returns fake tx hashes and bypasses verification |

© InsForge · Apache-2.0 · InsForge/insforge-skills

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor