From mateonunez-skills
Adds error telemetry, request tracing, structured logging, and queue visibility to production code. Use when implementing error handlers, queue processors, async jobs, or external system boundaries.
npx claudepluginhub mateonunez/skillsThis skill uses the workspace's default tool permissions.
> "If you can't see what's failing, you can't fix it."
Guides Next.js Cache Components and Partial Prerendering (PPR): 'use cache' directives, cacheLife(), cacheTag(), revalidateTag() for caching, invalidation, static/dynamic optimization. Auto-activates on cacheComponents: true.
Processes PDFs: extracts text/tables/images, merges/splits/rotates pages, adds watermarks, creates/fills forms, encrypts/decrypts, OCRs scans. Activates on PDF mentions or output requests.
Share bugs, ideas, or general feedback.
"If you can't see what's failing, you can't fix it."
Code fails in production in ways it never fails in your editor. Silent failures are worse than loud failures. Every error, retry, and state transition should leave a trace.
Error context — when an error happens, log the context that led to it:
// ✗ Silent failure
const result = await fetchUser(userId);
if (!result.ok) return null; // Where? Why? What ID?
// ✓ With context
const result = await fetchUser(userId);
if (!result.ok) {
logger.error('fetch-user-failed', {
userId,
error: result.error.code,
attempt: retryCount,
elapsed: Date.now() - startTime,
});
return null;
}
Request tracing — every log entry tied to the request that caused it:
// Fastify plugin: attach traceId to every log
app.addHook('onRequest', (request, reply, done) => {
request.traceId = crypto.randomUUID();
done();
});
// Later, in your logger:
logger.info('action', { traceId: request.traceId, ...data });
Later in a dashboard, you can follow one request through 10 different services.
Queue visibility — jobs that have retried 3x should alarm. Jobs stuck for 24h should alarm. Use BullMQ (or equivalent) metrics:
// Expose these to your monitoring system:
const queue = new Queue('order-processing');
// These should feed dashboards:
queue.count(); // Total pending
queue.getDelayedCount(); // Retrying
queue.getFailedCount(); // Dead-lettered
queue.getActiveCount(); // Currently processing
Log as structured JSON, not prose. Grepability matters less than machine parsing:
// ✗ Prose (hard to alert on)
logger.error(`Failed to process order ${orderId}: ${error}`);
// ✓ Structured
logger.error('order-process-failed', {
orderId,
errorCode: error.code,
errorMessage: error.message,
retryCount,
elapsed,
service: 'order-processor',
});
Do NOT log every line of business logic. Do NOT log for debugging during dev — that's what the debugger is for.
The ait reference implementation uses:
error.code to correlate failure modes