/flexport-pack:flexport-cost-tuningfrom flexport-pack
Optimize Flexport API usage costs through efficient pagination, caching, webhook-driven updates, and monitoring API call volume.
Ships in flexport-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Reduce Flexport API costs by minimizing unnecessary calls. Key strategies: use webhooks instead of polling, cache aggressively, maximize page sizes, and batch operations.
// BAD: Polling every 5 minutes (288 API calls/day per shipment)
setInterval(async () => {
const shipment = await flexport(`/shipments/${id}`);
if (shipment.data.status !== lastStatus) updateDB(shipment);
}, 5 * 60 * 1000);
// GOOD: Webhook-driven (0 API calls — Flexport pushes updates)
app.post('/webhooks/flexport', (req, res) => {
const event = req.body;
if (event.type === 'shipment.milestone') {
updateDB(event.data); // Only processes real changes
}
res.sendStatus(200);
});
// Savings: 100 shipments * 288 calls/day = 28,800 calls/day eliminated
// BAD: Default pagination (per=25)
// 1000 shipments = 40 API calls
// GOOD: Max pagination (per=100)
// 1000 shipments = 10 API calls (75% reduction)
const shipments = await flexport('/shipments?per=100&page=1');
| Data Type | Change Frequency | Cache TTL | Impact |
|---|---|---|---|
| Products | Rarely | 1 hour | ~95% fewer calls |
| Shipment list | Every few hours | 5 minutes | ~90% fewer calls |
| Shipment detail | On milestones | Until webhook | ~99% fewer calls |
| Purchase orders | Daily | 15 minutes | ~85% fewer calls |
| Freight invoices | Monthly | 1 hour | ~95% fewer calls |
// Track API call volume per endpoint
const apiMetrics = new Map<string, { count: number; lastReset: Date }>();
function trackAPICall(endpoint: string) {
const key = endpoint.split('?')[0]; // Strip query params
const metric = apiMetrics.get(key) || { count: 0, lastReset: new Date() };
metric.count++;
apiMetrics.set(key, metric);
}
// Report daily usage
function reportUsage() {
console.log('=== Flexport API Usage ===');
for (const [endpoint, { count }] of apiMetrics) {
console.log(` ${endpoint}: ${count} calls`);
}
}
per=100 on all list endpointsFor architecture design, see flexport-reference-architecture.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
24 skills in this plugin
/flexport-ci-integrationConfigure CI/CD pipelines for Flexport logistics integrations with GitHub Actions,
automated API contract testing, and deployment workflows.
Trigger: "flexport CI", "flexport GitHub Actions", "flexport CI/CD pipeline".
/flexport-common-errorsDiagnose and fix common Flexport API errors including HTTP status codes,
webhook failures, and data validation issues.
Trigger: "flexport error", "fix flexport", "flexport not working", "debug flexport API".
/flexport-core-workflow-aExecute Flexport primary workflow: shipment booking and purchase order management.
Use when creating bookings, managing purchase orders, tracking freight,
or building the core shipment lifecycle integration.
Trigger: "flexport booking", "flexport purchase order", "create flexport shipment".
/flexport-core-workflow-bExecute Flexport secondary workflow: commercial invoices, products catalog, and freight invoices.
Use when managing commercial invoices for customs, maintaining product catalogs,
or handling freight billing through the Flexport API.
Trigger: "flexport invoice", "flexport products", "flexport customs documents".
/flexport-data-handlingImplement data handling for Flexport supply chain data including PII redaction,
shipment data retention, GDPR compliance, and secure document management.
Trigger: "flexport data handling", "flexport PII", "flexport GDPR", "flexport data retention".
/flexport-debug-bundleCollect Flexport API debug evidence for support tickets and troubleshooting.
Use when encountering persistent API issues, preparing support tickets,
or collecting diagnostic information for Flexport logistics problems.
Trigger: "flexport debug", "flexport support bundle", "flexport diagnostic".
npx claudepluginhub flight505/skill-forge --plugin flexport-packOther plugins' skills for the same job