Skip to content

LeoYeAI/agent-master-skills / skills/ai-humanizer

humanizer

Verified

Humanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 24 pattern detectors, 500+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.

FileKindSize
README.mdmarkdown15.8 KB
SKILL.mdskill md7.8 KB
assets/banner.mdmarkdown331 B
docs/CONTRIBUTING.mdmarkdown2.0 KB
docs/EXAMPLES.mdmarkdown5.3 KB
docs/PATTERNS.mdmarkdown2.4 KB
eslint.config.jsscript559 B
package.jsonmanifest1.3 KB
references/ai-vocabulary.mdmarkdown5.5 KB
references/patterns.mdmarkdown10.0 KB
references/style-guide.mdmarkdown3.9 KB
scripts/analyze.shscript301 B
scripts/humanize.shscript315 B
src/analyzer.jsscript14.8 KB
src/cli.jsscript19.6 KB
src/humanizer.jsscript14.2 KB
src/patterns.jsscript28.1 KB
src/stats.jsscript9.5 KB
src/vocabulary.jsscript15.1 KB
tests/analyzer.test.jsscript13.2 KB
tests/calibration.test.jsscript7.2 KB
tests/edge-cases.test.jsscript7.1 KB
tests/fixtures/ai-sample-1.txtmarkdown2.2 KB
tests/fixtures/ai-sample-2.txtmarkdown1.1 KB
tests/fixtures/human-sample-1.txtmarkdown1.1 KB
tests/humanizer.test.jsscript6.4 KB
tests/performance.test.jsscript3.2 KB
tests/statistics.test.jsscript7.9 KB
vitest.config.jsscript152 B

tests/edge-cases.test.js

View on GitHub
/**
 * edge-cases.test.js — Edge case tests.
 *
 * Empty text, single word, unicode, non-English, very long text.
 */

import { describe, it, expect } from 'vitest';
import { analyze, score } from '../src/analyzer.js';
import { computeStats } from '../src/stats.js';

// ─── Empty / Minimal Input ───────────────────────────────

describe('empty and minimal input', () => {
  it('handles empty string', () => {
    const result = analyze('');
    expect(result.score).toBe(0);
    expect(result.totalMatches).toBe(0);
    expect(result.wordCount).toBe(0);
  });

  it('handles whitespace-only string', () => {
    const result = analyze('   \n\n\t  ');
    expect(result.score).toBe(0);
  });

  it('handles null', () => {
    const result = analyze(null);
    expect(result.score).toBe(0);
  });

  it('handles undefined', () => {
    const result = analyze(undefined);
    expect(result.score).toBe(0);
  });

  it('handles single word — score is low', () => {
    const result = analyze('hello');
    expect(result.score).toBeLessThanOrEqual(15);
    expect(result.wordCount).toBe(1);
  });

  it('handles single character — score is low', () => {
    const result = analyze('x');
    expect(result.score).toBeLessThanOrEqual(15);
  });

  it('handles number-only input — score is low', () => {
    const result = analyze('12345');
    expect(result.score).toBeLessThanOrEqual(15);
  });

  it('statistics handles empty string', () => {
    const stats = computeStats('');
    expect(stats.sentenceCount).toBe(0);
    expect(stats.wordCount).toBe(0);
  });

  it('statistics handles single word', () => {
    const stats = computeStats('hello');
    expect(stats.wordCount).toBe(1);
    expect(stats.typeTokenRatio).toBe(1);
  });
});

// ─── Unicode & Special Characters ────────────────────────

