code-simplification

A code-cleanup guide for making complicated code easier to read while keeping its behavior unchanged.

In plain words
What is it for?
Use it to simplify over-engineered functions, flatten nested logic with early exits, and remove needless abstractions or indirection.
Why use it?
It removes unnecessary layers, deeply nested conditions, unused values, and helpers that add confusion. Existing results, errors, and interfaces are kept the same.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/rafaelghif/antigravity-agents/code-simplification
Any agent
npx skills add rafaelghif/antigravity-agents --skill code-simplification
Clone the repo
git clone --depth 1 https://github.com/rafaelghif/antigravity-agents

Made for: Claude Code, Codex.

Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 446 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00032 $0.00446
Opus 5 $0.00016 $0.00223
Sonnet 5 $0.00006 $0.00089
Haiku 4.5 $0.00003 $0.00045

Measured 3d ago against content hash 9926ea303d4d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-simplification scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/code-simplification/SKILL.md · 36 lines

What it actually says

Code Simplification Protocol

<CRITICAL_DIRECTIVE> You are the Senior Code Simplification Specialist. Your mandate is to eliminate needless complexity, over-abstractions, and clever code. "Clarity over cleverness. Code is read 10x more often than it is written." </CRITICAL_DIRECTIVE>

<CORE_PRINCIPLES>

  1. Strict Behavioral Invariance:
    • Simplification must NEVER alter runtime behavior, return values, error types, or external contracts.
    • All existing tests MUST pass without modification.
  2. Flatten Hierarchy (Guard Clauses First):
    • Eliminate deep arrow-nested conditional pyramids (if { if { if { ... } } }).
    • Use early returns and guard clauses at the start of functions to handle edge-cases and exits immediately.
  3. Banish Premature Abstraction:
    • If an interface, factory, or helper is used in exactly one place and adds cognitive load, inline it.
    • Favor plain functions and standard types over complex class inheritance or abstract generic wrappers.
  4. Dead Variable & Indirection Removal:
    • Inline single-use variables that merely pass a value to the next line without adding semantic context.
    • Delete unused parameters, orphaned helper functions, and dead code branches.
  5. Protected Critical Blocks:
    • Respect comments marked /* PERF_CRITICAL */ or /* SECURITY_CRITICAL */. Do not over-simplify code that has deliberate micro-optimizations or security boundaries. </CORE_PRINCIPLES>

<PROCEDURAL_WORKFLOW>

  1. Identify Complexity: Locate deeply nested functions, boilerplate factories, or redundant wrapper layers.
  2. Refactor In-Place: Apply guard clauses, inline single-use helpers, and simplify control flow.
  3. Verify Functionality: Run python3 scripts/verify.py --execute to guarantee 100% behavioral equivalence. </PROCEDURAL_WORKFLOW>
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 36 lines · 0 tokens per session scan A 9926ea303d4d

Subscribe to this mod's changes

code-simplification is a skill published in the GitHub repository rafaelghif/antigravity-agents (5 stars, last pushed 3d ago), licensed MIT. It adds 32 tokens to every session and 446 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

coordinate-agents

Route Codex-native multi-agent orchestration in a Git repository through a local-first, recoverable Agent Bus. Use for role-based planning, task execution, review, recovery, adapters, and human-gated release workflows. The plugin supports Codex CLI, Google Antigravity CLI, Claude, and other configured coding agents.…

hogancv/coordinate-agents · 87 tokens

coordinate-task

Run a Coordinate Agents Task from requirement clarification through planning, implementation, review, and the human release gate. Hide Agent Bus transport details behind the durable Task API.

hogancv/coordinate-agents · 35 tokens

coordinate-recover

Diagnose and safely resume Coordinate Agents Tasks after executable failure, non-zero exit, timeout, stale claim, processing message, or Implementer ERROR. Recovery is explicit and never an automatic retry loop.

hogancv/coordinate-agents · 43 tokens

coordinate-setup

Discover coding CLIs on the current computer and configure a Coordinate Agents implementation agent. Use for setup, executable checks, registered agents, user-level configuration, and project-over-user precedence.

hogancv/coordinate-agents · 40 tokens

backend-engineer

Supabase integration specialist. Handles database schema, authentication, Row Level Security (RLS), real-time subscriptions, and storage. Connects existing UI to real backend. Only called AFTER UI exists with mock data. Triggers: connect database, connect Supabase, add auth, make login, backend integration, real data…

wasintoh/toh-framework · 75 tokens

dev-engineer

Adds logic, state management, TypeScript types, and CRUD operations to UI. Works AFTER ui-first-builder creates the interface. Implements Zustand stores, form handling with React Hook Form + Zod, and prepares for backend connection. Triggers: add logic, add functionality, make it work, state management, form…

wasintoh/toh-framework · 75 tokens