From grammarly-pack
Implements observability for Grammarly API: metrics for calls/latencies/errors, structured logging, and error rate alerting in TypeScript.
npx claudepluginhub jeremylongshore/claude-code-plugins-plus-skills --plugin grammarly-packThis skill is limited to using the following tools:
```typescript
Executes Grammarly API outage triage: curl health checks, severity classification, TypeScript fallback implementation.
Instruments Gamma API clients in TypeScript to track requests, errors, latency, credits, and success rates for observability with Prometheus/Grafana or similar.
Instruments Claude API calls with Python structured logging and Prometheus metrics to track latency, cost, errors, token usage, and rate limits.
Share bugs, ideas, or general feedback.
class GrammarlyMetrics {
private calls = { score: 0, ai: 0, plagiarism: 0 };
private errors = 0;
private latencies: number[] = [];
recordCall(api: 'score' | 'ai' | 'plagiarism', latencyMs: number) {
this.calls[api]++;
this.latencies.push(latencyMs);
}
recordError() { this.errors++; }
report() {
const sorted = [...this.latencies].sort((a, b) => a - b);
return {
totalCalls: Object.values(this.calls).reduce((a, b) => a + b, 0),
callsByAPI: this.calls,
errors: this.errors,
p50: sorted[Math.floor(sorted.length * 0.5)] || 0,
p95: sorted[Math.floor(sorted.length * 0.95)] || 0,
};
}
}
function logGrammarlyCall(api: string, duration: number, status: number, textLength: number) {
console.log(JSON.stringify({
service: 'grammarly',
api,
duration_ms: duration,
status,
text_length: textLength,
timestamp: new Date().toISOString(),
}));
}
// Alert on error rate > 10%
const errorRate = metrics.errors / (metrics.totalCalls || 1);
if (errorRate > 0.1) {
console.error(`ALERT: Grammarly error rate ${(errorRate * 100).toFixed(1)}%`);
}