agentleFS
ThomasHoussinThomasHoussin/Claude-Book/.claude/skills/perplexity-improver/SKILL.md

perplexity-improver

Skill112 starsChanged 10 months agoMITView on GitHub

Improve chapter perplexity score by rewriting AI-suspect sentences. Use after writing a chapter to reduce detectable AI patterns.

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 10 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use at the end of a writing session, not after each edit

    line 26
  2. Distinctive:

    After writing a chapter, before final validation

    line 30
  3. Distinctive:

    When perplexity analysis shows a warning (⚠️)

    line 31
  4. Distinctive:

    If language not supported → report error and exit

    line 47
  5. Distinctive:

    If no warning (⚠️) in output → PASS, report and exit

    line 72
  6. Distinctive:

    If warning displayed (flagged rate > 25%) → proceed to Phase 3

    line 73
  7. Distinctive:

    CRITICAL: Verify that meaning is preserved and rewrites integrate naturally.

    line 86
  8. Distinctive:

    Run perplexity script on modified chapter.

    line 90
  9. Distinctive:

    Ask for validation before applying changes to chapter file.

    line 108
  10. Very specific:

    All thresholds are defined in scripts/detection/detection.py (constants at top of file).

    line 112
  11. Distinctive:

    Ask for validation before applying changes to file

    line 119

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Perplexity Improver Skill

Reduce AI-detectable patterns in chapters by rewriting low-perplexity sentences while preserving narrative integrity.

Quick Start

/perplexity-improver story/chapters/chapitre-05.md

Multiple chapters can be analyzed in one run:

/perplexity-improver story/chapters/chapitre-01.md story/chapters/chapitre-02.md

Performance Warning

⚠️ The analysis script is SLOW (several minutes for model loading and analysis).

  • Accumulate several corrections before re-running
  • Use at the end of a writing session, not after each edit

When to Use

  • After writing a chapter, before final validation
  • When perplexity analysis shows a warning (⚠️)

Supported Languages

CodeLanguageTechniques File
frFrançaisreferences/rewriting-techniques-fr.md
enEnglishreferences/rewriting-techniques-en.md

Workflow

Phase 1: Analyze Chapter

1. Detect language from chapter content (first 500 characters):

  • Identify language code (fr, en, etc.)
  • Load corresponding techniques file: references/rewriting-techniques-{lang}.md
  • If language not supported → report error and exit

2. Run perplexity analysis from the script directory (required for uv to find dependencies):

cd scripts/detection && uv run python detection.py ../../<path/to/chapter.md>

Important: The uv run command must be executed from scripts/detection/ where the pyproject.toml is located.

3. Extract from output:

  • Median perplexity score
  • Warning status (median below threshold)
  • Suspect rate (percentage of suspect sentences)
  • List of suspect sentences sorted by ascending perplexity

Phase 2: Evaluate Need

The script flags sentences using multiple criteria:

  • low_perplexity: individually predictable sentence
  • low_std: passage with uniform perplexity (no surprises)
  • adjacent_low: extended stretch without friction
  • low_ppl_density: cumulative boredom signal
  • forbidden_word: AI-signal vocabulary

Decision tree:

  • If no warning (⚠️) in output → PASS, report and exit
  • If warning displayed (flagged rate > 25%) → proceed to Phase 3

Priority: Sentences with multiple flags (multi-flagged) should be rewritten first using techniques from references/rewriting-techniques-{lang}.md.

Phase 3: Rewrite Sentences

Process sentences from lowest perplexity first (most predictable = most suspect).

For each suspect sentence:

  1. Locate in original chapter
  2. Rewrite using techniques from references/rewriting-techniques-{lang}.md
  3. Preserve exact meaning and narrative function

CRITICAL: Verify that meaning is preserved and rewrites integrate naturally.

Phase 4: Re-analyze

Run perplexity script on modified chapter.

Compare before/after:

  • Median perplexity: target ≥ threshold (no warning)
  • Suspect rate: target ≤ 20%
  • Suspect sentence count: target reduction

If still warning:

  • Iterate (max 3 loops)
  • Try different rewriting techniques
  • Focus on remaining lowest-perplexity sentences

Phase 5: Finalize

Generate reports in .work/:

  • perplexity-report.md: before/after stats, PASS/FAIL status
  • perplexity-changes.md: each rewritten sentence with technique used

Ask for validation before applying changes to chapter file.

Thresholds Reference

All thresholds are defined in scripts/detection/detection.py (constants at top of file).

Interaction Style

  • Show progress after each phase
  • Present before/after comparisons
  • Explain technique choices
  • Ask for validation before applying changes to file

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.