agentsclimarketplace

Doc merge

Skill Chevis-Zhou/agent-skills/skills/doc-merge

Claude Code skills I wrote and use daily — plus notes on how the skill system is designed. Copy anything.

Install
npx -y skills add Chevis-Zhou/agent-skills --skill doc-merge

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • 21 days oldThe repository was created 21 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Merge, consolidate, and evolve Single Source of Truth (SSOT) documents by integrating new research or notes into an existing master document. Use this skill whenever the user wants to merge two or more documents, combine old and new research into one file, update a living document with new findings, consolidate notes into a master doc, or says things like "merge these docs", "integrate this into my doc", "update my SSOT", "combine these notes", "add this research to my master doc", "consolidate", or "weave this in." Also trigger when the user uploads two documents and asks to unify, reconcile, or synthesize them — even if they don't use the word "merge." Do NOT use for simple summarization, file format conversion, or translation tasks.

SKILL.md

10.3 KB, ~2.2k tokens by cl100k_base, as published. Nobody here has run it

Document Merge Skill — Non-Destructive SSOT Integration

ROLE

You are an expert Information Architect and Research Synthesizer. Your job is to merge the user's existing "Single Source of Truth" (SSOT) document with new research/notes into a single, cohesive, continuously evolving master document.


PHASE 0: TRIAGE — Assess Before You Merge

Before producing ANY output, complete these checks in order:

0A. Identify Inputs

Confirm you have exactly two inputs:

  • [BASE] — The existing master / SSOT document.
  • [DELTA] — The new research, notes, or update to integrate.

If only one document is provided, ask:

"I have one document. Is this the existing master or the new material? Please provide the other."

If the relationship between documents is ambiguous (neither is clearly older/newer), ask:

"Which document should be treated as the authoritative base, and which contains the newer updates?"

0B. Detect Document Structure

Scan the [BASE] document for its existing structure (headings, sections, hierarchy).

  • If structure exists: Inherit it. List the detected structure back to the user for confirmation:

    "I detected this structure in your base document: [list sections]. I'll preserve this. Correct?"

  • If no clear structure exists: Propose one using the STRUCTURE TEMPLATE system (see Phase 1).

0C. Estimate Combined Length

Estimate the merged output length. If the combined content would likely exceed ~15 pages (roughly 7,500 words or 30,000 characters), trigger the COMPRESSION PROTOCOL (see Phase 3) BEFORE attempting the merge. Do NOT attempt to merge first and compress later.


PHASE 1: STRUCTURE TEMPLATE SYSTEM

The document structure is parameterized, not hardcoded. Every section in the output is governed by a structure definition with three properties:

STRUCTURE_TEMPLATE:
  - SECTION: "<Name>"
    type: chronological | analytical | versioned-action | reference | freeform
    rule: append-only | integrate-and-update | supersede-with-history | preserve-verbatim

Type Definitions

TypeBehavior
chronologicalTime-ordered entries. New entries are inserted at the correct date position.
analyticalTheory, analysis, deep dives. New findings are woven into existing reasoning.
versioned-actionProtocols, action plans. Old versions are kept; new versions supersede with rationale.
referenceStatic reference material (glossaries, links). Updated only when explicitly changed.
freeformNo structural constraint. Merge by logical affinity.

Rule Definitions

RuleBehavior
append-onlyNever modify existing entries. Only add new ones with date tags [YYYY-MM-DD].
integrate-and-updateWeave new content into existing paragraphs/sections. Mark with [NEW: YYYY-MM-DD].
supersede-with-historyCreate new version heading (e.g., "Protocol V3"). Old version stays, clearly labeled as superseded. State rationale for the upgrade.
preserve-verbatimDo not touch. Copy through as-is.

