code-simplification

Guidance for making existing code easier to read while keeping its behavior exactly the same. It favors small, incremental changes that fit the project’s existing conventions.

In plain words
What is it for?
Reducing deep nesting, clarifying long functions, improving Kotlin code, and cleaning up working features after their behavior is covered by tests.
Why use it?
Hard-to-follow code slows reviews, debugging, and future changes. Simplifying it can improve understanding without introducing the risks of a rewrite.

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/guillemroca/agent-skills-android/code-simplification
Any agent
npx skills add GuillemRoca/agent-skills-android --skill code-simplification
Clone the repo
git clone --depth 1 https://github.com/GuillemRoca/agent-skills-android

Made for: Claude Code, Codex.

Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,181 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.00035 $0.01181
Opus 5 $0.00017 $0.00590
Sonnet 5 $0.00007 $0.00236
Haiku 4.5 $0.00003 $0.00118

Measured 2d ago against content hash d23af6633f15, 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 2d 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.

skills/code-simplification/SKILL.md · 146 lines

How it starts

The opening of the file, as written. The whole thing — 146 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code Simplification

Overview

Simplicity is about comprehension speed, not line count. Simple code is code another developer can read and understand quickly. This skill guides incremental simplification — making code easier to understand without changing what it does.

When to Use

  • Code is harder to understand than its logic warrants
  • Functions exceed ~40 lines or have deep nesting
  • After a feature is working and tested (simplify, don't rewrite)
  • During code review when readability is flagged

Don't simplify when:

  • Code is already clean and conventional
  • You don't fully understand what the code does (Chesterton's Fence)
  • The code is performance-critical and structured for speed
  • A rewrite is already planned

Core Principles

  1. Preserve Behavior Exactly — simplification changes form, not function
  2. Follow Project Conventions — match existing patterns, don't introduce new styles
  3. Prefer Clarity Over Cleverness — readable beats concise
  4. Maintain Balance — don't over-abstract or under-abstract
  5. Scope Appropriately — simplify what was asked, nothing more

Core Process

Step 1: Understand (Chesterton's Fence)

  1. Read the code and its tests — understand what it does and why
  2. Check git blame — understand the history of complex sections
  3. Identify the author's intent — is complexity intentional (performance, platform workaround)?
  4. Respect /* simplify-ignore-start */ blocks — skip annotated sections

Step 2: Identify Opportunities

  1. Scan for these patterns:
Pattern Kotlin Simplification
Deep nesting Early returns / when expressions
Long functions Extract well-named private functions
Complex conditionals when expression or sealed class
Nullable chains ?.let { }, ?:, safe calls
Manual null checks requireNotNull(), checkNotNull()
Mutable state val over var, immutable collections
Callback nesting Coroutines / Flow
Builder patterns Kotlin DSL or apply/also
Type casting chains is smart casts, sealed hierarchies
Manual resource management use { } or withContext

Read the full file on GitHub · 146 lines

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. 2d ago First seen · 146 lines · 35 tokens per session scan A d23af6633f15

Subscribe to this mod's changes

code-simplification is a skill published in the GitHub repository GuillemRoca/agent-skills-android (2 stars, last pushed 2mo ago), licensed MIT. It adds 35 tokens to every session and 1,181 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

spec-kitty-charter-doctrine

Run charter interview, generation, context, and sync workflows for project governance in Spec Kitty 3.x. Access doctrine artifacts programmatically via DoctrineService. Resolve agent profiles. Load action-scoped governance context iteratively, not all at once. Triggers: "interview for charter", "generate charter"…

Priivacy-ai/spec-kitty · 135 tokens

spec-kitty-bulk-edit-classification

Recognize when a mission is a bulk edit and drive the occurrence-classification guardrail on the user's behalf. Triggers: user says any variant of "rename X to Y", "change the terminology", "migrate all occurrences", "replace across the codebase", "the X feature is now the Y feature", "sed everywhere", or any request…

Priivacy-ai/spec-kitty · 157 tokens

spec-kitty-spdd-reasons

Drive REASONS Canvas authoring and review for Spec Kitty missions that opted in to Structured-Prompt-Driven Development (SPDD) via charter selection. Triggers: "use SPDD", "use REASONS", "generate a REASONS canvas", "apply structured prompt driven development", "make this mission SPDD". Does NOT handle: enforcing SPDD…

Priivacy-ai/spec-kitty · 118 tokens

spec-kitty-runtime-review

Review runtime-owned outputs using the Spec Kitty review workflow surface, then direct approval or rejection with structured feedback. Triggers: "review this work package", "check runtime output", "approve this step", "review WP", "is this WP ready to approve", "check this implementation". Does NOT handle: setup-only…

Priivacy-ai/spec-kitty · 85 tokens

spec-kitty

Standalone Spec Kitty governance invocation: run Spec Kitty when the user indicates they want Spec Kitty involved, load governance context, open an Op, do the work under that context, and close the Op with the real outcome. Documents dispatch, profiles list, invocations list, and profile-invocation complete. Triggers…

Priivacy-ai/spec-kitty · 99 tokens

spk-mission-types

Explain Spec Kitty mission types, step contracts, action indices, and when to choose each mission workflow.

Priivacy-ai/spec-kitty · 26 tokens