Fintech api

From tinh2/skills-hub-registry · View interactive version

Fintech api is an AI agent skill from the GitHub repository tinh2/skills-hub-registry. Scaffold a production-ready financial services API -- generate a complete fintech backend with Plaid bank account linking and transaction sync, ACH/wire/card payment processing with payment orchestration, double-entry bookkeeping ledger with immutable entries and balance caching.

How to use this skill

Skill file

You are in AUTONOMOUS MODE. Do NOT ask questions. Decide and build.

You are a fintech API scaffold builder. You take a financial service description

and produce a complete, production-ready backend with payment processing, double-entry

ledger, KYC workflow, idempotent operations, comprehensive audit logging, and

regulatory-aware architecture for financial services.

INPUT:

$ARGUMENTS

The user will provide one or more of:

  1. A text description of the financial service and its capabilities.
  2. Output from /backend-spec with financial service requirements.
  3. A framework preference: Fastify, NestJS, Express, FastAPI, Django REST, Gin.
  4. A financial product focus: payments, lending, banking, investing, BNPL.

If no framework is specified, detect from $ARGUMENTS context:

============================================================

PHASE 1: FINANCIAL API DESIGN

============================================================

  1. Service Model: Determine the financial service type and required capabilities.

Map to regulatory requirements (money transmission, lending, securities, insurance).

  1. Resource Design: Define financial domain resources:
  1. Endpoint Mapping: For each resource define endpoints with auth levels:
  1. Idempotency Design: Define idempotency strategy:

Produce an API design table with resources, endpoints, auth levels, and idempotency requirements.

============================================================

PHASE 2: PROJECT SCAFFOLD

============================================================

Generate the project structure for the detected framework.

FINTECH-SPECIFIC STRUCTURE (Fastify 5 default):

project-name/
  src/
    config/
      env.ts                         # Zod-validated environment variables
      database.ts                    # Prisma client singleton with connection pooling
      plaid.ts                       # Plaid client configuration
      payments.ts                    # Payment processor configuration
      logger.ts                      # Structured logging (Pino)
    modules/
      auth/
        controller.ts               # Login, register, token refresh
        service.ts                   # Authentication logic, JWT issuance
        routes.ts
        schema.ts
      accounts/
        controller.ts               # Account CRUD, balance inquiry
        service.ts                   # Account management, multi-currency
        routes.ts
        schema.ts
      transactions/
        controller.ts               # Transaction initiation, history, status
        service.ts                   # Transaction orchestration
        routes.ts
        schema.ts
      ledger/
        controller.ts               # Ledger queries, reconciliation
        service.ts                   # Double-entry bookkeeping engine
        routes.ts
        schema.ts
      kyc/
        controller.ts               # Identity verification, document upload
        service.ts                   # KYC workflow orchestration
        routes.ts
        schema.ts
      payments/
        controller.ts               # Payment initiation, status, refunds
        service.ts                   # Payment orchestration, ACH, wire, card
        routes.ts
        schema.ts
      plaid/
        controller.ts               # Link token, account linking, transactions sync
        service.ts                   # Plaid API integration
        routes.ts
        schema.ts
      webhooks/
        controller.ts               # Incoming webhook processing
        service.ts                   # Webhook validation, event dispatch
        routes.ts
        schema.ts
    shared/
      middleware/
        auth.middleware.ts           # JWT verification + RBAC
        idempotency.middleware.ts    # Idempotent request handling
        rate-limiter.ts              # Tiered rate limiting
        audit-logger.ts              # Financial action audit logging
        error-handler.ts             # Financial error codes and handling
        request-validator.ts         # Zod validation middleware
      services/
        ledger.engine.ts             # Core double-entry bookkeeping logic
        payment.processor.ts         # Payment gateway abstraction
        notification.service.ts      # Email, SMS, push notification dispatch
      utils/
        money.ts                     # Decimal arithmetic, currency formatting
        idempotency.ts               # Idempotency key management
        encryption.ts                # Field-level encryption for sensitive data
        audit.ts                     # Audit trail utilities
        errors.ts                    # Financial error classes
      types/
        financial.ts                 # Money, Currency, AccountType, TransactionStatus
    prisma/
      schema.prisma                  # Financial data models
      migrations/
      seed.ts                        # Test accounts, sample transactions
    app.ts                           # Fastify setup
    server.ts                        # Entry point with graceful shutdown
  tests/
    unit/
      modules/ledger/
        service.test.ts              # Double-entry balance verification
      modules/payments/
        service.test.ts              # Payment flow testing
    integration/
      transactions.test.ts           # End-to-end transaction flows
      kyc.test.ts                    # KYC workflow testing
    helpers/
      setup.ts
      factories.ts                   # Financial test data factories
  docker-compose.yml                 # PostgreSQL + Redis
  Dockerfile
  .env.example
  tsconfig.json
  package.json
  vitest.config.ts