describe('unicode and special characters', () => {
  it('handles emoji text', () => {
    const result = analyze('🎉 Hello world! 🚀 Great day! ✅ Done!');
    expect(result.score).toBeGreaterThanOrEqual(0);
    expect(result.score).toBeLessThanOrEqual(100);
  });

  it('handles Chinese text', () => {
    const result = analyze('这是一个测试。人工智能正在改变世界。');
    expect(result.score).toBeGreaterThanOrEqual(0);
  });

  it('handles Japanese text', () => {
    const result = analyze('これはテストです。AIは世界を変えています。');
    expect(result.score).toBeGreaterThanOrEqual(0);
  });

  it('handles Arabic text', () => {
    const result = analyze('هذا اختبار. الذكاء الاصطناعي يغير العالم.');
    expect(result.score).toBeGreaterThanOrEqual(0);
  });

  it('handles mixed unicode and ASCII', () => {
    const text = 'The café is très bien. Über cool. Naïve approach.';
    const result = analyze(text);
    expect(result.score).toBeGreaterThanOrEqual(0);
  });

  it('handles HTML entities', () => {
    const result = analyze('This & that <tag> content.');
    expect(result.score).toBeGreaterThanOrEqual(0);
  });

  it('handles special whitespace characters', () => {
    const result = analyze('Hello\u00A0world\u2003test\u200Bhidden');
    expect(result.score).toBeGreaterThanOrEqual(0);
  });

  it('statistics handles non-English gracefully', () => {
    const stats = computeStats('这是一个测试。人工智能正在改变世界。');
    expect(stats.sentenceCount).toBeGreaterThanOrEqual(0);
  });
});

// ─── Very Long Text ──────────────────────────────────────

describe('very long text', () => {
  it('handles 1000 identical sentences', () => {
    const text = Array(1000).fill('The cat sat on the mat.').join(' ');
    const result = analyze(text);
    expect(result.score).toBeGreaterThanOrEqual(0);
    expect(result.score).toBeLessThanOrEqual(100);
  });

  it('handles text with thousands of newlines', () => {
    const text = Array(500).fill('Line of text.\n').join('');
    const result = analyze(text);
    expect(result.score).toBeGreaterThanOrEqual(0);
  });

  it('statistics handles very long text', () => {
    const text = Array(500).fill('The cat sat on the mat.').join(' ');
    const stats = computeStats(text);
    expect(stats.wordCount).toBeGreaterThan(100);
    expect(stats.typeTokenRatio).toBeLessThan(0.1);
  });
});

// ─── Malformed Input ─────────────────────────────────────

describe('malformed input', () => {
  it('handles text with only punctuation — score is low', () => {
    const result = analyze('...!!!???---');
    expect(result.score).toBeLessThanOrEqual(15);
  });

  it('handles extremely long single word', () => {
    const word = 'a'.repeat(10000);
    const result = analyze(word);
    expect(result.score).toBeGreaterThanOrEqual(0);
  });

  it('handles text with excessive whitespace', () => {
    const result = analyze('Hello     world     this     is     spaced');
    expect(result.wordCount).toBeGreaterThanOrEqual(4);
  });

  it('handles markdown-heavy text', () => {
    const text =
      '# Heading\n\n**bold** _italic_ ~~strike~~ `code`\n\n- item 1\n- item 2\n- item 3\n\n> blockquote\n\n```\ncode block\n```';
    const result = analyze(text);
    expect(result.score).toBeGreaterThanOrEqual(0);
  });

  it('handles text with URLs', () => {
    const text =
      'Check out https://example.com and http://test.org/path?query=1&foo=bar for more info.';
    const result = analyze(text);
    expect(result.score).toBeGreaterThanOrEqual(0);
  });
});

// ─── Score Bounds ────────────────────────────────────────

describe('score bounds', () => {
  it('score is always 0-100', () => {
    const inputs = [
      '',
      'hello',
      'The cat sat.',
      'Additionally, this serves as a testament.',
      'Great question! I hope this helps! Let me know!',
    ];

    for (const input of inputs) {
      const s = score(input);
      expect(s).toBeGreaterThanOrEqual(0);
      expect(s).toBeLessThanOrEqual(100);
    }
  });

  it('maximum AI text does not exceed 100', () => {
    const text = `Great question! Here is a comprehensive overview.

Additionally, this serves as a testament to the transformative tapestry of the evolving landscape. In today's rapidly evolving digital age, these groundbreaking tools — nestled at the forefront of innovation — are showcasing the vibrant interplay of technology, highlighting its pivotal role and underscoring the crucial importance of seamless synergy.

Experts believe it plays a crucial role. Studies show improvement. Industry reports suggest growth. Despite challenges, the ecosystem continues to thrive. It's not just a tool, it's a revolution.

In order to help, due to the fact that you asked, at this point in time, it is important to note that the future looks bright. Exciting times lie ahead. I hope this helps! Let me know if you'd like me to expand.`;

    const s = score(text);
    expect(s).toBeLessThanOrEqual(100);
    expect(s).toBeGreaterThanOrEqual(60);
  });
});
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall