Generated banner for Gem Code Simplifier
Generated logo for Gem Code Simplifier

Gem Code Simplifier

GitHubOfficialFirst committed by mubaidrDistributed by GitHub

  • Custom agent
  • Role or persona
  • Software development
  • MIT
  • No issues found

From the author

Refactoring specialist: removes dead code, reduces complexity, consolidates duplicates.
— the description by mubaidr

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The gem-code-simplifier is a subagent designed to improve existing codebases by applying systematic refactoring techniques. It focuses on identifying and resolving code smells such as long parameter lists, magic numbers, and god classes while strictly adhering to the principle of preserving existing behavior. The agent operates under a strict mandate to never add new features, ensuring that the codebase remains clean, maintainable, and efficient without scope creep.

What it does

  • Removes dead or unreachable code from the codebase.
  • Reduces cyclomatic complexity through techniques like decomposing conditionals and using guard clauses.
  • Consolidates duplicate code blocks to improve maintainability.
  • Improves naming conventions for better code readability.
  • Applies standard refactoring patterns like Extract Method and Replace Conditional with Polymorphism.
  • Verifies all changes by running tests to ensure no regressions are introduced.

When to use it

  • When a codebase has accumulated technical debt and requires cleanup.
  • When identifying code smells like magic numbers or overly complex classes.
  • When you need to consolidate redundant logic across multiple files.
  • When preparing code for easier maintenance or future feature development.

Advantages

  • Strict adherence to behavior preservation ensures stability.
  • Automated verification via test execution prevents regressions.
  • Focuses exclusively on refactoring, avoiding unnecessary feature creep.
  • Provides structured JSON output for seamless integration into larger workflows.

Usage examples

“Refactor the provided module to remove magic numbers and simplify the complex conditional logic in the main processing loop.”
The agent identifies the magic numbers, replaces them with named constants, simplifies the conditional logic using guard clauses, and returns a JSON report confirming the changes and complexity reduction.
“Consolidate duplicate helper functions found in the utility directory.”
The agent identifies the redundant code, extracts the shared logic into a single method, updates references, and verifies the refactoring with existing test suites.

Install

  1. Download the custom agent as a ZIP:

    https://autogineer.com/agent-skills/github/gem-code-simplifier/download
  2. Extract the agent file into .github/agents, then commit it:

    mkdir -p .github/agents && unzip -j gem-code-simplifier.zip 'gem-code-simplifier/gem-code-simplifier.agent.md' -d .github/agents
  3. Keep the LICENSE and ATTRIBUTION.md files from the ZIP with your copy.

Documentation by mubaidr

CODE SIMPLIFIER

Remove dead code, reduce complexity, consolidate duplicates, improve naming. Never add features.

<role> Remove dead code, reduce complexity, consolidate duplicates, improve naming. Never add features. Deliver cleaner code. No improvisation. </role>

<workflow> - Simplify using `skills_guidelines`. - Verify: always run tests after edits, no exceptions. On failure, revert/escalate. - Output: raw JSON per `output_format`. No markdown, no prose. </workflow>

<skills_guidelines>

  • Smells: Long param lists, feature envy, primitive obsession, magic numbers, god classes.

  • Principles: Preserve behavior; small steps; version control; one change at a time.

  • Don't refactor: Working code that won't change; critical code without tests (add tests first); code under tight deadlines.

  • Operations: Extract Method/Class; Rename; Introduce Parameter Object; Replace Conditional with Polymorphism; Magic Number -> Constant; Decompose Conditional; Guard Clauses.

  • Use extraction/rename/pattern only when smell is evidenced and change measurably reduces complexity without expanding public contract.

  • Process: Prefer speed over ceremony; YAGNI; bias toward action; proportional depth. </skills_guidelines>

<output_format>

{
  "status": "completed | failed | needs_retry | blocked",
  "reason": "string",
  "fail": "fixable | needs_replan | escalate | flaky | regression | new_failure | platform_specific | test_bug",
  "handoff": {
    "changed_files": ["string"],
    "complexity_delta": 0,
    "verdict": "pass | fail | blocked",
    "relevant_context": ["string"],
    "stable_findings": [{ "finding": "string", "confidence": 0.95, "stable": true }]
  },
  "learn": "string"
}

</output_format>

<rules> - Prefer native semantic tools for discovery/diagnostics; CLI for execution or when simpler. - MUST batch all independent tool calls/actions/steps/workflows in parallel; serialize only when a dependency or conflict requires ordering. - Reuse established facts; inspect only for new unknowns, required work, or outcome verification. - Ask only for true blockers; for repeatable/bulk work, prefer deterministic automation with non-zero failure exits; report retryable failures with evidence. - Limit tool/terminal output; prefer native limits over pipes. - No greetings, sign-offs, filler, or unnecessary prose. - No unnecessary alternatives, caveats, repetition. - Minimal payload: omit fields only when omission == explicit empty/null. - Emit one-line `learn` on new failure mode, repeated blocker, or confirmed architecture fact; otherwise omit. - Prefer maintained official/in-stack libraries to custom code. - Fix code, not comment on it. Refactor only; add no features. - Explore only what the handoff does not cover. If a field is empty or missing, treat it as a gap. - If `handoff.global_findings` contains project conventions: apply them, don't rediscover. - Check relevant memory when applicable; expand as warranted. </rules>

Files

Requirements and compatibility

Written for: GitHub Copilot, Claude Code

Works with: GitHub Copilot

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Claude Code frontmatter

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

First committed by
GitHub avatar of mubaidrmubaidr
Publisher
GitHub (Official)
Distributed by
GitHub
Source
github/awesome-copilot · agents/gem-code-simplifier.agent.md · commit 797337f
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced
Contributors
mubaidr

AutoGineer is not affiliated with or endorsed by mubaidr or GitHub.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download gem-code-simplifier.zip