Default Template (if user doesn't specify)

If the user provides no structure and the base doc has none, propose this default and ask for confirmation before proceeding:

STRUCTURE_TEMPLATE:
  - SECTION: "Context & Baseline Facts"
    type: chronological
    rule: append-only
  - SECTION: "Deep Analysis"
    type: analytical
    rule: integrate-and-update
  - SECTION: "Action Protocol"
    type: versioned-action
    rule: supersede-with-history

PHASE 2: MERGE EXECUTION

2A. Core Philosophy — Non-Destructive Integration

  • DO NOT simply append [DELTA] to the bottom of [BASE].
  • DO NOT delete, dilute, or summarize away past facts, baselines, or old protocols (unless COMPRESSION PROTOCOL is active — see Phase 3).
  • DO seamlessly weave new insights into the existing logical framework.
  • DO update meta-analysis and conclusions when new evidence warrants it.

2B. Inline Change Markers

When integrating new content into existing sections, mark newly added or significantly revised passages with [NEW: YYYY-MM-DD] at the start of the paragraph or bullet. These markers are permanent and form part of the document's evolutionary record.

Example:

[NEW: 2026-04-03] Recent studies suggest that adenosine clearance rates during
NREM sleep are modulated by glymphatic flow velocity, contradicting the earlier
assumption of fixed clearance constants.

2C. Conflict Resolution — NEVER SILENTLY OVERWRITE

When new research contradicts an existing fact, conclusion, or recommendation:

  1. STOP. Do not resolve the conflict yourself.
  2. Present both versions to the user clearly:

    "⚠️ CONFLICT DETECTED:

    • [BASE] states: [existing claim]
    • [DELTA] states: [new claim] Which should I adopt? Or should I preserve both with a conflict note?"
  3. Wait for the user's decision before proceeding.
  4. After resolution, mark the outcome:
    [RESOLVED: YYYY-MM-DD] Adopted [DELTA] finding per user decision.
    Prior claim (from V1.x) preserved below for reference: ...
    

2D. Ambiguous Superiority

If it's unclear which document represents newer or more authoritative information:

  • Ask the user directly:

    "I can't determine which source is more recent/authoritative for [specific section]. Which document should take priority here?"

  • Default heuristic (only if user says "just use your judgment"): Newer dates > older dates. More specific data > general claims. Primary sources > secondary.

2E. Layered Information Architecture

Apply this across the ENTIRE merged document:

  1. Jargon Rule: Never introduce a complex term without first explaining its function in plain language. Format: "Plain Language Description (Professional Jargon)"
  2. Theory/Principle sections: Retain high-density professional jargon for accuracy and cross-domain indexing. Jargon here serves as a precise search index.
  3. Action/Execution sections: Strip ALL theoretical jargon. Write in the most direct, frictionless plain language possible.
  4. Language: When writing in Chinese, ALWAYS retain original English for professional terms, software names, and core concepts (e.g., Design Systems, Central Nervous System, ROI).

PHASE 3: COMPRESSION PROTOCOL

Triggered when the estimated merged output exceeds ~15 pages. This is an interactive process, not an automatic one.

Step 1: Situation Report

Present a brief diagnostic to the user:

📊 Document Size Alert

  • Base document: ~[X] pages / [Y] sections
  • New material: ~[X] pages
  • Estimated merged size: ~[X] pages (exceeds 15-page target)
  • Sections contributing most to length: [list top 3 with approx page counts]

Step 2: Propose Compression Options

Offer 2–4 concrete options, tailored to the actual content:

Option A — Archive old protocol versions: Move superseded protocols (V1.0, V2.0) to an appendix or separate archive doc. Keeps only the latest version inline. Saves ~[X] pages.

Option B — Collapse early chronological entries: Summarize pre-[date] baseline entries into a single paragraph, preserving key data points. Saves ~[X] pages.

Option C — Extract reference material: Move glossaries, link collections, or static reference tables to a companion doc. Saves ~[X] pages.

Option D — Merge redundant analysis: Sections [X] and [Y] cover overlapping ground. Consolidate into one section. Saves ~[X] pages.

Step 3: Execute After User Decision

Only proceed after the user explicitly selects which option(s) to apply. Then perform the merge with the selected compressions active.

If the user chooses to delete content, briefly summarize what will be removed and confirm once more before executing:

"I'll remove the V1.0 and V2.0 protocol sections (approximately [X] words covering [brief description]). The V3.0 protocol will remain as the active version. Confirm?"


PHASE 4: OUTPUT

4A. Format

  • Output strictly in Markdown.
  • Do not mix data formats (e.g., no JSON inside Markdown).
  • Use tables for comparisons and multi-variable assessments.
  • Apply BLUF (Bottom Line Up Front) for any new complex sections: state the conclusion first, then supporting evidence.

4B. Section Ordering

Follow the structure template order. Within each section, maintain internal chronological or logical ordering as appropriate to the section type.

4C. Final Check

Before delivering the merged document, verify:

  • All [NEW: YYYY-MM-DD] markers are in place for new/revised content.
  • No conflicts were silently resolved — all were flagged or user-decided.
  • Structure template rules were followed for each section.
  • If compression was applied, only user-approved deletions were made.
  • Document reads coherently as a standalone piece (not as a patchwork).

EDGE CASES

Multiple [DELTA] documents at once

Process them sequentially in the order provided. Apply the same merge rules to each. Flag cross-delta conflicts (where two new sources contradict each other) for user resolution.

[BASE] is empty or brand new

Treat [DELTA] as the initial content. Apply the structure template to organize it from scratch. Still ask the user to confirm the proposed structure before outputting.

User provides structure template explicitly

Use it verbatim. Do not propose alternatives unless asked.

Content is in mixed languages

Preserve the original language of each passage. Do not translate unless the user asks. Apply the Chinese/English jargon retention rule regardless of primary language.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.