Skip to content
Skillv1.0.0

hex-sdk-patterns

Apply production-ready Hex SDK patterns for TypeScript and Python. Use when implementing Hex integrations, refactoring SDK usage, or establishing team coding standards for Hex. Trigger with phrases li

by jeremylongshore(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from jeremylongshore/tons-of-skills-marketplace (skills/.curated/hex-sdk-patterns/SKILL.md). Install upstream with npx skills add jeremylongshore/tons-of-skills-marketplace --skill hex-sdk-patterns. Copyright stays with the author (MIT).

Hex SDK Patterns

Overview

Production patterns for Hex API: typed client, pipeline orchestration, retry logic, and Python integration.

Instructions

Step 1: Run with Retry

async function runWithRetry(client: HexClient, projectId: string, params: Record<string, any>, maxRetries = 2) {
  for (let i = 0; i <= maxRetries; i++) {
    try {
      const { runId } = await client.runProject(projectId, params);
      const result = await pollUntilComplete(client, projectId, runId);
      return result;
    } catch (err: any) {
      if (i === maxRetries || !err.message.includes('429')) throw err;
      await new Promise(r => setTimeout(r, 30000)); // Wait 30s on rate limit
    }
  }
}

Step 2: Python Client (hextoolkit)

# pip install hextoolkit
from hextoolkit import HexAPI

hex_api = HexAPI(token=os.environ['HEX_API_TOKEN'])

# List projects
projects = hex_api.list_projects()

# Run project
run = hex_api.run_project('project-id', input_params={'date': '2025-01-01'})

# Poll for completion
status = hex_api.get_run_status('project-id', run['runId'])

Step 3: Airflow Integration

# Using the hex-inc/airflow-provider-hex package
from airflow_provider_hex.operators.hex import HexRunProjectOperator

run_task = HexRunProjectOperator(
    task_id='run_hex_project',
    project_id='your-project-id',
    input_params={'date': '{{ ds }}'},
    hex_conn_id='hex_default',
    wait_for_completion=True,
    timeout=600,
)

Prerequisites

  • A typed client boundary, secret-manager reference, environment allowlist, and a sandbox project using fictional or approved non-sensitive data.
  • An explicit execution budget, idempotency/correlation convention, and policy that unknown project scope or response shape fails closed.

Output

Produce an SDK receipt with client revision, environment, opaque project/run IDs, parameter schema revision, execution state, aggregate result checks, and rollback/cancel reference. Do not include API tokens, SQL, cell output, or workspace data.

Error Handling

Classify authentication, authorization, validation, quota, timeout, and terminal-run failures separately. Do not retry a write-like project run without idempotency, broaden scope to bypass a denial, or log notebook output for diagnosis.

Examples

sdk=v3; env=sandbox; project=proj-opaque-11; params=r4; run=succeeded; row_count=within-range; cancel=not-needed is a safe SDK execution receipt.

Resources

Next Steps

Apply patterns in hex-core-workflow-a.

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/jeremylongshore-tons-of-skills-marketplace-hex-sdk-patterns/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

jeremylongshore-tons-of-skills-marketplace-hex-sdk-patterns.ocm.jsonjson
{
  "ocm": "1",
  "id": "jeremylongshore-tons-of-skills-marketplace-hex-sdk-patterns",
  "kind": "skill",
  "name": "hex-sdk-patterns",
  "description": "Apply production-ready Hex SDK patterns for TypeScript and Python. Use when implementing Hex integrations, refactoring SDK usage, or establishing team coding standards for Hex. Trigger with phrases like \"hex SDK patterns\", \"hex best practices\", \"hex code patterns\", \"idiomatic hex\".",
  "publisher": "jeremylongshore",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "coding"
    ],
    "tags": [
      "skill-md",
      "saas",
      "hex",
      "data",
      "analytics",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Apply production-ready Hex SDK patterns for TypeScript and Python. Use when implementing Hex integrations, refactoring SDK usage, or establishing team coding standards for Hex. Trigger with phrases like \"hex SDK patterns\", \"hex best practices\", \"hex code patterns\", \"idiomatic hex\"."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/jeremylongshore/tons-of-skills-marketplace",
      "path": "skills/.curated/hex-sdk-patterns/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/jeremylongshore/tons-of-skills-marketplace/blob/HEAD/skills/.curated/hex-sdk-patterns/SKILL.md",
      "key": "jeremylongshore/tons-of-skills-marketplace/skills/.curated/hex-sdk-patterns/SKILL.md"
    },
    "compatibility": "Designed for Claude Code",
    "allowed_tools": [
      "Read,",
      "Write,",
      "Edit"
    ],
    "license": "MIT"
  },
  "instructions": "# Hex SDK Patterns\n\n## Overview\n\nProduction patterns for Hex API: typed client, pipeline orchestration, retry logic, and Python integration.\n\n## Instructions\n\n### Step 1: Run with Retry\n\n```typescript\nasync function runWithRetry(client: HexClient, projectId: string, params: Record<string, any>, maxRetries = 2) {\n  for (let i = 0; i <= maxRetries; i++) {\n    try {\n      const { runId } = await client.runProject(projectId, params);\n      const result = await pollUntilComplete(client, projectId, runId);\n      return result;\n    } catch (err: any) {\n      if (i === maxRetries || !err.message.inclu",
  "cost": {
    "context_tokens": 667
  }
}

Fetch it by URL: GET /api/v1/registry/jeremylongshore-tons-of-skills-marketplace-hex-sdk-patterns/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.