Hex Local Dev Loop

VerifiedSafe

Set up a development workflow for Hex API orchestration with mocked responses and testing.

Sby Skills Guide Bot
DevelopmentIntermediate
7/27/2026
Claude Code
#hex#typescript#local-dev#api-mocking#vitest

Recommended for

Automated summary

Sets up a local development environment for orchestrating the Hex API, with a typed TypeScript client and tests driven by mocked API responses.

Strengths

  • Provides a ready-made project layout (client, orchestrator, types, fixtures, .env.local)
  • Ships a complete Hex client covering listProjects, runProject, getRunStatus and cancelRun
  • Demonstrates a clear testing approach with Vitest and a global fetch stub to avoid real network calls
  • Gives concrete, copy-pasteable instructions rather than abstract concepts

Limitations

  • The client is minimal: generic error handling, no retries, pagination or rate limiting
  • The test examples are short and do not cover failure or cancellation paths
  • Assumes prior familiarity with TypeScript, Vitest and how the Hex API behaves
When to use it

Use it when bootstrapping a local Hex orchestration project and you want a fast iteration loop backed by mocked tests.

When not to use it

Avoid it if you need production-grade patterns (retries, advanced error handling) or if your stack is not TypeScript with Vitest.

Security analysis

Safe
Quality score80/100

This is a documentation/instruction skill that scaffolds a local dev loop for the Hex analytics API. It contains only illustrative TypeScript code using fetch against the legitimate app.hex.tech endpoint, passing a token supplied as a constructor argument (no embedded secrets). Bash access is narrowly scoped to npm/pnpm tooling and there are no destructive commands, no curl|sh, no base64 payloads, no credential exfiltration, and no attempts to disable safety. Risk is limited to normal package-manager execution.

No concerns found

How this analysis is made

Examples

Scaffold local Hex dev project
Set up a local Hex development environment: create the hex-orchestrator project structure with src/hex/client.ts, orchestrator.ts, types.ts, a .env.local and package.json.
Mocked Vitest tests for Hex client
Write Vitest tests for my HexClient that mock fetch responses for listProjects and runProject so no real API calls are made.
Add run status and cancel support
Extend my local Hex client with getRunStatus and cancelRun methods and add mocked tests for both.

name: hex-local-dev-loop description: 'Configure Hex local development with hot reload and testing.

Use when setting up a development environment, configuring test workflows,

or establishing a fast iteration cycle with Hex.

Trigger with phrases like "hex dev setup", "hex local development",

"hex dev environment", "develop with hex".

' allowed-tools: Read, Write, Edit, Bash(npm:), Bash(pnpm:), Grep version: 1.6.0 license: MIT author: Jeremy Longshore jeremy@intentsolutions.io tags:

  • saas
  • hex
  • data
  • analytics compatibility: Designed for Claude Code

Hex Local Dev Loop

Overview

Set up a development workflow for Hex API orchestration with mocked API responses and testing.

Instructions

Step 1: Project Structure

hex-orchestrator/
├── src/hex/
│   ├── client.ts       # API client
│   ├── orchestrator.ts # Pipeline runner
│   └── types.ts        # TypeScript interfaces
├── tests/
│   ├── fixtures/       # Mock API responses
│   └── orchestrator.test.ts
├── .env.local
└── package.json

Step 2: Typed Hex Client

// src/hex/client.ts
export class HexClient {
  constructor(private token: string, private baseUrl = 'https://app.hex.tech/api/v1') {}

  async listProjects() {
    return this.get('/projects');
  }

  async runProject(projectId: string, inputParams?: Record<string, any>) {
    return this.post(`/project/${projectId}/run`, { inputParams: inputParams || {}, updateCacheResult: true });
  }

  async getRunStatus(projectId: string, runId: string) {
    return this.get(`/project/${projectId}/run/${runId}`);
  }

  async cancelRun(projectId: string, runId: string) {
    return this.delete(`/project/${projectId}/run/${runId}`);
  }

  private async get(path: string) {
    const res = await fetch(`${this.baseUrl}${path}`, { headers: { 'Authorization': `Bearer ${this.token}` } });
    if (!res.ok) throw new Error(`Hex API ${res.status}`);
    return res.json();
  }

  private async post(path: string, body: any) {
    const res = await fetch(`${this.baseUrl}${path}`, { method: 'POST', headers: { 'Authorization': `Bearer ${this.token}`, 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
    if (!res.ok) throw new Error(`Hex API ${res.status}`);
    return res.json();
  }

  private async delete(path: string) {
    const res = await fetch(`${this.baseUrl}${path}`, { method: 'DELETE', headers: { 'Authorization': `Bearer ${this.token}` } });
    return res.ok;
  }
}

Step 3: Mocked Tests

import { describe, it, expect, vi } from 'vitest';
const mockFetch = vi.fn();
vi.stubGlobal('fetch', mockFetch);

describe('HexClient', () => {
  it('should list projects', async () => {
    mockFetch.mockResolvedValueOnce({ ok: true, json: async () => [{ projectId: 'p1', name: 'Test' }] });
    const client = new HexClient('test-token');
    const projects = await client.listProjects();
    expect(projects).toHaveLength(1);
  });

  it('should trigger a run', async () => {
    mockFetch.mockResolvedValueOnce({ ok: true, json: async () => ({ runId: 'r1', projectId: 'p1' }) });
    const client = new HexClient('test-token');
    const run = await client.runProject('p1', { date: '2025-01-01' });
    expect(run.runId).toBe('r1');
  });
});

Resources

Next Steps

See hex-sdk-patterns for production patterns.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/hex-local-dev-loop-ms2s7css/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/hex-local-dev-loop-ms2s7css' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/hex-local-dev-loop-ms2s7css/download' --output '.skill-downloads/hex-local-dev-loop-ms2s7css/SKILL.md.part' && mv '.skill-downloads/hex-local-dev-loop-ms2s7css/SKILL.md.part' '.skill-downloads/hex-local-dev-loop-ms2s7css/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Environment declared by the author: Designed for Claude Code

Tools declared by the author (check availability in your agent): Read, Write, Edit, Bash(npm:*), Bash(pnpm:*), Grep

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/hex-local-dev-loop-ms2s7css/SKILL.md' && test -s '.skill-downloads/hex-local-dev-loop-ms2s7css/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/hex-local-dev-loop' && cp -R '.skill-downloads/hex-local-dev-loop-ms2s7css' '.claude/skills/hex-local-dev-loop'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/hex-local-dev-loop-ms2s7css'

openskills read 'hex-local-dev-loop-ms2s7css'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/hex-local-dev-loop-ms2s7css/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills