AGENT SKILL

content-deduplication-discipline

Content Deduplication Discipline

License 许可
MIT
最近更新
2026-11-14
Stars
★ 18
Forks
6

01 前言 Front Matter

name
content-deduplication-discipline
metadata
{ "original-index": 41, "short-description": "Content Deduplication Discipline" }
description
Content Deduplication Discipline

02 资源文件 1

03 SKILL.md 正文

Content Deduplication Discipline

What

A practice for preventing and eliminating duplicate content within technical documents, ensuring each fact has exactly one authoritative location with references pointing to it rather than copies of it.

Why

Duplicate content creates maintenance nightmares:

  • Update one copy, forget the others → contradictions
  • Reader finds conflicting versions → trust erosion
  • Document bloat → harder to navigate
  • Search results polluted → wrong instance edited

The Single Source of Truth (SSOT) principle applies to documents just as it does to databases: each fact should live in exactly one place.

Duplication Patterns

Pattern Description Risk Level
Verbatim copy Exact same paragraph in 2+ places 🔴 HIGH — guaranteed to diverge
Paraphrase copy Same information, different words ⚠️ MEDIUM — subtle contradictions
Summary + detail Executive summary repeats detail section ✅ LOW if summary clearly references source
Table + prose Same data in table and paragraph form ⚠️ MEDIUM — update one, forget other
Cross-document Same content in multiple files 🔴 HIGH — no linking mechanism

How

Prevention: Write Once, Reference Elsewhere

# WRONG: Duplicate the data
## Section 2.5
There are 1,727 SPs across 22 databases.

## Section 6.4
The 1,727 stored procedures across 22 databases require...

## Executive Summary  
With 1,727 SPs spread across 22 databases...

# RIGHT: Single source with references
## Section 2.5.2 SP Inventory
**Total: 1,727 SPs across 22 databases** (see table below)

## Section 6.4
The SP inventory (§2.5.2: 1,727 SPs across 22 databases) requires...

## Executive Summary
The SP inventory (§2.5.2) drives the migration complexity...

Detection: Find Duplicates

Paragraph fingerprinting:

const fs = require('fs');
const crypto = require('crypto');

const doc = fs.readFileSync('document.md', 'utf8');
const paragraphs = doc.split(/\n\n+/).filter(p => p.trim().length > 50);

const hashes = {};
paragraphs.forEach((p, i) => {
  // Normalize: lowercase, collapse whitespace, remove punctuation
  const normalized = p.toLowerCase().replace(/\s+/g, ' ').replace(/[^\w\s]/g, '');
  const hash = crypto.createHash('md5').update(normalized).digest('hex').slice(0, 8);
  
  if (hashes[hash]) {
    console.log(`Duplicate found: "${p.slice(0, 60)}..."`);
    console.log(`  First occurrence: paragraph ${hashes[hash]}`);
    console.log(`  This occurrence: paragraph ${i + 1}`);
  } else {
    hashes[hash] = i + 1;
  }
});

Grep for key phrases:

# Find repeated key facts
grep -n "1,727 SPs" document.md
grep -n "272 vCores" document.md
grep -n "\$56.5K" document.md

# If count > 1, evaluate: reference or duplicate?

Resolution: Consolidate Duplicates

When duplicates are found:

  1. Identify the authoritative location — usually the most detailed occurrence
  2. Keep that version — ensure it's complete and accurate
  3. Replace other occurrences with references:
    • Full reference: "As documented in §2.5.2, there are 1,727 SPs..."
    • Inline reference: "the SP inventory (§2.5.2)"
    • Parenthetical: "1,727 SPs (§2.5.2)"

Acceptable Duplication

Some duplication is intentional and acceptable:

Scenario Why Acceptable Safeguard
Executive Summary Readers may only read summary Note "Details in §X.Y"
Table of Contents Navigation aid Auto-generate if possible
Glossary definitions Quick reference Mark as "canonical definition"
Repeated warnings Safety-critical info Use consistent boilerplate

Deduplication Checklist

## Before Publishing: Deduplication Audit

