From hootsuite-pack
Optimizes Hootsuite API performance with LRUCache for profiles, PQueue batching for scheduling, and HTTPS agent pooling in TypeScript/Node.js.
npx claudepluginhub jeremylongshore/claude-code-plugins-plus-skills --plugin hootsuite-packThis skill is limited to using the following tools:
```typescript
Implements Hootsuite API rate limiting with Retry-After backoff, recursive retries, and PQueue queuing to handle 429 errors and optimize throughput.
Optimizes HubSpot CRM API performance using batch reads, minimal property requests, and caching to handle slow responses and high throughput.
Optimizes Klaviyo API performance using sparse fieldsets, LRU caching, batching, pagination, and rate limit handling for faster responses and higher throughput.
Share bugs, ideas, or general feedback.
import { LRUCache } from 'lru-cache';
const profileCache = new LRUCache<string, any>({ max: 100, ttl: 3600000 });
async function getCachedProfiles(): Promise<any[]> {
const cached = profileCache.get('profiles');
if (cached) return cached;
const response = await fetch('https://platform.hootsuite.com/v1/socialProfiles', {
headers: { 'Authorization': `Bearer ${await getStoredToken()}` },
});
const { data } = await response.json();
profileCache.set('profiles', data);
return data;
}
import PQueue from 'p-queue';
const scheduleQueue = new PQueue({ concurrency: 2, interval: 1000, intervalCap: 2 });
async function batchSchedule(posts: Array<{ text: string; profileId: string; time: Date }>) {
const results = await Promise.allSettled(
posts.map(post =>
scheduleQueue.add(() =>
fetch('https://platform.hootsuite.com/v1/messages', {
method: 'POST',
headers: { 'Authorization': `Bearer ${process.env.HOOTSUITE_ACCESS_TOKEN}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ text: post.text, socialProfileIds: [post.profileId], scheduledSendTime: post.time.toISOString() }),
}).then(r => r.json())
)
)
);
const succeeded = results.filter(r => r.status === 'fulfilled').length;
console.log(`Scheduled ${succeeded}/${posts.length} posts`);
}
import { Agent } from 'https';
const agent = new Agent({ keepAlive: true, maxSockets: 5 });
// Pass agent to fetch/axios for connection reuse to platform.hootsuite.com
For cost optimization, see hootsuite-cost-tuning.