一键导入
qmd-redundancy-check
Finds and quantifies redundant content in QMD files - repeated equations, duplicate sections, similar paragraphs, and structural redundancy.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Finds and quantifies redundant content in QMD files - repeated equations, duplicate sections, similar paragraphs, and structural redundancy.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Critique book prose in the author's voice using patterns learned from his own git edit history (not a hand-written rubric). Use when asked to "voice-check", "punch up", "make this sound like me / like Vonnegut / like Cunk", or to review whether a passage is too pompous / cute / self-aware. Catches what the regex scanner (voice-check.py, ~1.4% of real edits) misses.
Review and improve QMD chapter writing quality by replacing boring/consultant text with Wishonia's deadpan alien voice, consolidating redundancy, and reducing word count. Use when asked to fix voice, make content funnier, remove jargon, or enforce the book's writing style.
Spawns parallel agents to review all paperback QMD files. Reads variable-resolved previews, flags judgment-required issues with REVIEW comments.
Automated book maintenance. Runs health checks, prioritizes work, and systematically fixes issues. Use when you want Codex to autonomously improve the book.
Check GitHub Actions workflow status, diagnose failures, fetch logs, and fix common build issues. Use when builds fail, deploys break, or you need to investigate CI/CD problems.
Critically analyze a calculated parameter for academic rigor. Checks methodology, identifies weaknesses, suggests improvements for economist audiences.
| name | qmd-redundancy-check |
| description | Finds and quantifies redundant content in QMD files - repeated equations, duplicate sections, similar paragraphs, and structural redundancy. |
| allowed-tools | ["Read","Bash","Write","Edit","Grep","Glob","AskUserQuestion"] |
All {{< var X >}} variables are hyperlinks to their derivations. When removing {{< var X_latex >}}, just delete it - no need to add links.
.venv/Scripts/python.exe scripts/redundancy-check.py <file.qmd> -v -o _analysis/redundancy-report.md
The report contains:
Read the report, then read the target QMD file to understand context.
Process issues in priority order. For each issue:
Read 30-50 lines around each occurrence. Understand the context.
Determine which is PRIMARY (authoritative) vs SECONDARY (recap/reference):
Present findings and recommendation to user (if not obvious):
Issue: [Type] - [Description]
Locations: L123 (Section A), L456 (Section B)
Analysis: [Why one is primary, one is secondary]
Recommendation: [Keep X, delete/merge Y]
Make the edit. For deletions, ensure no information is lost.
Move to next issue. Track progress.
Why it matters: Each equation expands to 20-50+ lines. 5 occurrences = 80-200 unnecessary lines.
Rule: Keep 1-2 instances per equation, depending on document structure.
Since all {{< var X >}} variables are hyperlinks to their derivations, readers can click any value to see the full equation. However, long technical documents may have intentional duplication for different audiences.
Acceptable duplication (multi-audience design):
What to REMOVE:
What to KEEP:
From report: Pairs with >40% word overlap flagged.
Investigation:
Actions:
| Finding | Action |
|---|---|
| Same content, different words | Merge into one section, delete other |
| One is recap of other | Delete recap, or convert to "See [Section X]" |
| Different content, confusing names | Rename one to clarify distinction |
| Intentionally different (e.g., methodology vs limitations) | Keep both, rename for clarity |
When sections cover related but distinct topics, rename headings to be more descriptive of their actual content. This prevents false positives in future scans and helps readers navigate.
Heading naming principles:
Examples of heading improvements:
| Original (ambiguous) | Improved (descriptive) | Why |
|---|---|---|
| "[Topic] Assumptions" (in Limitations) | "[Topic] Uncertainty" | Clarifies this discusses limitations, not the assumption itself |
| "[Topic]" (second occurrence) | "[Topic] Mechanism" | Distinguishes from summary section |
| "[Topic] Feasibility" (in Limitations) | "[Topic] Feasibility Constraints" | Shows this is about constraints, not general discussion |
| "Comparative [Topic]" | "Comparative [Topic] vs Alternatives" | Clarifies it's a comparison, not a feature description |
| "[Metric] Calculation" (in verification) | "[Metric] Derivation" | Shows it's a derivation, not just a result |
Anti-patterns to fix:
From report: Sections flagged with keywords: "Summary", "Key Findings", "Conclusion", "Results", "Overview"
Investigation: Compare content across all flagged sections. Do they repeat same bullets/points?
Common pattern: Document has "Key Findings" at top, "Summary of Results" in middle, and "Conclusion" at end - all saying the same thing.
Actions:
| Finding | Action |
|---|---|
| All repeat same points | Keep one (usually Conclusion), delete others |
| Each serves distinct purpose | Keep all, ensure they're differentiated |
| Overlap but different emphasis | Consolidate overlapping parts, keep unique parts |
From report: Exact sentences appearing at multiple line numbers.
Investigation: Read surrounding paragraphs. Which occurrence is the "home" for this sentence?
Actions:
From report: Paragraph pairs with >50% word overlap.
Investigation: Read both paragraphs in full. Are they:
Actions:
| Finding | Action |
|---|---|
| Same point, different words | Merge best parts into one |
| Different points | Keep both (false positive) |
| One elaborates other | Keep detailed version, delete summary version |
The script flags candidates, but these require human judgment:
Multiple summary sections
Collapsible boxes duplicating body
Tables duplicating adjacent prose
Repetition signal phrases (search for these):
These often mean: content can be deleted, or replaced with a link.
# For _latex: count remaining occurrences
grep -o "{{< var [a-z_]*_latex >}}" <file.qmd> | sort | uniq -c | sort -rn
# Re-run redundancy check
.venv/Scripts/python.exe scripts/redundancy-check.py <file.qmd>
# Validate no broken references
.venv/Scripts/python.exe scripts/pre-render-validation.py 2>&1 | grep <filename>
Success criteria:
_latex variable has 1-2 occurrences (no 3+ duplicates)| Pattern | Solution |
|---|---|
| Same equation appears 3+ times | Reduce to 1-2 (keep summary + derivation) |
| Same equation 6 lines apart | Delete the repeat |
| Equation after table with same values | Delete equation (table values are links) |
| Summary callout + verification section | Keep both (multi-audience design) |
| Sentence appears in intro AND conclusion | Keep in conclusion, delete from intro |
| Paragraph in "Summary" nearly identical to "Conclusion" | Merge into Conclusion, delete Summary section |
| Similar headings in different contexts | Rename to clarify distinction |
Heading fixes (to prevent future false positives):
| Ambiguous | Improved |
|---|---|
| "[Topic] Assumptions" (in Limitations) | "[Topic] Uncertainty" |
| "[Topic]" (appearing twice) | "[Topic] Mechanism" vs "[Topic] Summary" |
| "[Topic] Feasibility" (in Limitations) | "[Topic] Feasibility Constraints" |
| Generic "[Topic]" + Specific "[Topic] X" | Keep both (general → specific) |