Skip to content
Back to skills

Persona Sdk Patterns

ASecurity

'Production Persona API client wrapper with retry, pagination, typed

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
toolstypescriptapi

Works with

  • claude code
  • cli
  • api

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add pauldx/claudifying --skill persona-sdk-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Persona Sdk Patterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Persona Sdk Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/pauldx-persona-sdk-patterns/badge)](https://www.skillsdirectory.com/skills/pauldx-persona-sdk-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: persona-sdk-patterns
description: 'Production Persona API client wrapper with retry, pagination, typed
  responses.

  Use when working with Persona identity verification.

  Trigger with phrases like "persona sdk-patterns", "persona sdk-patterns".

  '
allowed-tools: Read, Write, Edit
version: 2.0.0
license: MIT
tags:
- saas
- persona
- identity
- kyc
- verification
compatibility: Designed for Claude Code, also compatible with Codex and OpenClaw
---
# persona sdk patterns | sed 's/\b\(.\)/\u\1/g'

## Overview
Singleton API client, typed verification results, pagination through inquiries, error classification.

## Prerequisites
- Completed `persona-install-auth` setup
- Valid Persona API key (sandbox or production)

## Instructions

### Step 1: Typed API Client Wrapper
```typescript
import axios, { AxiosInstance, AxiosError } from 'axios';

interface PersonaConfig {
  apiKey: string;
  version?: string;
  baseURL?: string;
}

class PersonaClient {
  private http: AxiosInstance;

  constructor(config: PersonaConfig) {
    this.http = axios.create({
      baseURL: config.baseURL || 'https://withpersona.com/api/v1',
      headers: {
        'Authorization': `Bearer ${config.apiKey}`,
        'Persona-Version': config.version || '2023-01-05',
        'Content-Type': 'application/json',
      },
    });
  }

  async createInquiry(templateId: string, referenceId: string, fields?: Record<string, any>) {
    const { data } = await this.http.post('/inquiries', {
      data: { attributes: { 'inquiry-template-id': templateId, 'reference-id': referenceId, fields } },
    });
    return data.data;
  }

  async getInquiry(inquiryId: string) {
    const { data } = await this.http.get(`/inquiries/${inquiryId}`);
    return data.data;
  }

  async listInquiries(params: { referenceId?: string; status?: string; pageSize?: number } = {}) {
    const { data } = await this.http.get('/inquiries', {
      params: {
        'filter[reference-id]': params.referenceId,
        'filter[status]': params.status,
        'page[size]': params.pageSize || 25,
      },
    });
    return data.data;
  }

  async getVerification(verificationId: string) {
    const { data } = await this.http.get(`/verifications/${verificationId}`);
    return data.data;
  }
}

// Singleton
let _client: PersonaClient | null = null;
export function getPersonaClient(): PersonaClient {
  if (!_client) {
    _client = new PersonaClient({ apiKey: process.env.PERSONA_API_KEY! });
  }
  return _client;
}
```

### Step 2: Error Classification
```typescript
function classifyPersonaError(error: AxiosError): { retryable: boolean; message: string } {
  const status = error.response?.status;
  if (status === 429) return { retryable: true, message: 'Rate limited' };
  if (status && status >= 500) return { retryable: true, message: 'Server error' };
  if (status === 401) return { retryable: false, message: 'Invalid API key' };
  if (status === 422) return { retryable: false, message: 'Invalid request' };
  return { retryable: false, message: error.message };
}
```

## Output
- Typed Persona API client with inquiry and verification methods
- Singleton pattern for reuse
- Error classification for retry decisions
- Paginated inquiry listing

## Error Handling
| Pattern | Use Case | Benefit |
|---------|----------|---------|
| Singleton | All API calls | One client, consistent headers |
| Error classifier | Retry decisions | Only retry 429/5xx |
| Typed responses | Data access | Autocomplete, type safety |

## Resources
- [Persona API Reference](https://docs.withpersona.com/reference/introduction)
- [API Introduction](https://docs.withpersona.com/api-introduction)

## Next Steps
Apply in `persona-core-workflow-a` for real KYC flows.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in tools →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.