Bỏ qua tới nội dung
TakoAPI
Quay lại kỹ năng

json-modifier

bởi wanng-ide

Notes & PKM
455Lượt tải do clawskills.sh công bố
0Lượt xem
0 lượt thíchĐăng nhập để thích kỹ năng này
—Chưa có đánh giá
Đánh giá của bạn

Tóm tắt

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

Mô tả

Kỹ năng này làm gì

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.

Khi nào nên dùng

  • 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

Quy trình ví dụ

ĐẦU VÀO

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

AGENT
  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

ĐẦU RA

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

Cài đặt

clawhub install wanng-ide/json-modifier

Chạy lệnh CLI, hoặc dán prompt vào Claude Code, Cursor, Codex hay coding agent bạn đang dùng.

Liên kết