| name | grammarly-local-dev-loop |
| description | Configure Grammarly local development with hot reload and testing.
Use when setting up a development environment, configuring test workflows,
or establishing a fast iteration cycle with Grammarly.
Trigger with phrases like "grammarly dev setup", "grammarly local development",
"grammarly dev environment", "develop with grammarly".
|
| allowed-tools | Read, Write, Edit, Bash(npm:*), Bash(pnpm:*), Grep |
| version | 1.8.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","grammarly","writing"] |
| compatibility | Designed for Claude Code |
Grammarly Local Dev Loop
Overview
Set up a development workflow for Grammarly API integrations with mocked responses and vitest.
Instructions
Step 1: Project Structure
grammarly-integration/
โโโ src/grammarly/
โ โโโ client.ts # API client with token management
โ โโโ scoring.ts # Writing Score API
โ โโโ detection.ts # AI + Plagiarism detection
โ โโโ types.ts # TypeScript interfaces
โโโ tests/
โ โโโ fixtures/ # Mock API responses
โ โโโ scoring.test.ts
โโโ .env.local
โโโ package.json
Step 2: Mocked Tests
import { describe, it, expect, vi } from 'vitest';
const mockFetch = vi.fn();
vi.stubGlobal('fetch', mockFetch);
describe('Writing Score', () => {
it('should return scores for valid text', async () => {
mockFetch.mockResolvedValueOnce({
ok: true,
json: async () => ({ overallScore: 85, engagement: 80, correctness: 90, clarity: 85, tone: 82 }),
});
});
it('should reject text under 30 words', async () => {
mockFetch.mockResolvedValueOnce({ ok: false, status: 400, text: async () => });
});
});