From hex-pack
Optimizes Hex API performance using caching, parallel runs, adaptive polling, and batching for faster project lists, executions, and status polling in data analytics integrations.
npx claudepluginhub jeremylongshore/claude-code-plugins-plus-skills --plugin hex-packThis skill is limited to using the following tools:
| Operation | Typical Duration |
Triggers and polls Hex project runs via API using TypeScript, with helpers for parameters, timeouts, errors, and multi-step data pipelines. For external orchestration like Airflow or cron.
Scales Hamilton workflows with async I/O for API/DB operations, Spark/Ray/Dask for distributed compute, caching, and multithreading for performance optimization.
Optimizes Linear API usage: audit requests/complexity, replace polling with webhooks, minimize query complexity to respect rate limits.
Share bugs, ideas, or general feedback.
| Operation | Typical Duration |
|---|---|
| ListProjects | 200-500ms |
| RunProject (trigger) | 500ms-2s |
| Project execution | 10s-30min (depends on queries) |
| GetRunStatus (poll) | 100-300ms |
import { LRUCache } from 'lru-cache';
const projectCache = new LRUCache<string, any>({ max: 50, ttl: 300000 }); // 5 min
async function getCachedProjects(client: HexClient) {
const cached = projectCache.get('projects');
if (cached) return cached;
const projects = await client.listProjects();
projectCache.set('projects', projects);
return projects;
}
// Run independent projects in parallel (respecting rate limits)
async function parallelRuns(client: HexClient, configs: Array<{ id: string; params: any }>) {
return Promise.allSettled(
configs.map(c => runWithRetry(client, c.id, c.params))
);
}
// Adaptive polling: start fast, slow down
async function adaptivePoll(client: HexClient, projectId: string, runId: string) {
let interval = 2000; // Start at 2s
while (true) {
const status = await client.getRunStatus(projectId, runId);
if (['COMPLETED', 'ERRORED', 'KILLED'].includes(status.status)) return status;
await new Promise(r => setTimeout(r, interval));
interval = Math.min(interval * 1.5, 30000); // Max 30s
}
}