Agent skill
grammarly-data-handling
Implement Grammarly data handling patterns for document processing. Use when handling large documents, managing text chunking, or implementing data pipelines for Grammarly API. Trigger with phrases like "grammarly data", "grammarly documents", "grammarly text processing", "grammarly pipeline".
Install this agent skill to your Project
npx add-skill https://github.com/jeremylongshore/claude-code-plugins-plus-skills/tree/main/plugins/saas-packs/grammarly-pack/skills/grammarly-data-handling
SKILL.md
Grammarly Data Handling
Overview
Handle large documents, text chunking, and data pipelines for Grammarly API. The API accepts max 100,000 characters (4 MB) with a minimum of 30 words.
Instructions
Step 1: Text Chunking
function chunkText(text: string, maxChars = 90000): string[] {
if (text.length <= maxChars) return [text];
const paragraphs = text.split('\n\n');
const chunks: string[] = [];
let current = '';
for (const p of paragraphs) {
if ((current + '\n\n' + p).length > maxChars && current) {
chunks.push(current);
current = p;
} else {
current = current ? current + '\n\n' + p : p;
}
}
if (current) chunks.push(current);
return chunks;
}
Step 2: Aggregate Scores Across Chunks
function aggregateScores(scores: any[]): any {
const avg = (arr: number[]) => arr.reduce((a, b) => a + b, 0) / arr.length;
return {
overallScore: Math.round(avg(scores.map(s => s.overallScore))),
correctness: Math.round(avg(scores.map(s => s.correctness))),
clarity: Math.round(avg(scores.map(s => s.clarity))),
engagement: Math.round(avg(scores.map(s => s.engagement))),
tone: Math.round(avg(scores.map(s => s.tone))),
chunkCount: scores.length,
};
}
Step 3: File Processing Pipeline
import fs from 'fs';
async function scoreFile(filePath: string, token: string) {
const text = fs.readFileSync(filePath, 'utf-8');
const chunks = chunkText(text);
const scores = [];
for (const chunk of chunks) {
if (chunk.split(/\s+/).length >= 30) {
scores.push(await grammarlyClient.score(chunk));
}
}
return aggregateScores(scores);
}
Resources
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
dockerfile-generator
Dockerfile Generator - Auto-activating skill for DevOps Basics. Triggers on: dockerfile generator, dockerfile generator Part of the DevOps Basics skill category.
branch-naming-helper
Branch Naming Helper - Auto-activating skill for DevOps Basics. Triggers on: branch naming helper, branch naming helper Part of the DevOps Basics skill category.
readme-generator
Readme Generator - Auto-activating skill for DevOps Basics. Triggers on: readme generator, readme generator Part of the DevOps Basics skill category.
makefile-generator
Makefile Generator - Auto-activating skill for DevOps Basics. Triggers on: makefile generator, makefile generator Part of the DevOps Basics skill category.
gitignore-generator
Gitignore Generator - Auto-activating skill for DevOps Basics. Triggers on: gitignore generator, gitignore generator Part of the DevOps Basics skill category.
pre-commit-hook-setup
Pre Commit Hook Setup - Auto-activating skill for DevOps Basics. Triggers on: pre commit hook setup, pre commit hook setup Part of the DevOps Basics skill category.
Didn't find tool you were looking for?