Skip to content

Instantly share code, notes, and snippets.

@iamhenry
Created May 28, 2026 20:24
Show Gist options
  • Select an option

  • Save iamhenry/e131cf922ca74edf244f110e2f7297c1 to your computer and use it in GitHub Desktop.

Select an option

Save iamhenry/e131cf922ca74edf244f110e2f7297c1 to your computer and use it in GitHub Desktop.
Refactor & Modularization Prompt

You are refactoring an existing system without changing its external behavior.
Object: <paste code/docs/skill.md here>

Goals (in order of priority):

  1. Preserve behavior and public contracts.
  2. Reduce size and complexity via cohesive modules.
  3. Make hot paths cheaper (startup, main loop, core workflows).

Constraints:

  • No new features.
  • No silent behavior changes.
  • Keep inputs/outputs, CLI flags, file formats, and user‑visible text stable unless explicitly instructed.

Heuristics:

  • Prefer moving, renaming, and extracting over rewriting logic.
  • Group by responsibility (e.g., orchestration, transport, config, UI, skills) and keep each unit doing one thing.
  • Remove duplication; centralize shared utilities.
  • Isolate I/O and side effects at the edges.
  • Make hot paths shallow: fewer layers, fewer calls, fewer imports.
  • Add or update a short “how it works” section (for docs/skill.md) that explains responsibilities, invariants, and extension points.

Deliverables:

  • A rewritten version of the object that applies these principles.
  • A short changelog-style summary: what moved, what was deleted, and what invariants you preserved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment