code-simplification
Simplifies code for clarity without changing behavior. Use when code works but is harder to read, maintain, or extend than it should be.
What this skill does
# Code Simplification Adapted from `addyosmani/agent-skills` (MIT), commit `82ceff41ed4d3c644e3dcca8a0514390b2911223`. ## Overview Simplify code by reducing complexity while preserving exact behavior. The goal is not fewer lines; it is faster comprehension, safer maintenance, and easier review. ## When to Use - After a feature works but feels heavier than necessary - During review when readability or duplication issues show up - When code has deep nesting, unclear names, or scattered logic - After a rushed implementation that now needs cleanup ## Core Rules ### Preserve Behavior Exactly Do not change outputs, side effects, ordering, or error behavior. If you are not sure a simplification is behavior-preserving, stop and gather more context first. ### Follow Project Conventions Simplification should make code more consistent with the repository, not more consistent with personal taste. ### Prefer Clarity Over Cleverness Avoid dense ternaries, over-generalized abstractions, and compressed logic that requires a second reading. ### Scope to What Changed Default to simplifying the code you are already touching. Avoid unrelated cleanup unless explicitly asked. ## Simplification Process ### Step 1: Understand Before Changing Apply Chesterton's Fence. - What is this code responsible for? - Why might it have been written this way? - What tests define its current behavior? ### Step 2: Identify the Simplification Look for: - deep nesting - long functions with mixed responsibilities - duplicate logic - generic or misleading names - wrappers or abstractions that add no value ### Step 3: Apply Small Changes Make one simplification at a time and verify after each one. - simplify the control flow - extract a well-named helper - inline an unnecessary wrapper - remove dead code only when you understand it ### Step 4: Re-evaluate the Whole After the refactor, ask whether a new teammate would understand the new version faster than the old one. ## Common Rationalizations | Rationalization | Reality | |---|---| | "Fewer lines is always simpler" | A dense one-liner can be harder to understand than a clear five-line block. | | "I will simplify this unrelated code while I am here" | Drive-by refactors create noisy diffs and hidden regression risk. | | "This abstraction might be useful later" | Speculative abstractions are complexity without current value. | ## Red Flags - Tests need to change just to preserve the simplification - Error handling disappears because it looks noisy - Renames follow personal taste instead of repo conventions - The simplified version is harder to review than the original ## Verification - [ ] Existing tests still pass without semantic changes - [ ] Build succeeds - [ ] No error handling was weakened - [ ] Diff stays focused on the targeted simplification
Related in Data & Analytics
clawarr-suite
IncludedComprehensive management for self-hosted media stacks (Sonarr, Radarr, Lidarr, Readarr, Prowlarr, Bazarr, Overseerr, Plex, Tautulli, SABnzbd, Recyclarr, Unpackerr, Notifiarr, Maintainerr, Kometa, FlareSolverr). Deep library exploration, analytics, dashboard generation, content management, request handling, subtitle management, indexer control, download monitoring, quality profile sync, library cleanup automation, notification routing, collection/overlay management, and media tracker integration (Trakt, Letterboxd, Simkl).
querying-soql
IncludedSOQL query generation, optimization, and analysis with 100-point scoring. Use this skill when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan analysis, and performance or safety improvements for Salesforce queries. TRIGGER when: user writes, optimizes, or debugs SOQL/SOSL queries, touches .soql files, or asks about relationship queries, aggregates, or query performance. DO NOT TRIGGER when: bulk data operations (use handling-sf-data), Apex DML logic (use generating-apex), or report/dashboard queries.
app-store-optimization
IncludedApp Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklists, and tracking ranking changes.
habit-flow
IncludedAI-powered atomic habit tracker with natural language logging, streak tracking, smart reminders, and coaching. Use for creating habits, logging completions naturally ("I meditated today"), viewing progress, and getting personalized coaching.
app-store-optimization
IncludedApp Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklists, and tracking ranking changes.
visualizing-data
IncludedBuilds dashboards, reports, and data-driven interfaces requiring charts, graphs, or visual analytics. Provides systematic framework for selecting appropriate visualizations based on data characteristics and analytical purpose. Includes 24+ visualization types organized by purpose (trends, comparisons, distributions, relationships, flows, hierarchies, geospatial), accessibility patterns (WCAG 2.1 AA compliance), colorblind-safe palettes, and performance optimization strategies. Use when creating visualizations, choosing chart types, displaying data graphically, or designing data interfaces.