surgical-injector

Plan and execute code injections with feature toggles and fallbacks.

Updated Dec 30, 2025
One-click install
npx skills add https://github.com/Jonely235/claude-skills --skill surgical-injector
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: surgical-injector
Source: https://github.com/Jonely235/claude-skills/tree/main/surgical-injector
Command: npx skills add https://github.com/Jonely235/claude-skills --skill surgical-injector

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Surgical-injector provides a safe pattern to introduce new code into legacy systems without downtime by isolating the new logic behind a feature toggle and providing a guarded path that falls back to the existing behavior.

Core Features & Use Cases

  • Feature toggle architecture to enable or disable new logic without touching the old code
  • Guarded execution with try-catch (or equivalent) to preserve behavior on failure
  • Clear surgery documentation, monitoring hooks, and rollback guidance for safe deployments
  • Use Case: safely refactor a critical function or gradually roll out a new feature in a legacy project

Quick Start

Enable the surgical pattern by wrapping the target function with a toggle and a guarded path to old behavior.

Frequently Asked Questions about surgical-injector

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

FAQPage Schema
How do I safely refactor legacy code without downtime?

To safely refactor legacy code without downtime, you isolate new logic behind a feature toggle and use a guarded execution path that automatically falls back to the old behavior if a failure occurs.

What is a surgical injection pattern for legacy systems?

A surgical injection pattern introduces new code into legacy systems by isolating the new logic behind a feature toggle, wrapping it in guard logic, and providing a fallback to the old behavior.

Can I use feature toggles for gradual rollouts in a legacy application?

Yes, you can use feature toggles for gradual rollouts in a legacy application by enabling or disabling the new logic without touching the old code, supported by monitoring hooks and rollback guidance.

What's the best way to add error handling to a critical path refactor?

The best way to add error handling to a critical path refactor is applying a structured surgery pattern with try-catch guards that preserve the original behavior on failure.

When should I not use surgical injection for code updates?

You should avoid surgical injection when you cannot isolate the new code path or when your legacy system lacks the monitoring hooks required to safely guard the execution and trigger fallback behavior.