Automated summary
This skill guides performance tuning of Juicebox API integrations using Redis caching, request batching, and connection pooling.
Strengths
- Provides concrete TypeScript examples for a Redis cache with TTL and invalidation.
- Includes a configurable batch processor with max size and max wait to reduce API calls.
- Organizes the work into cache, batching, and connection pooling steps.
- States the need for a working integration, monitoring, and baseline metrics before tuning.
Limitations
- The supplied content cuts off midway through the connection pooling example, so that step is incomplete.
- Assumes a TypeScript/Node.js stack with Redis and the Juicebox SDK, with no guidance for other languages.
- Does not cover measuring results, business-specific invalidation rules, or cache failure handling in depth.
Use it when an existing Juicebox integration has baseline measurements and needs lower latency or reduced API load.
Avoid it before the Juicebox integration works, or when you need optimizations that do not rely on Redis and the Node.js SDK.
Security analysis
CautionThe skill provides performance-tuning code examples and does not contain destructive, exfiltration, obfuscated, or safety-disabling instructions. The only notable risk is the broad declared Bash access via curl and gh, which is network-capable even though it is not exercised in the instructions.
- •Declared Bash(curl:*) permission is broader than what the skill actually demonstrates (no curl/network commands appear in the instructions), granting unnecessary execution capability.
- •Code reads credentials from environment variables (process.env.JUICEBOX_API_KEY, REDIS_URL), which is the correct pattern; no secret handling is exposed.
- •Declared allowed tools include Bash(curl:*) and Bash(gh:*), which permit network and GitHub CLI access; the skill content does not use these tools, but they are powerful capabilities.
Examples
Add Redis caching to our Juicebox people search endpoint with a 5-minute TTL and measure the latency improvement.Implement request batching for Juicebox profile enrichment with a maximum batch size of 50 and a 100 ms max wait.Help me tune Juicebox API latency; our integration works and we already have monitoring and baseline metrics.name: juicebox-performance-tuning description: | Optimize Juicebox API performance. Use when improving response times, reducing latency, or optimizing Juicebox integration throughput. Trigger with phrases like "juicebox performance", "optimize juicebox", "juicebox speed", "juicebox latency". allowed-tools: Read, Write, Edit, Bash(gh:), Bash(curl:) version: 1.0.0 license: MIT author: Jeremy Longshore jeremy@intentsolutions.io
Juicebox Performance Tuning
Overview
Optimize Juicebox API integration for maximum performance and minimal latency.
Prerequisites
- Working Juicebox integration
- Performance monitoring in place
- Baseline metrics established
Instructions
Step 1: Implement Response Caching
// lib/juicebox-cache.ts
import { Redis } from 'ioredis';
const redis = new Redis(process.env.REDIS_URL);
interface CacheOptions {
ttl: number; // seconds
prefix?: string;
}
export class JuiceboxCache {
constructor(private options: CacheOptions = { ttl: 300 }) {}
private getKey(type: string, params: any): string {
const hash = crypto
.createHash('md5')
.update(JSON.stringify(params))
.digest('hex');
return `${this.options.prefix || 'jb'}:${type}:${hash}`;
}
async get<T>(type: string, params: any): Promise<T | null> {
const key = this.getKey(type, params);
const cached = await redis.get(key);
return cached ? JSON.parse(cached) : null;
}
async set<T>(type: string, params: any, data: T): Promise<void> {
const key = this.getKey(type, params);
await redis.setex(key, this.options.ttl, JSON.stringify(data));
}
async invalidate(type: string, params: any): Promise<void> {
const key = this.getKey(type, params);
await redis.del(key);
}
}
// Usage
const cache = new JuiceboxCache({ ttl: 300 });
async function searchWithCache(query: string, options: SearchOptions) {
const cached = await cache.get('search', { query, ...options });
if (cached) return cached;
const results = await client.search.people({ query, ...options });
await cache.set('search', { query, ...options }, results);
return results;
}
Step 2: Optimize Request Batching
// lib/batch-processor.ts
export class BatchProcessor<T, R> {
private queue: Array<{
item: T;
resolve: (result: R) => void;
reject: (error: Error) => void;
}> = [];
private timeout: NodeJS.Timeout | null = null;
constructor(
private processBatch: (items: T[]) => Promise<R[]>,
private options: { maxSize: number; maxWait: number }
) {}
async add(item: T): Promise<R> {
return new Promise((resolve, reject) => {
this.queue.push({ item, resolve, reject });
if (this.queue.length >= this.options.maxSize) {
this.flush();
} else if (!this.timeout) {
this.timeout = setTimeout(() => this.flush(), this.options.maxWait);
}
});
}
private async flush(): Promise<void> {
if (this.timeout) {
clearTimeout(this.timeout);
this.timeout = null;
}
if (this.queue.length === 0) return;
const batch = this.queue.splice(0, this.options.maxSize);
const items = batch.map(b => b.item);
try {
const results = await this.processBatch(items);
batch.forEach((b, i) => b.resolve(results[i]));
} catch (error) {
batch.forEach(b => b.reject(error as Error));
}
}
}
// Usage for profile enrichment
const enrichmentBatcher = new BatchProcessor<string, Profile>(
async (profileIds) => {
return client.profiles.batchGet(profileIds);
},
{ maxSize: 50, maxWait: 100 }
);
// Automatic batching
const profile = await enrichmentBatcher.add(profileId);
Step 3: Connection Pooling
// lib/connection-pool.ts
import { JuiceboxClient } from '@juicebox/sdk';
class ClientPool {
private clients: JuiceboxClient[] = [];
private currentIndex = 0;
constructor(size: number, apiKey: string) {
for (let i = 0; i < size; i++) {
this.clients.push(new JuiceboxClient({
apiKey,
keepAlive: true,
timeout: 30000
}));
}
}
getClient(): JuiceboxClient {
const client = this.clients[this.currentIndex];
this.currentIndex = (this.currentIndex + 1) % this.clients.length;
return client;
}
}
const pool = new ClientPool(5, process.env.JUICEBOX_API_KEY!);
Step 4: Query Optimization
// lib/query-optimizer.ts
export function optimizeSearchQuery(params: SearchParams): SearchParams {
return {
...params,
// Only request needed fields
fields: params.fields || ['id', 'name', 'title', 'company'],
// Use reasonable page size
limit: Math.min(params.limit || 20, 100),
// Disable expensive features if not needed
includeScores: params.includeScores ?? false,
includeHighlights: params.includeHighlights ?? false
};
}
// Pagination optimization
async function* streamResults(query: string) {
let cursor: string | undefined;
do {
const results = await client.search.people({
query,
limit: 100,
cursor,
fields: ['id', 'name', 'title'] // Minimal fields for listing
});
for (const profile of results.profiles) {
yield profile;
}
cursor = results.nextCursor;
} while (cursor);
}
Step 5: Monitor Performance
// lib/performance-monitor.ts
import { metrics } from './metrics';
export function wrapWithMetrics<T extends (...args: any[]) => Promise<any>>(
name: string,
fn: T
): T {
return (async (...args: Parameters<T>) => {
const start = Date.now();
try {
const result = await fn(...args);
metrics.histogram(`juicebox.${name}.duration`, Date.now() - start);
metrics.increment(`juicebox.${name}.success`);
return result;
} catch (error) {
metrics.increment(`juicebox.${name}.error`);
throw error;
}
}) as T;
}
// Dashboard query
const performanceQuery = `
SELECT
date_trunc('hour', timestamp) as hour,
avg(duration_ms) as avg_latency,
percentile_cont(0.95) within group (order by duration_ms) as p95,
count(*) as requests
FROM juicebox_metrics
WHERE timestamp > now() - interval '24 hours'
GROUP BY 1
ORDER BY 1
`;
Performance Benchmarks
| Operation | Target | Optimization | |-----------|--------|--------------| | Search (cold) | < 500ms | Query optimization | | Search (cached) | < 50ms | Redis cache | | Profile fetch | < 200ms | Batch requests | | Bulk enrichment | < 2s/100 | Connection pool |
Output
- Response caching layer
- Request batching system
- Connection pool
- Performance monitoring
Resources
Next Steps
After performance tuning, see juicebox-cost-tuning for cost optimization.
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 filesThis 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.mdFrom the root of a test project, save the file as .skill-downloads/juicebox-performance-tuning-mmh8qqrx/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/juicebox-performance-tuning-mmh8qqrx' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/juicebox-performance-tuning-mmh8qqrx/download' --output '.skill-downloads/juicebox-performance-tuning-mmh8qqrx/SKILL.md.part' && mv '.skill-downloads/juicebox-performance-tuning-mmh8qqrx/SKILL.md.part' '.skill-downloads/juicebox-performance-tuning-mmh8qqrx/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.
Tools declared by the author (check availability in your agent): Read, Write, Edit, Bash(gh:*), Bash(curl:*)
Original excerpt: Prerequisites
- Working Juicebox integration
- Performance monitoring in place
- Baseline metrics established
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/juicebox-performance-tuning-mmh8qqrx/SKILL.md' && test -s '.skill-downloads/juicebox-performance-tuning-mmh8qqrx/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/juicebox-performance-tuning' && cp -R '.skill-downloads/juicebox-performance-tuning-mmh8qqrx' '.claude/skills/juicebox-performance-tuning'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 installationopenskills install './.skill-downloads/juicebox-performance-tuning-mmh8qqrx'openskills read 'juicebox-performance-tuning-mmh8qqrx'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 syncManual 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/juicebox-performance-tuning-mmh8qqrx/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.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.