Skip to content
OpenSmartRoute
Skillv1.0.0

code-simplifier

Simplify and clean up code after changes are complete. Reduces complexity, improves readability, and ensures consistency.

by meleantonio(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from meleantonio/awesome-econ-ai-stuff (_skills/engineering/code-simplifier/SKILL.md). Install upstream with npx skills add meleantonio/awesome-econ-ai-stuff --skill code-simplifier. Copyright stays with the author.

Code Simplifier

Clean up and simplify code after making changes.

When to Use

Run this skill after completing a feature or fix to ensure the code is clean, readable, and maintainable.

Simplification Goals

Reduce Complexity

  • Break long functions into smaller, focused ones
  • Reduce nesting depth (max 3 levels)
  • Simplify complex conditionals
  • Extract magic numbers to named constants

Improve Readability

  • Use descriptive variable and function names
  • Add clarifying comments for non-obvious logic
  • Ensure consistent formatting
  • Remove unnecessary comments

Apply Pythonic Patterns

  • Use list/dict/set comprehensions where appropriate
  • Use with statements for resource management
  • Use enumerate() instead of manual indexing
  • Use zip() for parallel iteration
  • Use f-strings for formatting
  • Use pathlib for file paths

Clean Up

  • Remove unused imports
  • Remove unused variables
  • Remove commented-out code
  • Remove redundant code paths
  • Consolidate duplicate logic

Workflow

  1. Identify Changed Files

    • Focus on files modified in the current session
    • Or specify files/directories as arguments
  2. Analyze Each File

    • Check for simplification opportunities
    • Prioritize high-impact improvements
  3. Apply Simplifications

    • Make incremental changes
    • Preserve original behavior
    • Run tests after each change
  4. Format and Lint

    • Run ruff format .
    • Run ruff check --fix .
  5. Verify

    • Run tests: pytest
    • Ensure behavior unchanged

Arguments

Optionally specify files or directories to simplify.

Usage:

  • /code-simplifier - Simplify recently changed files
  • /code-simplifier src/module.py - Simplify specific file
  • /code-simplifier src/ - Simplify entire directory

Example Transformations

Before:

result = []
for i in range(len(items)):
    if items[i].is_valid == True:
        result.append(items[i].value)

After:

result = [item.value for item in items if item.is_valid]

Before:

if x != None:
    if y != None:
        if z != None:
            process(x, y, z)

After:

if all(v is not None for v in (x, y, z)):
    process(x, y, z)

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/meleantonio-awesome-econ-ai-stuff-code-simplifier/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

meleantonio-awesome-econ-ai-stuff-code-simplifier.ocm.jsonjson
{
  "ocm": "1",
  "id": "meleantonio-awesome-econ-ai-stuff-code-simplifier",
  "kind": "skill",
  "name": "code-simplifier",
  "description": "Simplify and clean up code after changes are complete. Reduces complexity, improves readability, and ensures consistency.",
  "publisher": "meleantonio",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "coding"
    ],
    "tags": [
      "skill-md",
      "refactoring",
      "python",
      "readability",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Simplify and clean up code after changes are complete. Reduces complexity, improves readability, and ensures consistency."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/meleantonio/awesome-econ-ai-stuff",
      "path": "_skills/engineering/code-simplifier/SKILL.md",
      "ref": "HEAD",
      "url": "https://github.com/meleantonio/awesome-econ-ai-stuff/blob/HEAD/_skills/engineering/code-simplifier/SKILL.md",
      "key": "meleantonio/awesome-econ-ai-stuff/_skills/engineering/code-simplifier/SKILL.md"
    },
    "compatibility": "['claude-code', 'cursor', 'codex', 'gemini-cli']"
  },
  "instructions": "# Code Simplifier\n\nClean up and simplify code after making changes.\n\n## When to Use\n\nRun this skill after completing a feature or fix to ensure the code is clean, readable, and maintainable.\n\n## Simplification Goals\n\n### Reduce Complexity\n- Break long functions into smaller, focused ones\n- Reduce nesting depth (max 3 levels)\n- Simplify complex conditionals\n- Extract magic numbers to named constants\n\n### Improve Readability\n- Use descriptive variable and function names\n- Add clarifying comments for non-obvious logic\n- Ensure consistent formatting\n- Remove unnecessary comments\n\n### Apply Pythoni",
  "cost": {
    "context_tokens": 554
  }
}

Fetch it by URL: GET /api/v1/registry/meleantonio-awesome-econ-ai-stuff-code-simplifier/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.