Skip to main content
subagent GitHub Copilot official · GitHub

gem-code-simplifier — GitHub Copilot subagent: what it does

A refactoring subagent that removes dead code and drops complexity. Handy when cleaning up messy logic without altering existing behavior.

Install into GitHub Copilot · Manually: put the files in place All methods and platforms ↓
.github/agents/gem-code-simplifier.agent.md
Open on GitHub

What gem-code-simplifier does

The subagent focuses entirely on code simplification. It tackles code smells like primitive obsession or god classes. It extracts methods and adds guard clauses without altering public interfaces. It never introduces new features.

Safety relies on tests. After every edit, the subagent runs the test suite. If tests fail, it reverts or escalates immediately. Its output is raw JSON containing change metrics and status fields, skipping markdown chatter.

Do not run this on critical modules lacking automated tests. It fits repositories that need systematic cleanup while preserving strict backwards compatibility.

What it helps with

  • Remove dead and unreachable code
  • Reduce cyclomatic complexity in large functions
  • Consolidate duplicate code fragments
  • Replace magic numbers with named constants
  • Decompose complex conditional statements

Example prompts for the agent

  • Run gem-code-simplifier on auth service to drop complexity and run tests
  • Simplify the payment controller: extract methods and eliminate duplicate checks
  • Remove dead code in legacy utils and verify with the existing test suite

How to install gem-code-simplifier

Manually: put the files in place

.github/agents/gem-code-simplifier.agent.md

From the same set554

The whole set →
git-commit official github This skill reviews Git changes, stages related files, and creates Conventional Commits. Use it when you want an agent to make one commit or split work into separate commits. GitHub Copilot 47,165installs excalidraw-diagram-generator official github Turn a plain-language description into an Excalidraw diagram. Useful for mapping processes, system structure, and relationships between entities. GitHub Copilot 31,639installs multi-stage-dockerfile official github This skill guides GitHub Copilot in writing multi-stage Dockerfiles for different languages and frameworks. Use it when the final runtime image should contain fewer build dependencies. GitHub Copilot 29,688installs documentation-writer official github Skill that turns the agent into a technical writer following the Diátaxis framework: tutorials, how-to guides, reference, and explanation. Proposes structure before writing. GitHub Copilot 27,757installs prd official github Turns a feature idea into a structured PRD with user stories, technical requirements, and risks. Use it when planning a software feature or an AI-powered one. GitHub Copilot 24,035installs refactor official github This skill reshapes existing code without changing its external behavior. Use it for gradual cleanup of large functions, duplication, weak types, and code smells. GitHub Copilot 22,321installs java-springboot official github Gives GitHub Copilot Spring Boot development practices, from project layout to tests and security. Use it when writing or reviewing Java application code. GitHub Copilot 21,272installs create-readme official github This skill reviews a project and creates a structured README.md. Use it when the repository needs clear documentation based on its actual files and code. GitHub Copilot 19,081installs

Similar

powershell-security-hardening VoltAgent Community This subagent hardens PowerShell scripts, remoting, and Windows settings. Use it to review automation, credentials, logs, and CI/CD security gates. Claude Code 194installs dotnet-framework-4.8-expert VoltAgent Community Maintains and modernizes legacy enterprise apps on .NET Framework 4.8. It handles Web Forms, WCF services, and Windows integrations without breaking existing systems. Claude Code 187installs powershell-module-architect VoltAgent Community A subagent for designing and refactoring PowerShell modules, profiles, and automation libraries. Use it when code must work across PowerShell 5.1 and 7+. Claude Code 183installs code-reviewer official Anthropic Reviews code changes against CLAUDE.md project rules and flags material defects. Run it before a commit or pull request. Claude Code 31,050installs code-reviewer official Anthropic This subagent checks code changes for bugs, security issues, and project-rule violations. Use it when a review should focus on findings that matter. Claude Code 31,050installs security-auditor official Anthropic This subagent searches code for security flaws and gives engineers concrete fixes. Use it to review a project before hardening or modernization work. Claude Code 10,718installs test-engineer official Anthropic This subagent captures legacy behavior in tests and compares it with a rewritten implementation. Use it before changing existing modules. Claude Code 9,715installs code-reviewer VoltAgent Community Reviews code changes for bugs, security flaws and maintenance issues. Use it before merging complex work or auditing a project. Claude Code 31,050installs

Questions about gem-code-simplifier

How to install gem-code-simplifier?

Place the agent definition file into .claude/agents/gem-code-simplifier.md, .cursor/agents/gem-code-simplifier.md, or .codex/agents/gem-code-simplifier.md.

Does gem-code-simplifier add new features?

No. Its system instructions strictly forbid feature additions. It only refactors, renames, and removes dead code.

What happens if existing tests fail during refactoring?

The subagent halts, then either reverts the change or escalates the failure according to its JSON output workflow.

Source text

gem-code-simplifier.agent.md · MIT
---
description: "Refactoring specialist: removes dead code, reduces complexity, consolidates duplicates."
name: gem-code-simplifier
argument-hint: "Enter plan_id, task_id, task_definition, and role-scoped config_snapshot."
disable-model-invocation: false
user-invocable: false
mode: subagent
---

# 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>

```json
{
  "status": "completed | failed | needs_retry | blocked",
  "reason": "string",
  "fail": "fixable | needs_replan | escalate | flaky | regression | new_failure | platform_specific",
  "handoff": {
    "changed_files": ["string"],
    "complexity_delta": 0,
    "verdict": "pass | fail"
  },
  "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.
- Check relevant memory when applicable; expand as warranted.
</rules>

© github · MIT · github/awesome-copilot

See also

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor