ai-content-detection · v1.0.0 · 2026-03-22 · sha256 1579debd3577a12c
ai-content-detection v1.0.0A
Immutable. This exact content never changes and is served at /api/v1/blob/1579debd3577a12c.
No tool to install first
claude plugin marketplace add https://markdownregistry.com/mp/a/art_ndxjw7fzszpss2pp/1579debd3577a12cecb3b424255cc996f0cfdd430b210fcec63145d194b5a78e.json
Then /plugin install ai-content-detection@markdownregistry-ndxjw7fzszpss2pp in Claude Code. It installs this exact version, the one graded A here, pinned to the commit it was graded at, and leaves it there.
---
name: ai-content-detection
description: >-
Detect AI-generated text using a built-in ruleset, LLM analysis, and optional
external detection APIs. Use when: auditing content for AI authorship, academic
integrity checks, editorial review, SEO content audits, HR screening.
license: Apache-2.0
compatibility: "Requires Node.js 18+ and @anthropic-ai/sdk"
metadata:
author: terminal-skills
version: "1.0.0"
category: ai-tools
tags: ["ai-detection", "content-moderation", "llm", "text-analysis", "academic-integrity"]
use-cases:
- "Check if a submitted essay or article was written by AI"
- "Audit freelance content for AI authorship before publishing"
- "Screen job application cover letters for AI generation"
- "Build an automated editorial review pipeline"
agents: [claude-code, openai-codex, gemini-cli, cursor]
---
# AI Content Detection
## Overview
Detect whether text was written by a human or generated by AI using a multi-layer approach:
1. **Rule-based analysis** — linguistic patterns and statistical indicators any LLM can apply
2. **LLM-as-judge** — use Claude/GPT to score content against the ruleset
3. **External APIs** — optional GPTZero, Originality.ai, Winston AI for corroboration
## The Detection Ruleset
When analyzing text for AI authorship, evaluate these signals:
### 🔴 Strong AI Indicators (weight: high)
- **Uniform sentence rhythm** — sentences are consistently similar in length and structure
- **Hedging overuse** — excessive "it's important to note", "it's worth mentioning", "additionally", "furthermore", "in conclusion"
- **Perfect paragraph structure** — every paragraph follows introduction → body → conclusion exactly
- **Generic examples** — examples feel abstract or hypothetical, not drawn from real experience
- **No typos or informal language** — unnaturally clean, zero colloquialisms
- **Bullet point obsession** — converts everything into lists regardless of content type
- **Lack of personal anecdotes** — no "I remember when...", "in my experience...", specific memories
- **Symmetric structure** — article has perfect 3-point structure, 5-step lists, etc.
- **Overuse of em-dashes** — AI models (especially Claude) heavily overuse em-dashes
### 🟡 Moderate AI Indicators (weight: medium)
- **Safe, diplomatic stance** — never takes a controversial position, always "on the other hand"
- **Abstract nouns over verbs** — "the utilization of" vs "using"
- **No sensory details** — descriptions lack taste, smell, texture, sound
- **Temporal vagueness** — "in recent years", "nowadays" instead of specific dates
- **Citation without specificity** — "studies show" without naming studies
- **Overly formal register** — uses formal language even for casual topics
- **Repetitive key phrases** — repeats the topic keyword multiple times per paragraph
### 🟢 Human Indicators (reduce AI suspicion)
- Typos or self-corrections mid-sentence
- Specific dates, names, places from personal experience
- Unusual word choices or invented terms
- Contradictions or inconsistencies (humans make mistakes)
- References to very recent events (past 2-3 months)
- Strong opinions stated without hedging
- Informal contractions, slang, dialect
### Statistical Signals
- **Perplexity** — AI text has lower perplexity (more predictable word choices)
- **Burstiness** — human text has high burstiness (mix of long and short sentences)
- AI burstiness score < 0.3 = likely AI
- Human burstiness > 0.5 = likely human
- **Vocabulary richness** — type-token ratio lower in AI text
## Using LLM as Judge
### Prompt Template
```typescript
const DETECTION_PROMPT = `You are an AI content detection expert. Analyze the following text and determine if it was written by a human or generated by AI.
Apply the following detection ruleset:
STRONG AI INDICATORS (each worth 2 points):
- Uniform sentence rhythm and length
- Excessive transitional phrases (furthermore, additionally, in conclusion, it's worth noting)
- Perfect paragraph structure every time
- Generic/hypothetical examples, no real specifics
- Absolutely no typos or informal language
- Overuse of bullet points and numbered lists
- Zero personal anecdotes or first-person experiences
- Overuse of em-dashes (—)
MODERATE AI INDICATORS (each worth 1 point):
- Always diplomatically neutral, never controversial
- Heavy abstract nouns ("utilization" vs "using")
- No sensory details in descriptions
- Vague temporal references ("in recent years")
- Unattributed statistics ("research shows")
HUMAN INDICATORS (subtract 1 point each):
- Typos or mid-sentence corrections
- Specific personal memories or dates
- Unusual word choices or neologisms
- Strong controversial opinions stated plainly
- References to very recent events
TEXT TO ANALYZE:
"""
{{TEXT}}
"""
Respond with JSON:
{
"score": <0-10, where 0=definitely human, 10=definitely AI>,
"verdict": "human" | "likely_human" | "uncertain" | "likely_ai" | "ai",
"confidence": "low" | "medium" | "high",
"signals_found": ["list of specific indicators detected"],
"reasoning": "2-3 sentence explanation",
"suspicious_phrases": ["exact phrases that are most AI-typical"]
}`;
```
### Implementation
```typescript
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic();
interface DetectionResult {
score: number;
verdict: "human" | "likely_human" | "uncertain" | "likely_ai" | "ai";
confidence: "low" | "medium" | "high";
signals_found: string[];
reasoning: string;
suspicious_phrases: string[];
}
async function detectAIContent(text: string): Promise<DetectionResult> {
const prompt = DETECTION_PROMPT.replace("{{TEXT}}", text);
const response = await client.messages.create({
model: "claude-opus-4-5",
max_tokens: 1024,
messages: [{ role: "user", content: prompt }],
});
const content = response.content[0];
if (content.type !== "text") throw new Error("Unexpected response type");
const jsonMatch = content.text.match(/\{[\s\S]*\}/);
if (!jsonMatch) throw new Error("Could not parse JSON response");
return JSON.parse(jsonMatch[0]);
}
// Batch analysis with chunking for long documents
async function analyzeDocument(
text: string,
chunkSize = 1500
): Promise<{
overall_score: number;
verdict: string;
chunk_results: DetectionResult[];
summary: string;
}> {
const words = text.split(" ");
const chunks: string[] = [];
for (let i = 0; i < words.length; i += chunkSize) {
chunks.push(words.slice(i, i + chunkSize).join(" "));
}
const results = await Promise.all(chunks.map(detectAIContent));
const avgScore =
results.reduce((sum, r) => sum + r.score, 0) / results.length;
const verdict =
avgScore >= 7
? "ai"
: avgScore >= 5.5
? "likely_ai"
: avgScore >= 4
? "uncertain"
: avgScore >= 2.5
? "likely_human"
: "human";
return {
overall_score: Math.round(avgScore * 10) / 10,
verdict,
chunk_results: results,
summary: `Analyzed ${chunks.length} section(s). Average AI score: ${avgScore.toFixed(1)}/10.`,
};
}
```
## Burstiness Calculator
```typescript
function calculateBurstiness(text: string): number {
const sentences = text.match(/[^.!?]+[.!?]+/g) || [];
if (sentences.length < 3) return 0.5;
const lengths = sentences.map((s) => s.trim().split(" ").length);
const mean = lengths.reduce((a, b) => a + b, 0) / lengths.length;
const variance =
lengths.reduce((sum, l) => sum + Math.pow(l - mean, 2), 0) /
lengths.length;
const stdDev = Math.sqrt(variance);
// Normalize: burstiness = coefficient of variation
return stdDev / mean;
}
function analyzeLocally(text: string) {
const burstiness = calculateBurstiness(text);
const wordCount = text.split(/\s+/).length;
const uniqueWords = new Set(text.toLowerCase().match(/\b\w+\b/g)).size;
const typeTokenRatio = uniqueWords / wordCount;
const aiPhrases = [
"it's worth noting",
"it is worth mentioning",
"furthermore",
"additionally",
"in conclusion",
"in today's",
"in recent years",
"it's important to",
"delve into",
"it goes without saying",
"needless to say",
"as previously mentioned",
];
const foundPhrases = aiPhrases.filter((p) =>
text.toLowerCase().includes(p)
);
return {
burstiness,
typeTokenRatio,
foundAIPhrases: foundPhrases,
localScore: foundPhrases.length * 0.5 + (burstiness < 0.3 ? 3 : 0),
};
}
```
## External API Integration
```typescript
// GPTZero API
async function checkGPTZero(text: string, apiKey: string) {
const response = await fetch("https://api.gptzero.me/v2/predict/text", {
method: "POST",
headers: {
"x-api-key": apiKey,
"Content-Type": "application/json",
},
body: JSON.stringify({ document: text }),
});
return response.json();
// Returns: { documents: [{ completely_generated_prob, average_generated_prob, ... }] }
}
// Originality.ai API
async function checkOriginalityAI(text: string, apiKey: string) {
const response = await fetch("https://api.originality.ai/api/v1/scan/ai", {
method: "POST",
headers: {
"X-OAI-API-KEY": apiKey,
"Content-Type": "application/json",
},
body: JSON.stringify({ content: text, aiModelVersion: "1" }),
});
return response.json();
// Returns: { score: { ai: 0-1, original: 0-1 } }
}
```
## Full Pipeline
```typescript
async function fullDetectionPipeline(
text: string,
options: {
useExternalAPIs?: boolean;
gptzeroApiKey?: string;
originalityApiKey?: string;
}
) {
// Step 1: Local analysis (free, instant)
const local = analyzeLocally(text);
// Step 2: LLM analysis
const llmResult = await detectAIContent(text.slice(0, 4000));
// Step 3: Optional external APIs
const external: Record<string, any> = {};
if (options.useExternalAPIs && options.gptzeroApiKey) {
external.gptzero = await checkGPTZero(text, options.gptzeroApiKey);
}
// Combine scores
const scores = [llmResult.score];
if (external.gptzero?.documents?.[0]) {
scores.push(
external.gptzero.documents[0].completely_generated_prob * 10
);
}
const finalScore = scores.reduce((a, b) => a + b, 0) / scores.length;
return {
final_score: finalScore,
verdict: llmResult.verdict,
confidence: scores.length > 1 ? "high" : llmResult.confidence,
llm_analysis: llmResult,
local_analysis: local,
external_apis: external,
};
}
```
## Limitations
- No detection method is 100% accurate
- Paraphrasing tools can fool detectors
- Non-native English writers may score higher
- Short texts (<200 words) are unreliable
- Watermarking (C2PA) is more reliable when available