### Key Facts Inventory
List facts that appear in multiple locations:

| Fact | Authoritative Location | Other Occurrences | Action |
|------|----------------------|-------------------|--------|
| SP count: 1,727 | §2.5.2 | §6.4, Exec Summary | Verify refs |
| vCore count: 272 | §2.6.1.9 | §3.2, §6.1 | Verify refs |
| Cost: $56.5K/mo | §2.6.1.9 | Exec Summary | Verify refs |

### Search for Common Duplications
- [ ] Numbers with units ($, GB, K, M)
- [ ] Proper nouns (product names, tech names)
- [ ] Conclusions ("technically feasible", "not recommended")
- [ ] Status claims ("confirmed", "complete", "pending")

When to Use

  • During writing: Before repeating a fact, check if it exists elsewhere
  • After merging content: Merged documents often duplicate
  • Before publishing: Full deduplication audit
  • When document exceeds 1,000 lines: Duplication becomes invisible

Anti-Patterns

Anti-Pattern Problem Solution
Copy-paste writing Fastest way to duplicate Reference instead of copy
"Just in case" repetition "Readers might miss it" Trust your structure + TOC
Template bloat Same boilerplate in every section Extract to shared reference
Version accumulation "Old version" kept alongside new Delete old, keep only current
Multi-author overlap Two people write same section Coordinate ownership

Real-World Example

From the Acme Corp TDD:

Observation: The SP count "1,727" appears 20+ times throughout the document.

Assessment:

  • §2.5.2 is the authoritative source (full table with per-database breakdown)
  • Executive Summary references "1,727 SPs" with context
  • §6.4 Roadmap references "1,727" when calculating wave sizes
  • §3.2 Cost Framework uses "1,727" in effort calculation

Verdict: Acceptable duplication — each occurrence either:

  • References the source (§2.5.2)
  • Uses the number in a calculation specific to that section
  • Is in Executive Summary (intentional standalone)

Key insight: The number itself isn't the problem; uncontrolled divergence is. "1,727 SPs" is safe because it won't change. "⚠️ Partially covered" duplicated in 6 table rows was a problem because each needed individual updates.

Related Skills

  • 38_document_semantic_coherence.md — Coherence includes deduplication
  • 39_cross_reference_integrity.md — References replace duplicates
  • 04_idempotent_sql_design.md — Same principle: single source of truth

04 同仓库更多 Skills

CarlosCaPe
CarlosCaPe/octorato

yeet

Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).

★ 18
CarlosCaPe
CarlosCaPe/octorato

wrangler

Cloudflare Workers CLI for deploying, developing, and managing Workers, KV, R2, D1, Vectorize, Hyperdrive, Workers AI, Containers, Queues, Workflows, Pipelines, and Secrets Store. Load before running wrangler commands to ensure correct syntax and best practices. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

★ 18
CarlosCaPe
CarlosCaPe/octorato

workspace-skill-discovery

Discover and include ALL skills across the workspace — not just global ones. Use at the start of every session or when the user asks about available skills. Ensures project-level skills (under .claude/skills/ or skills/ in any repo) are never missed.

★ 18
CarlosCaPe
CarlosCaPe/octorato

workers-best-practices

Reviews and authors Cloudflare Workers code against production best practices. Load when writing new Workers, reviewing Worker code, configuring wrangler.jsonc, or checking for common Workers anti-patterns (streaming, floating promises, global state, secrets, bindings, observability). Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

★ 18
CarlosCaPe
CarlosCaPe/octorato

winui-app

Create, build and design WinUI 3 desktop apps with C# and the Windows App SDK following Microsoft's official guidance and CommunityToolkit. Covers XAML, navigation, theming, accessibility and deployment.

★ 18
CarlosCaPe
CarlosCaPe/octorato

windows-brain-script-portability

Scripts in ~/.claude/scripts/ that run on a Windows brain: use the python3.cmd shim and not bare python3, and reconfigure stdout to UTF-8 if you print symbols. Use it when writing a brain script or triaging a Windows-only crash.

★ 18