code-edit-quality

SEARCH/REPLACE block patterns for precise code edits. Based on Cline's edit methodology for accurate file modifications.

7 stars

Best use case

code-edit-quality is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

SEARCH/REPLACE block patterns for precise code edits. Based on Cline's edit methodology for accurate file modifications.

Teams using code-edit-quality should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/code-edit-quality/SKILL.md --create-dirs "https://raw.githubusercontent.com/fratilanico/apex-os-bad-boy/main/code-edit-quality/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/code-edit-quality/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How code-edit-quality Compares

Feature / Agentcode-edit-qualityStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

SEARCH/REPLACE block patterns for precise code edits. Based on Cline's edit methodology for accurate file modifications.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Code Edit Quality

Master the art of precise code modifications using SEARCH/REPLACE blocks.

---

## 1. Minimal SEARCH Block

Only include changing lines plus 2-3 context lines for uniqueness.

```
# Wrong - Too much unchanged code
<<<<<<< SEARCH
function calculateTotal(items) {
  let total = 0;
  for (let i = 0; i < items.length; i++) {
    total += items[i].price;
  }
  return total;
}

function formatCurrency(amount) {
  return `$${amount.toFixed(2)}`;
}
=======
function calculateTotal(items) {
  return items.reduce((sum, item) => sum + item.price, 0);
}

function formatCurrency(amount) {
  return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(amount);
}
>>>>>>> REPLACE

# Right - Minimal SEARCH block
<<<<<<< SEARCH
function calculateTotal(items) {
  let total = 0;
  for (let i = 0; i < items.length; i++) {
    total += items[i].price;
  }
  return total;
}
=======
function calculateTotal(items) {
  return items.reduce((sum, item) => sum + item.price, 0);
}
>>>>>>> REPLACE
```

---

## 2. Unique Match Verification

Confirm SEARCH matches exactly one location before applying.

```
# Verify uniqueness with grep first
grep -n "function calculateTotal" src/

# Then use unique SEARCH block
<<<<<<< SEARCH
function calculateTotal(items) {
  let total = 0;
=======
function calculateTotal(items) {
  return items.reduce((sum, item) => sum + item.price, 0);
}
>>>>>>> REPLACE
```

---

## 3. Multi-Block Ordering

List SEARCH/REPLACE blocks in file order for sequential changes.

```
# File order: top to bottom
<<<<<<< SEARCH
const API_URL = 'http://localhost:3000';
=======
const API_URL = process.env.API_URL || 'http://localhost:3000';
>>>>>>> REPLACE

<<<<<<< SEARCH
function fetchUser(id) {
  return fetch(`/api/users/${id}`);
}
=======
async function fetchUser(id) {
  const response = await fetch(`/api/users/${id}`);
  return response.json();
}
>>>>>>> REPLACE
```

---

## 4. Whitespace Sensitivity

Preserve exact indentation - spaces and tabs matter.

```
# Wrong - Wrong indentation
<<<<<<< SEARCH
function hello() {
console.log('hello');
}
=======
function hello() {
    console.log('hello');
}
>>>>>>> REPLACE

# Right - Exact whitespace match
<<<<<<< SEARCH
function hello() {
console.log('hello');
}
=======
function hello() {
  console.log('hello');
}
>>>>>>> REPLACE
```

---

## 5. Line Completeness

Never truncate lines mid-way - include complete line content.

```
# Wrong - Truncated line
<<<<<<< SEARCH
const users = await db.query('SELECT * FROM users WHERE
=======
const users = await db.query('SELECT * FROM users WHERE active = true');
>>>>>>> REPLACE

# Right - Complete lines
<<<<<<< SEARCH
const users = await db.query('SELECT * FROM users WHERE active = true');
=======
const users = await db.query('SELECT * FROM users WHERE active = $1', [true]);
>>>>>>> REPLACE
```

---

## 6. Comment Preservation

Keep existing comments in replacements - they're part of the code's context.

```
# Wrong - Removed comment
<<<<<<< SEARCH
// Calculate total price
function calculateTotal(items) {
=======
function calculateTotal(items) {
>>>>>>> REPLACE

# Right - Preserve comments
<<<<<<< SEARCH
// Calculate total price including tax
function calculateTotal(items) {
=======
// Calculate total price including tax
function calculateTotal(items) {
>>>>>>> REPLACE
```

---

