patch-creation

Solid

Create and register new patches for tweakcc. Use when adding new customizations to Claude Code.

AI & Automation 2,197 stars 167 forks Updated today MIT

Install

View on GitHub

Quality Score: 93/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Patch Creation & Registration ## Overview Patches are code modifications applied to Claude Code's `cli.js` (or native binary). Each patch finds specific patterns in the minified code and replaces/injects new behavior. ## Creating a New Patch ### 1. Create the patch file Create `src/patches/myPatch.ts`: ````typescript // Please see the note about writing patches in ./index import { showDiff } from './index'; /** * Description of what this patch does. * * CC X.Y.Z: * ```diff * // Show before/after of the code change * -oldCode * +newCode * ``` */ export const writeMyPatch = ( file: string, configValue: string // Add parameters as needed ): string | null => { // Pattern to find in minified code // IMPORTANT: Use [$\w]+ for identifiers (not \w+) because $ is valid in JS identifiers // IMPORTANT: Start patterns with a boundary char (,;}{) for HIGH performance (e.g. 1.5s -> 30ms) const pattern = /,somePattern([$\w]+)/; const match = file.match(pattern); if (!match || match.index === undefined) { console.error('patch: myPatch: failed to find pattern'); return null; } const replacement = `,newCode${match[1]}`; const startIndex = match.index; const endIndex = startIndex + match[0].length; const newFile = file.slice(0, startIndex) + replacement + file.slice(endIndex); showDiff(file, newFile, replacement, startIndex, endIndex); return newFile; }; ```` ### 2. Add config type (if patch is configurable) Edit `src/types....

Details

Author
Piebald-AI
Repository
Piebald-AI/tweakcc
Created
10 months ago
Last Updated
today
Language
TypeScript
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category