Agent Skills: Grammarly Observability

|

UncategorizedID: jeremylongshore/claude-code-plugins-plus-skills/grammarly-observability

Install this agent skill to your local

pnpm dlx add-skill https://github.com/jeremylongshore/claude-code-plugins-plus-skills/tree/HEAD/plugins/saas-packs/grammarly-pack/skills/grammarly-observability

Skill Files

Browse the full folder contents for grammarly-observability.

Download Skill

Loading file tree…

plugins/saas-packs/grammarly-pack/skills/grammarly-observability/SKILL.md

Skill Metadata

Name
grammarly-observability
Description
|

Grammarly Observability

Instructions

Step 1: API Call Metrics

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,
    };
  }
}

Step 2: Structured Logging

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(),
  }));
}

Step 3: Alerting

// 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)}%`);
}

Resources