본문으로 건너뛰기
cccskills
무료GitHub에 공개

batch-rewrite-pattern

Cascade the same edit pattern across N files safely. Use when applying the same refactor to multiple files (e.g. swap import paths across 11 scripts, rename a symbol, migrate a call signature). Detects the common-shape-across-files situation and turns an N-file cascade into a planned audit → apply → verify workflow instead of N sequential manual edits.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md3.9 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Batch Rewrite Pattern

When the same edit needs to land in N files, the worst shape is N sequential manual passes. Each pass collects its own errors; the hook system retriggers; context fills with repetitive diffs. This skill captures the better shape.

Triggers

Activate when any of these apply:

  • Renaming a symbol across the tree
  • Migrating a function signature (add/remove/reorder args)
  • Swapping an import path across modules
  • Converting between two patterns (callbacks ↔ promises, v1 ↔ v2 API)
  • Any edit where you can describe the transformation as "in every file matching pattern X, replace Y with Z"

Typical count trigger: ≥ 4 files warrant the batch shape.

Workflow

  1. Characterize the transformation in one paragraph:

    • What's the before pattern? (regex or literal)
    • What's the after pattern?
    • Are there variants? (single pattern vs family of patterns)
    • Any files that should be exempt?
  2. Enumerate candidates with Grep/Glob:

    Grep pattern=BEFORE output=files_with_matches
    
  3. Dry-run the rewrite against 1-2 candidates first. Verify:

    • The transformation is correct
    • Surrounding context isn't disturbed
    • No collateral damage
  4. Apply in a batch — prefer a single Bash sed/perl invocation or a small rewrite script over N sequential Edit calls:

    for f in $(grep -l 'BEFORE' src/**/*.ts); do
      sed -i -e 's/BEFORE/AFTER/g' "$f"
    done
    

    Or write a one-shot node script that reads each file, applies the transformation, writes back.

  5. Verify with the test suite if one exists, or with a grep that the after-pattern is uniformly present and the before-pattern is gone.

  6. Single commit covering the whole cascade, scope line listing files.

Anti-patterns to avoid

  • Sequential manual Edit calls when the transformation is deterministic. Each Edit triggers hook re-reads and bloats context.
  • Partial cascades — leaving some files on the old pattern because you got interrupted halfway. Either all or none; use git stash to revert if the cascade was wrong.
  • Branching transformations without a plan — when "most files" follow one pattern but a few need a variant, enumerate the variants first and handle each as its own batch.

Example — Config Adapter Cascade (v1.49 release-history work)

Situation: 11 scripts in tools/release-history/ each had a direct pg.Client instantiation and hardcoded paths. Needed to convert all 11 to use loadConfig() + openDb(cfg).

Right shape:

  1. Wrote the adapter (db.mjs) once
  2. Characterized the transform: replace new pg.Client({...}) block with await openDb(cfg); replace hardcoded paths with cfg.*_abs
  3. Applied to each file in one Bash loop or parallel sed invocation
  4. One commit

Wrong shape (what actually happened): 11 sequential Read-plus-Edit cycles, 35+ read-before-edit hook fires, recursive pattern-matching at each step.

The lesson: when you feel yourself about to do the same edit for the fourth time, stop and batch the rest.

Companion Tools

  • Grep with output_mode: files_with_matches to enumerate candidates
  • Bash with sed -i or a small rewrite script for the cascade
  • Grep again to verify the before-pattern is gone and after-pattern is uniformly present

Related

  • file-operation-patterns — safe bulk file operations
  • decision-framework-invoker — use when the batch is irreversible

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Provides web accessibility best practices for semantic HTML, ARIA, keyboard navigation, color contrast, and screen reader patterns. Use when building UI components, reviewing accessibility, or when user mentions 'a11y', 'accessibility', 'ARIA', 'screen reader', 'keyboard navigation', 'WCAG'.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Tibsfox/gsd-skill-creator712026년 7월 20일 업데이트

Active listening techniques for effective communication. Covers attending behaviors, paraphrasing, reflective listening, clarifying questions, empathic response, barriers to listening, listening in conflict, and cross-cultural listening. Use when building listening skills, improving understanding in conversation, mediating disputes, or analyzing communication breakdowns.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Tibsfox/gsd-skill-creator712026년 7월 20일 업데이트

Adversarial spec-compliance PR review — cross-references diffs against approved specs, verifies runtime claims against source, detects competing PRs, audits scope/convention compliance. Use before merging.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Tibsfox/gsd-skill-creator712026년 7월 20일 업데이트

Provides best practices for AI agent orchestration including MCP servers, A2A protocol, multi-agent coordination, and swarm architectures. Use when designing agent systems, configuring MCP servers, setting up agent teams, or when user mentions 'MCP', 'A2A', 'agent orchestration', 'multi-agent', 'swarm', 'agent team', 'LangGraph', 'CrewAI', 'AutoGen'.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Tibsfox/gsd-skill-creator712026년 7월 20일 업데이트

Symbolic manipulation, equation solving, and algebraic structures for mathematical reasoning. Covers distributive law, factoring, completing the square, linear through polynomial equation solving, systems of equations (substitution, elimination, Gaussian elimination, matrix methods), algebraic structures (groups, rings, fields), modular arithmetic, polynomial theory, and inequalities. Use when solving equations, simplifying expressions, working with algebraic structures, or performing symbolic manipulation.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Tibsfox/gsd-skill-creator712026년 7월 20일 업데이트

Understanding how algorithmic systems shape what users see, know, and do -- from recommendation feeds to search ranking to credit scoring to hiring software. Covers the mechanics of recommendation systems, algorithmic bias and its sources, personalization's effects on information diets, opacity and accountability, AI limitations (hallucination, confident wrongness), and the human-in-the-loop question. Use when a learner needs to think critically about why particular content reached them.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Tibsfox/gsd-skill-creator712026년 7월 20일 업데이트

Tibsfox의 스킬 모두 보기

이 스킬의 문제 신고