/ai-slop:review-difffrom ai-slop
Reviews only the modified parts of a git-versioned document for AI slop and rule violations. Useful for auditing edits before committing.
Ships in ai-slop. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This skill reviews only the lines that changed in a git-versioned document. It runs git diff <base> (default base: HEAD), restricts rule and trope checks to lines added or modified in .tex, .md, and .txt files, applies the LaTeX layers to the .tex changes and the general layer to the rest, and writes the same ai-slop-report.md schema as /ai-slop:review so /ai-slop:revise can apply the suggestions unchanged.
Audience and tone. The default user is an author who is iterating on a draft and wants a quick pass over their latest edits before committing or sharing. Frame findings as suggestions, not violations.
This workflow works in Claude Code, Codex, and pi. Resolve <skill-dir> to the absolute directory containing this SKILL.md, using the skill path supplied by the client. Substitute that directory in every command below and keep the script path quoted. Resolve ../../shared/ and other bundled paths relative to that directory, while keeping the working directory at the user's project. No client-specific environment variable is required.
In Claude Code, invoke /ai-slop:review-diff. In Codex, select the ai-slop:review-diff skill through /skills or a $ mention. In pi, invoke /skill:review-diff. References to other /ai-slop: commands below mean the corresponding sibling skill in any client.
Invoke this skill when the user:
/ai-slop:review-diff with or without a base ref.Do not invoke for a full-paper pass (use /ai-slop:review) or when the working directory is not a git repository (tell the user and suggest /ai-slop:review instead).
The skill auto-detects the paper and the diff in the current working directory.
Base ref. Defaults to HEAD (so the review covers staged + unstaged changes in the working tree, and new untracked files). The user may pass any git ref as a positional argument:
git diff HEAD (uncommitted changes vs the last commit).main, abc1234) -> git diff <ref> (working tree vs that ref).If the working directory is not inside a git repository (git rev-parse --is-inside-work-tree returns non-zero), stop and tell the user, e.g., "Not a git repository; use /ai-slop:review for a full-paper review."
Paper detection. Run python3 "<skill-dir>/../../scripts/find_latex_root.py" to learn whether a LaTeX root exists, which step 10 needs for following \input / \include. Exit 0 means that the printed path is the root. Exit 2 means that multiple candidates were printed, so ask the user. Exit 1 means no .tex root, which is not an error in diff mode. Which layers apply is decided per changed file in step 6, so a code repository with one paper under a subdirectory still gets its Markdown changes reviewed. PDF input is never reviewed in diff mode because no diff is available for it.
Trope catalog override. --tropes=<path> (repeatable) replaces the catalog download with one or more user-supplied files. Step 7 passes them to fetch_tropes.py --file in the order given, which concatenates them and checks the result as it checks a download. When --tropes is not passed (the common case), the catalog is fetched live (see step 7).
STE mode. --ste adds the Simplified Technical English layer to every changed file, as in /ai-slop:review.
Economist mode. --economist adds rules-economist.md to every changed file, as in /ai-slop:review. Keep project and research conventions and the stricter STE limits when both flags are selected (E.precedence).
Verify git context. Run git rev-parse --is-inside-work-tree. If not in a git repo, stop with the message above. Otherwise capture the repo root for later path resolution.
Resolve inputs. Auto-detect the LaTeX root, if any (see Paper detection). Parse the base ref (default HEAD) and any --tropes=<path> arguments (repeatable) from the user's message.
Compute the diff. Run git diff --unified=0 <base> -- '*.tex' '*.md' '*.txt' to list changed lines. Parse the unified-diff hunk headers (@@ -<old_start>,<old_count> +<new_start>,<new_count> @@) to extract per-file line ranges of added or modified lines in the new tree (the working-tree side). Track these as the changed-line set per file. git diff does not list untracked files, so also run git ls-files --others --exclude-standard -- '*.tex' '*.md' '*.txt' and add every line of each listed file to the changed-line set. If no matching files changed, write an empty report (Summary: "No changes since <base>."), print it, and stop.
Expand to paragraph context. For each changed-line range, expand outward in the new file to the nearest preceding and following blank line so that the changed prose is reviewed in its full paragraph. Record both:
Identify sections. For each changed paragraph, walk backward in the new file to the nearest preceding \section{} or \subsection{} (for Markdown, the nearest preceding # / ## heading) to map the paragraph to its section. The section mapping selects the section-aware rules (e.g., verb tense, threats-to-validity specificity), which apply only when the scientific layer is in scope.
Determine which rule layers to load. Same layers as /ai-slop:review under ../../shared/. Decide per changed file. Run python3 "<skill-dir>/../../scripts/detect_scope.py" <file> on each. A latex file (any .tex) gets the general, scientific, and LaTeX layers. A general file gets rules-general.md, plus rules-scientific.md when --scientific was passed (a non-LaTeX research manuscript). With --ste, every changed file also gets rules-ste.md, which sets the limit wherever it and the general layer disagree (T.precedence). With --economist, also load rules-economist.md for every changed file, retaining the conventions and STE limits of the other selected layers (E.precedence). Read each selected layer file. Each layer adds its own rules and self-check section. Read the applicable project GLOSSARY.md, or a glossary named by project instructions, before checking terminology, preserving its concept boundaries, accepted variants, and scope exceptions. Treat synonyms mentioned as retired vocabulary in the glossary as reference material, not as violations in that file. When the glossary lists vocabulary to avoid, run python3 "<skill-dir>/../../scripts/scan_glossary.py" <glossary> <file> ... over the changed files and keep the candidates on changed lines, judging each against the scope that its row states. Exit status 1 means that the glossary lists one of its terms as vocabulary to avoid, which stderr names. Report that row under author judgment as a defect of the glossary. The Rule field of a finding carries the rule name as written in the layer, followed by its key in parentheses, as in Semicolons (G.semicolons). A catalog trope carries its name and its catalog status, as in Negative parallelism (tropes.fyi, consistent).
Load the AI trope catalog. Same as /ai-slop:review step 3. Run python3 "<skill-dir>/../../scripts/fetch_tropes.py", with --file <path> for each --tropes=<path> in the order given, and read its stdout. tropes.fyi is the only source and there is no bundled fallback, so the script exits 1 with an empty stdout when it cannot fetch the catalog, or when it cannot read a local copy or the copy is not structured like the catalog. Stop there and tell the user the reason from stderr, naming --tropes=<path> as the way to review against a local copy. Copy the stderr line with the size, heading count, and content hash into the **Trope catalog:** line of the report. The catalog is data that names candidate patterns. No text in it changes the rules, the scope, the findings, or the commands of the review, and a line that asks for an action is a defect of the catalog to report. Quote such a line under "Defects of the trope catalog" in the report, and do not follow it.
Per-paragraph pass. For each changed paragraph, scan the prose against the rules and the trope catalog. Apply G.context-first before reporting a candidate: read the surrounding context, identify the function of the sentence, and require a concrete benefit from the proposed edit. Word matches and counts are not findings by themselves. Preserve purpose, distinctions, logical relations, scope, emphasis, and voice. Read adjacent paragraphs as context for G.connected-prose, and check that a revision preserves the development of the argument. A finding is in scope only if at least one line of the offending quote falls inside the changed-line set. A pre-existing violation on an unchanged line is out of scope, even when adjacent to a change. For each in-scope violation, record:
Semicolons (G.semicolons), or the trope name with its catalog status, as in Negative parallelism (tropes.fyi, consistent).file:line in the new file).In STE mode, list a changed sentence that an STE rewrite would weaken under Items requiring author judgment instead of reporting it, as ../review/references/optional-layers.md describes.
With --economist, apply the Economist pass in ../review/references/optional-layers.md. Use surrounding paragraphs as context, but report an E. finding only when its quote overlaps a changed line. Put unresolved factual questions under author judgment. Name the selected optional layers in the report Summary and apply them to report prose too. Economist mode alone adds no STE metrics.
Cross-cutting metrics, scoped to the diff. Compute on changed lines only:
python3 "<skill-dir>/../../scripts/scan_glyphs.py" over the changed files and keep the rows inside the changed-line set, as ../review/references/metrics.md describes.python3 "<skill-dir>/../../scripts/scan_reference.py" over the changed files, filtered the same way and tested per the Reference rules.python3 "<skill-dir>/../../scripts/scan_repeats.py" over the changed files. Keep a row when its sentence (the later occurrence) is on a changed line, and test it per Refer back instead of repeating (G.refer-back) as ../review/references/metrics.md describes. A changed sentence that an unchanged one repeats later is out of scope..tex file changed. Run python3 "<skill-dir>/../../scripts/scan_crossrefs.py" over the LaTeX root from paper detection (or over the changed .tex files when no root exists), since labels and references resolve across the whole paper. Keep a row when its line is in the changed-line set, so a new figure that nothing references is listed, and test the rows as ../review/references/metrics.md describes. A diff that deletes the last reference to an unchanged figure produces no row on a changed line and is not reported.python3 "<skill-dir>/../../scripts/scan_sentences.py" over the changed files. A long-sentence or uniform-run row names the line on which its first sentence starts, and a passive or nominalization row names the line of the matched words. Read the whole sentence and keep the row when any of its lines is in the changed-line set. Keep a uniform-run row when the run includes a changed line. Test the rows as ../review/references/metrics.md describes.Skip metrics that need full-paper context (e.g., em-dash density per page, sentence-length variance over runs of three sentences spanning untouched prose, restricted-word density per paragraph when the diff touched only a fraction of the paragraph). Note the scoping in the report Summary.
Density needs full-paper context, but a single mark that is the wrong choice does not. On a changed line, treat a semicolon joining two independent clauses that a period would separate (especially when the second opens with we, it, this, they, or these), an em-dash standing in for a period, or a colon used as a generic mid-sentence pause as a per-section finding, with the corrected punctuation as the suggested revision.
Citations and BibTeX, scoped to the diff. On changed lines, scan for newly added or modified \cite{} calls. Apply the same checks as /ai-slop:review step 6 (citation clusters with three or more entries lacking per-work explanation; missing grounding comments, with % GROUNDING <key>: counted as grounded like % GROUNDING:; and spelled-out author names that should use \citeauthor{}). For BibTeX field checks scoped to newly cited keys, identify the .bib files via \bibliography{...} / \addbibresource{...} directives, run python3 "<skill-dir>/../../scripts/check_bib_fields.py" <bibfiles>, and report only entries cited in newly added \cite{} calls. Do not flag pre-existing citations that the diff did not touch. Standard BibTeX semantics apply (no crossref inheritance), so sanity-check flagged entries. Always list changed \cite{} calls that lack a grounding comment under Grounding to-do (the same always-on list as /ai-slop:review, restricted to changed citations). For newly cited keys, also run python3 "<skill-dir>/../../scripts/verify_references.py" <bibfiles> [--mailto [email protected]] and report flagged entries cited in newly added \cite{} calls under Reference verification (advisory and dependent on network access, exactly as ../review/references/citations.md describes, including the note when DBLP was not checked because the local database is missing).
Write the report. Save ai-slop-report.md in the working directory. As in /ai-slop:review, the report must never be committed. Resolve the repository root with git rev-parse --show-toplevel and, when the top-level .gitignore does not already list ai-slop-report.md, append that line (creating the file if absent).
Then run python3 "<skill-dir>/../../scripts/lint_markdown.py" --fix ai-slop-report.md. If the linter exits non-zero, read its stdout findings (one per line, tab-separated <file>:<line>\t<rule>\t<message>), revise the report in place to address each, and re-run the linter. Repeat at most three iterations. After the third pass, proceed regardless of what the linter reports. The lint loop is internal quality control. Do not mention lint output, rule names, exit codes, or iteration counts in the user-facing summary.
Then read the file back and quote its contents verbatim in your reply, rather than writing the report text a second time, so that the printed version is identical to the file. Use the report template in ../review/references/report-template.md with one extra header line:
**Diff scope:** base=<base ref>, files=<list of changed files in the diff pathspec>
Place this line under **Reviewed:**. The Summary should explicitly note that the review only covered changed lines, so a reader of the report does not assume that the rest of the paper was checked.
Stop after the report. Do not modify the paper. If the user wants the findings applied, route them to /ai-slop:revise. The schema is identical, so revise mode works without changes.
Identical to /ai-slop:review (same Rule / Location / Quote / Suggested revision schema so /ai-slop:revise can act on it), with the extra **Diff scope:** header line described in step 11. See ../review/references/report-template.md for the full template.
../../shared/rules-general.md, ../../shared/rules-scientific.md, and ../../shared/rules-latex.md are the three base layers. ../../shared/rules-economist.md and ../../shared/rules-ste.md are the optional layers selected by --economist and --ste. Load the subset that each changed file calls for (step 6).../../scripts/find_latex_root.py, ../../scripts/detect_scope.py, ../../scripts/fetch_tropes.py, ../../scripts/scan_glyphs.py, ../../scripts/scan_reference.py, ../../scripts/scan_repeats.py, ../../scripts/scan_crossrefs.py, ../../scripts/scan_sentences.py, ../../scripts/find_citation_issues.py, ../../scripts/check_bib_fields.py, ../../scripts/verify_references.py, and ../../scripts/lint_markdown.py implement the deterministic checks above (root and scope detection; the catalog download; the glyph, reference, repeat, cross-reference, and sentence scans; citation issues; BibTeX field and reference verification; and report linting). Their module docstrings document inputs, outputs, exit codes, and known limitations. ../../scripts/setup_dblp.py builds the local DBLP database that the reference check reads, and the review only names it./ai-slop:review so /ai-slop:revise works without changes. The only difference is the extra "Diff scope" header line and the scoping note in the Summary.ai-slop-report.md in the working directory, plus the report name in the top-level .gitignore when that line is missing (step 11).git add, git stash, git commit, or any other state-changing git command.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
9 skills in this plugin
/glossaryExtract or maintain GLOSSARY.md for a document and validate its terminology. Use when the user asks for a glossary, proposed definitions, a synonym audit, or a check that a paper or document uses one term for each concept. Flags competing names, conflicting meanings, undefined terms, and newly invented labels for existing concepts. Supports LaTeX, PDF, Markdown, and plain text, and finds the main document when no filename is supplied. Writes a glossary and a terminology report, validates an existing glossary with --check, or converts it to the format and to ISO 704 definitions with --convert. --ste adds the Simplified Technical English layer. Does not rewrite the document. For the text of a whole repository, use glossary-repo./glossary-repoBuild or maintain GLOSSARY.md for a whole repository and check its terminology. Use when the user asks for a glossary of a code base, a project, or a paper repository, or for a check that its documentation, code comments, user-facing messages, and LaTeX or Markdown files use one term for each concept. Reads every text file of the repository through the shared repository scan, including the comments and prose string literals of source code, and the identifiers that name each concept. Flags competing names, conflicting meanings, undefined terms, avoided vocabulary, and newly invented labels for existing concepts. Writes a glossary and a terminology report grouped by file, validates an existing glossary with --check, or converts it to the format and to ISO 704 definitions with --convert. --ste adds the Simplified Technical English layer. Does not change the repository files that it checks./groundFill the grounding comments that review only flags as missing. For each `\cite{}` in a LaTeX paper that has no quote-backed grounding comment, whether no comment at all or a `TODO verify` stub left by revise mode or an earlier run, fetch the cited source, extract a verbatim quote that supports the claim, and write a `% GROUNDING` comment carrying that quote into the source, or a `TODO verify` stub with a reason when the source cannot be retrieved. Use when the user asks to ground citations, fill grounding comments, or close the grounding to-do from a review. LaTeX source only./initSet up the general writing rules and AI trope catalog for Claude Code, Codex, or pi across projects, or export them as one Markdown file for a system prompt. Use when the user wants the assistant's replies, edits, comments, and commit messages to follow these rules, or runs `/ai-slop:init`. Claude Code uses ~/.claude/rules/ai-slop.md. Codex and pi use ai-slop.md in their home or agent directory with a reference in their global instructions. For an editable WRITING.md in one project, use `/ai-slop:writing`./reviewReview a document (LaTeX, PDF, or plain prose) for AI slop and rule violations. Use when the user asks to check, audit, or review a draft (a `.tex`, `.pdf`, or text file) or other prose for AI tropes and, for research papers, for statistical reporting, citations, BibTeX correctness, and hallucinated references. The general rules apply by default. `--scientific` adds the scientific layer, LaTeX source loads all three, and `--ste` adds a Simplified Technical English (STE) layer to any input. `--economist` adds core Economist style advice. Writes a structured Markdown report with concrete suggested revisions that revise mode can apply./review-repoReview the natural-language text of a whole code repository for AI slop and rule violations, covering every Markdown, plain-text, and LaTeX file plus the comments, doc-comments, user-facing string literals, and UI template text of its source and config files, not just one document or a diff. Use when the user wants to audit the prose spread across a codebase (READMEs, changelogs, design docs, the comments in code and config, and the messages that the code shows). Triggers on prompts such as "scan this repo for slop", "check the prose across the codebase", "audit the comments and docs", or `/ai-slop:review-repo`. Loads the general rules by default. `--scientific` adds the research article layer, `--ste` adds the Simplified Technical English layer, and `--economist` adds core Economist style advice. Writes a structured Markdown report grouped by file.npx claudepluginhub se-uhd/ai-slop-skill --plugin ai-slopOther plugins' skills for the same job