Skip to content

Instantly share code, notes, and snippets.

@Nishkalkashyap
Created March 7, 2026 13:10
Show Gist options
  • Select an option

  • Save Nishkalkashyap/3f8f012c3d62d9bfcb747582338b508a to your computer and use it in GitHub Desktop.

Select an option

Save Nishkalkashyap/3f8f012c3d62d9bfcb747582338b508a to your computer and use it in GitHub Desktop.
name git-change-simplifier
description Review local Git changes and simplify newly added code while preserving behavior. Use when asked to clean up a working tree diff before commit or PR by removing unnecessary type aliases, thin abstractions, one-time constants, unused exports, unused public service methods, duplicated helpers, and non-essential or outdated implementations.

Git Change Simplifier

Overview

Simplify only code introduced or changed in the local diff. Preserve behavior, keep edits small, and favor deletion over abstraction.

Workflow

  1. Inspect scope with git status --short and git diff.
  2. Focus review on added or modified lines and dependent call sites.
  3. Apply simplification rules in order.
  4. Run targeted checks (pnpm test, pnpm lint, tsc, or project-specific tests) for touched areas.
  5. Summarize what was removed, what was consolidated, and why behavior is unchanged.

Simplification Rules

  1. Remove unnecessary type aliases. Replace aliases that only restate an obvious inline type or are used once.

  2. Remove thin abstractions. Inline wrappers that only pass through arguments, rename values, or forward one call without meaningful policy.

  3. Remove one-time constants. Inline constants used once when they do not improve readability or reuse.

  4. Remove unused exports. Delete exports not referenced by the repository, then keep symbols non-exported where needed internally.

  5. Remove unused public service methods. If a service method is not used externally, mark it private and rename it with a leading underscore (for example, buildPayload -> _buildPayload) when it is only used inside the class.

  6. Reuse existing utilities. Search before adding helpers; prefer existing utilities and shared primitives over new local duplicates.

  7. Eliminate non-essential or outdated code. Remove fallback paths, legacy branches, speculative helpers, and "nice-to-have" logic that does not support current requirements.

Guardrails

  • Preserve runtime behavior and public APIs unless the diff itself is introducing the API.
  • Confirm a symbol is truly unused with repository-wide search before deleting it.
  • Avoid unrelated refactors outside the local diff.
  • Prefer simple expressions and direct data flow over indirection.
  • Keep naming literal and descriptive after inlining or consolidation.

Expected Output

  • Provide a concise change summary grouped by file.
  • List each removed abstraction/alias/export/method.
  • Report validation commands that were run and any remaining risk.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment