AI Agent Hub
Back to skills
Knowledge Safe Merge icon

Knowledge Safe Merge

Knowledge Management Updated 2026.08.29

Paste the following prompt into your AI chat to install this skill:

Please install @user_87a42d61/knowledge-safe-merge using https://skillhub.cn/install/skillhub.md

About this skill

Problem

Knowledge-base sites often need to merge a new batch of article JSON into content/articles, but production data may already contain historical articles, mirror files, export snapshots, and test fixtures. Replacing the file wholesale can silently delete old articles, especially when the incoming JSON is only incremental, missing fields, or has unstable id values.

How It Works

The skill turns “safe merging” into an operational workflow: identify the authoritative data source first, then distinguish incoming files from mirrors and backups; validate that the structure contains an articles array and key article fields such as title, content, and a stable id. Matching defaults to id first, falls back to title + date when ids differ, appends unmatched articles as new entries, and sorts the result by date descending and then id. Before writing, it performs a dry-run that reports added, updated, unchanged, and final counts. It creates a rollback backup before production writes and can sync mirror files when needed. If the project already has import scripts or data pipelines, it prefers reusing them instead of forcing a generic script.

Boundaries

This fits article-shaped JSON knowledge bases, legacy-site migration, incremental imports, and pre-deployment dry runs. It is not a substitute for schema mapping when the source structure is very different: if the root is not a JSON object, articles is absent, key fields are missing, or id is unreliable, adapt the data first. For live sites, validation should confirm not only that new articles exist but also that the JSON endpoint, rendered pages, and old articles remain intact.

Use Cases

  • Merge new article JSON without deleting old posts.
  • Run dry-run before production import of knowledge JSON.
  • Migrate legacy article JSON into new site safely.
  • Create a rollback-safe JSON import SOP for site data.

Best For

  • Site engineer: merge article JSON without losing old posts.
  • Knowledge platform dev: import snapshot after dry-run.
  • Frontend ops: migrate article JSON and validate site.
  • Pipeline dev: need rollback-safe JSON import SOP.