## 7. Move Operation: Delete + Insert

Use two SEARCH/REPLACE blocks for moving code - delete then insert.

```
# Step 1: Delete from original location
<<<<<<< SEARCH
function oldUtility() {
  // deprecated
}
=======
>>>>>>> REPLACE

# Step 2: Insert at new location
<<<<<<< SEARCH
function processData() {
=======
function processData() {

function oldUtility() {
  // deprecated
}
>>>>>>> REPLACE
```

---

## 8. Empty Replace for Deletions

Use empty REPLACE section to remove code.

```
# Delete unused import
<<<<<<< SEARCH
import { unusedFunction } from './utils';
=======
>>>>>>> REPLACE

# Delete entire function
<<<<<<< SEARCH
function unusedHelper() {
  return 'not used';
}
=======
>>>>>>> REPLACE
```

---

## 9. Conflict Resolution

For overlapping edits, refactor into non-overlapping blocks.

```
# Problem: Two edits overlap
# Edit 1 changes lines 5-10
# Edit 2 changes lines 8-15 (overlaps!)

# Solution: Consolidate into single SEARCH/REPLACE
<<<<<<< SEARCH
function processUser(input) {
  const name = input.name;
  const email = input.email;
  return { name, email };
}

function validateEmail(email) {
  return email.includes('@');
}
=======
async function processUser(input) {
  const name = input.name?.trim();
  const email = input.email?.trim().toLowerCase();
  
  if (!validateEmail(email)) {
    throw new Error('Invalid email');
  }
  
  return { name, email };
}

function validateEmail(email) {
  return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
}
>>>>>>> REPLACE
```

---

## 10. Preview Before Apply

Verify changes match expected pattern before committing.

```
# Before applying, verify:
# 1. SEARCH matches exactly one location
grep -c "exact search string" file.ts
# Should return 1

# 2. Read the file to confirm context
read -l 10:20 file.ts

# 3. Compare SEARCH content matches file exactly
# Then apply SEARCH/REPLACE
```

---

## Quick Reference

| Operation | Pattern |
|-----------|---------|
| Replace | `SEARCH` + `REPLACE` |
| Delete | `SEARCH` + empty `REPLACE` |
| Move | Delete + Insert (two blocks) |
| Multiple | Multiple SEARCH/REPLACE blocks in file order |

Related Skills

writing-plans

7
from fratilanico/apex-os-bad-boy

Use when you have a spec or requirements for a multi-step task, before touching code

webtricks-tier-pricing-ui

7
from fratilanico/apex-os-bad-boy

Build interactive tier-based pricing UI with lock/unlock states, progressive disclosure, and cross-slide consistency. Use when building pricing pages, tier selectors, or feature comparison grids. Tags: webtricks, pricing, tiers, SaaS.

webtricks-browser-qa-audit

7
from fratilanico/apex-os-bad-boy

Audit live websites using Playwright MCP for browser-based QA. Covers accessibility snapshots, screenshot verification, interactive element testing, and tier differentiation audits. Use after deploying web changes to verify they work. Tags: webtricks, QA, testing, playwright, audit.

webtricks-animated-pipeline

7
from fratilanico/apex-os-bad-boy

Build animated data flow pipelines with SVG circuits, traveling dots, and ambient animations using Framer Motion + SVG. Use when visualizing architecture, workflows, API pipelines, or any step-by-step data flow. Tags: webtricks, animation, pipeline, SVG, architecture.

web-design-guidelines

7
from fratilanico/apex-os-bad-boy

Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".

verification-before-completion

7
from fratilanico/apex-os-bad-boy

Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always

vercel-react-native-skills

7
from fratilanico/apex-os-bad-boy

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

vercel-react-best-practices

7
from fratilanico/apex-os-bad-boy

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

vercel-composition-patterns

7
from fratilanico/apex-os-bad-boy

React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.

ui-ux-pro-max

7
from fratilanico/apex-os-bad-boy

UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 9 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient. Integrations: shadcn/ui MCP for component search and examples.

tool-definition-patterns

7
from fratilanico/apex-os-bad-boy

Standards for defining AI agent tools based on Cline's system prompt patterns. Covers parameter typing, documentation, edit formats, safety mechanisms, and operational best practices.

test-driven-development

7
from fratilanico/apex-os-bad-boy

Use when implementing any feature or bugfix, before writing implementation code