跳到正文
TakoAPI
返回技能列表

json-modifier

由 wanng-ide 提供

Notes & PKM
455下载量由 clawskills.sh 提供
0浏览量
0 个赞登录后即可为这个技能点赞
—暂无评分
你的评分

简介

Safely apply structured JSON patches (RFC 6902) to files.

描述

该技能的功能

Applies structured JSON patches in RFC 6902 format to files without rewriting them. Supports add, remove, replace, move, copy, and test operations. Writes atomically to prevent data corruption and preserves indentation.

Avoids brittle regex and full-file rewrites by applying targeted, validated patches that leave the rest of the document unchanged.

何时使用

  • Bumping version numbers in package.json
  • Adding feature flags to a config file
  • Removing deprecated keys from API response configs
  • Appending items to arrays in settings files
  • Updating nested values in multi-environment config files

示例工作流

输入

User asks: update the version field in package.json from 1.0.0 to 2.0.0

智能体
  1. 1

    Identify the target file: package.json

  2. 2

    Construct an RFC 6902 patch: [{"op": "replace", "path": "/version", "value": "2.0.0"}]

  3. 3

    Run: node skills/json-modifier/index.js --file package.json --patch '[{"op": "replace", "path": "/version", "value": "2.0.0"}]'

  4. 4

    Confirm patch validates and applies without error

输出

package.json updated with version set to 2.0.0, original indentation preserved

安装

clawhub install wanng-ide/json-modifier

运行 CLI 命令,或把这段提示词粘贴到 Claude Code、Cursor、Codex 或你在用的任意编程智能体里。

链接