surgical-config

Modify structured configuration files deterministically with backups and validation.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/levonk/dotfiles --skill surgical-config
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: surgical-config
Source: https://github.com/levonk/dotfiles/tree/main/home/current/.chezmoitemplates/config/ai/skills/software-dev/surgical-config
Command: npx skills add https://github.com/levonk/dotfiles --skill surgical-config

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This skill provides deterministic, non-destructive configuration file modifications using a tiered tool hierarchy to avoid overwriting existing user settings across projects.

Core Features & Use Cases

  • Deterministic edits across structured files like devbox.json, Cargo.toml, and other project configs without overwriting user settings
  • Project-aware editing with automatic tool selection (surgical-edit.sh) and backups
  • Automatic mirroring backups and post-edit validation to ensure consistency
  • Reuse patterns and templates for multi-file edits while preserving formatting

Quick Start

  • Modify a Cargo.toml dependency: ./scripts/surgical-edit.sh Cargo.toml '.dependencies += {"serde": "1.0"}'
  • Add a package to devbox.json: ./scripts/surgical-edit.sh devbox.json '.packages += ["nodejs", "rust"]'
  • Run project-aware edits: ./scripts/surgical-edit.sh --detect-project package.json '.dependencies += {"lodash": "^4.17.21"}'

Frequently Asked Questions about surgical-config

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely modify Cargo.toml dependencies without overwriting existing settings?

To safely modify Cargo.toml dependencies without overwriting settings, use surgical-edit.sh to apply deterministic, non-destructive patches. It employs a semantic parser to target specific structures and automatically creates mirroring backups before applying changes to preserve existing configurations.

What is the best way to add packages to devbox.json without breaking formatting?

The best way to add packages to devbox.json while preserving formatting is using a structural rewriter tool. The surgical-edit.sh script applies targeted array insertions like adding nodejs packages and validates the file structure post-edit to ensure consistency.

Can I automate project-aware batch updates across multiple structured config files?

Yes, you can automate project-aware batch updates across structured config files. The surgical-edit.sh interface features a --detect-project flag that automatically identifies project types and selects appropriate tools to apply multi-file edits while reusing patterns and templates.

Does surgical config editing support JSON files like package.json alongside TOML formats?

Surgical config editing supports both JSON files like package.json and TOML formats such as Cargo.toml. It uses a tiered tool hierarchy with a semantic parser and safe fallbacks to handle diverse structured project configurations deterministically.

Why do my automated configuration edits keep failing validation?

Automated configuration edits fail validation when tools lack post-edit structural checks. Using a patch-based management approach with built-in validation ensures that modifications to files like devbox.json are syntactically correct and structurally consistent after every edit.