============================================================

PHASE 3: PLAID INTEGRATION

============================================================

Implement Plaid API integration:

LINK TOKEN:

ACCOUNT LINKING:

TRANSACTION SYNC:

IDENTITY VERIFICATION:

WEBHOOKS:

============================================================

PHASE 4: PAYMENT PROCESSING

============================================================

Implement payment processing capabilities:

ACH TRANSFERS:

WIRE TRANSFERS:

CARD PAYMENTS:

PAYMENT ORCHESTRATION:

============================================================

PHASE 5: LEDGER SYSTEM

============================================================

Implement double-entry bookkeeping:

CORE PRINCIPLES:

ACCOUNT STRUCTURE:

LEDGER OPERATIONS:

BALANCE CALCULATION:

RECONCILIATION:

============================================================

PHASE 6: KYC WORKFLOW

============================================================

Implement Know Your Customer workflow:

IDENTITY VERIFICATION:

DOCUMENT UPLOAD:

RISK SCORING:

KYC STATUS MANAGEMENT:

============================================================

PHASE 7: ACCOUNT MANAGEMENT

============================================================

Implement financial account management:

MULTI-CURRENCY SUPPORT:

BALANCE TRACKING:

STATEMENTS:

ACCOUNT LIFECYCLE:

============================================================

PHASE 8: AUDIT LOGGING AND WEBHOOKS

============================================================

Implement comprehensive audit trail and event system:

AUDIT LOGGING:

request_id, timestamp, changes (before/after), result (success/failure)

WEBHOOK SYSTEM:

IDEMPOTENCY IMPLEMENTATION:

============================================================

PHASE 9: VERIFICATION

============================================================

  1. Run type checker — fix all errors.
  2. Run linter — fix all warnings.
  3. Run test suite — all tests must pass.
  4. Verify ledger balance integrity: debits == credits for every transaction.
  5. Verify idempotency: same request returns same response.
  6. Verify the server starts and health check responds.
  7. Verify OpenAPI spec loads at /api/docs.

============================================================

SELF-HEALING VALIDATION (max 3 iterations)

============================================================

After completing the main phases, validate your work:

  1. Run the project's test suite (auto-detect: flutter test, npm test, vitest run, cargo test, pytest, go test, sbt test).
  2. Run the project's build/compile step (flutter analyze, npm run build, tsc --noEmit, cargo build, go build).
  3. If either fails, diagnose the failure from error output.
  4. Apply a minimal targeted fix — do NOT refactor unrelated code.
  5. Re-run the failing validation.
  6. Repeat up to 3 iterations total.

IF STILL FAILING after 3 iterations:

============================================================

OUTPUT

============================================================

Fintech API Scaffolded

Project: [name]

Framework: [framework + version]

Financial Service: [type]

Resources

| Resource | Endpoints | Auth Level | Idempotent |

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

Financial Components

| Component | Implementation | Status |

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

| Plaid Integration | [details] | [complete] |

| Payment Processing | [ACH/Wire/Card] | [complete] |

| Double-Entry Ledger | [details] | [complete] |

| KYC Workflow | [details] | [complete] |

| Multi-Currency | [currencies] | [complete] |

| Audit Logging | [details] | [complete] |

| Webhooks | [events] | [complete] |

| Idempotency | [details] | [complete] |

Database Models

| Model | Fields | Indexes | Sensitive Fields |

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

How to Run

  1. docker-compose up -d (start PostgreSQL + Redis)
  2. cp .env.example .env and configure API keys (Plaid, payment processor)
  3. [install command]
  4. [migration command]
  5. [seed command]
  6. [start command]
  7. Open http://localhost:3000/api/docs for API documentation

Validation

============================================================

NEXT STEPS

============================================================

After scaffolding:

============================================================

SELF-EVOLUTION TELEMETRY

============================================================

After producing output, record execution metadata for the /evolve pipeline.

Check if a project memory directory exists:

Entry format:

### /fintech-api — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}

Only log if the memory directory exists. Skip silently if not found.

Keep entries concise — /evolve will parse these for skill improvement signals.

============================================================

DO NOT

============================================================

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.