python-simplifier — community python-simplifier, community, ide skills, Claude Code, Cursor, Windsurf

v1.0.0
GitHub

About this Skill

Perfect for Code Optimization Agents needing advanced Python code simplification and analysis capabilities. minimal version of telluriumgames to run game

charlesmsiegel charlesmsiegel
[0]
[0]
Updated: 3/5/2026

Agent Capability Analysis

The python-simplifier skill by charlesmsiegel is an open-source community AI agent skill for Claude Code and other IDE workflows, helping agents execute tasks with better context, repeatability, and domain-specific guidance.

Ideal Agent Persona

Perfect for Code Optimization Agents needing advanced Python code simplification and analysis capabilities.

Core Value

Empowers agents to transform complex Python code into clean, readable, idiomatic solutions using cyclomatic complexity analysis, code smell detection, and overengineering checks, leveraging scripts like analyze_all.py and find_code_smells.py.

Capabilities Granted for python-simplifier

Analyzing cyclomatic complexity
Detecting mutable defaults and bare excepts
Identifying YAGNI violations and unused abstracts

! Prerequisites & Limits

  • Requires Python environment
  • Limited to Python code analysis
Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

python-simplifier

Install python-simplifier, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command setup.

SKILL.md
Readonly

Python Code Simplifier

Transform complex, hard-to-maintain Python code into clean, readable, idiomatic solutions.

Analysis Scripts

bash
1# Comprehensive analysis (runs all checks) 2python scripts/analyze_all.py /path/to/project 3 4# Individual analyzers: 5python scripts/analyze_complexity.py . # Cyclomatic/cognitive complexity 6python scripts/find_code_smells.py . # Mutable defaults, bare excepts, etc. 7python scripts/find_overengineering.py . # YAGNI violations, unused abstractions 8python scripts/find_dead_code.py . # Unused imports, functions, variables 9python scripts/find_unpythonic.py . # Non-idiomatic patterns 10python scripts/find_coupling_issues.py . # Feature envy, low cohesion 11python scripts/find_duplicates.py . # Structural duplicate detection 12 13# JSON output for CI/tooling 14python scripts/analyze_all.py . --format json > report.json

Workflow

  1. Analyze: Run analyze_all.py to identify all issues
  2. Prioritize: Address high-severity issues (🔴) first
  3. Simplify: Apply patterns below incrementally
  4. Verify: Ensure simplified code is functionally equivalent

Simplification Principles

  1. YAGNI: Don't add abstractions until needed
  2. Preserve behavior: Simplification ≠ changing functionality
  3. One change at a time: Incremental is safer
  4. Readability over cleverness: Clear beats "smart"
  5. Keep related code together: Locality matters

Common Simplification Patterns

Extract and Name

python
1# Before: Complex inline condition 2if user.age >= 18 and user.country in ALLOWED and not user.banned: 3 4# After: Named condition 5is_eligible = user.age >= 18 and user.country in ALLOWED and not user.banned 6if is_eligible:

Early Returns

python
1# Before: Deep nesting 2def process(data): 3 if data: 4 if data.valid: 5 if data.ready: 6 return compute(data) 7 return None 8 9# After: Guard clauses 10def process(data): 11 if not data or not data.valid or not data.ready: 12 return None 13 return compute(data)

Comprehensions

python
1# Before: Manual loop 2result = [] 3for item in items: 4 if item.active: 5 result.append(item.name) 6 7# After: List comprehension 8result = [item.name for item in items if item.active]

Dictionary Techniques

python
1# Before: Verbose key checking 2if key in d: 3 value = d[key] 4else: 5 value = default 6 7# After: get() with default 8value = d.get(key, default) 9 10# Before: Manual grouping 11groups = {} 12for item in items: 13 if item.category not in groups: 14 groups[item.category] = [] 15 groups[item.category].append(item) 16 17# After: defaultdict 18from collections import defaultdict 19groups = defaultdict(list) 20for item in items: 21 groups[item.category].append(item)

Context Managers

python
1# Before: Manual cleanup 2f = open('file.txt') 3try: 4 data = f.read() 5finally: 6 f.close() 7 8# After: with statement 9with open('file.txt') as f: 10 data = f.read()

Over-Engineering Anti-Patterns

PatternProblemSolution
Single-impl interfaceAbstract class with one subclassMerge or wait for need
Unnecessary factoryFactory that creates one typeDirect instantiation
Premature strategyStrategy pattern with one strategySimple function
Thin wrapperClass that just delegatesUse wrapped class directly
Speculative generalityCode for "future needs"Delete it (YAGNI)
Deep inheritance4+ levels of inheritanceComposition over inheritance

Code Smells Quick Reference

SmellDetectionFix
Mutable defaultdef f(x=[])Use None, create inside
Bare exceptexcept:except Exception:
God class15+ methods, 10+ attrsSplit into focused classes
Long function50+ linesExtract helper functions
Deep nesting4+ levelsEarly returns, extract
Feature envyMethod uses other class moreMove method
Magic numbersUnexplained numeric literalsNamed constants

Script Reference

ScriptWhat It Detects
analyze_complexity.pyCyclomatic complexity, cognitive complexity, nesting depth, function length, parameter count, class size
find_code_smells.pyMutable defaults, bare excepts, magic numbers, type comparisons, god classes, data classes, boolean blindness
find_overengineering.pySingle-implementation interfaces, unused abstractions, unnecessary factories/builders, thin wrappers, premature strategies
find_dead_code.pyUnused imports, unused functions/classes, unused parameters, unreachable code, constant conditions
find_unpythonic.pyrange(len()), == True/False/None, swallowed exceptions, manual index tracking
find_coupling_issues.pyFeature envy, low cohesion (LCOM), message chains, middle man classes
find_duplicates.pyStructurally similar code blocks using AST normalization

When NOT to Simplify

  • Working legacy code with no tests
  • Performance-critical hot paths (measure first)
  • Code that will be replaced soon
  • External API constraints requiring complexity

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is python-simplifier?

Perfect for Code Optimization Agents needing advanced Python code simplification and analysis capabilities. minimal version of telluriumgames to run game

How do I install python-simplifier?

Run the command: npx killer-skills add charlesmsiegel/tg. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for python-simplifier?

Key use cases include: Analyzing cyclomatic complexity, Detecting mutable defaults and bare excepts, Identifying YAGNI violations and unused abstracts.

Which IDEs are compatible with python-simplifier?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for python-simplifier?

Requires Python environment. Limited to Python code analysis.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add charlesmsiegel/tg. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use python-simplifier immediately in the current project.

Related Skills

Looking for an alternative to python-simplifier or another community skill for your workflow? Explore these related open-source skills.

View All

widget-generator

Logo of f
f

f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.

149.6k
0
AI

flags

Logo of vercel
vercel

flags is a Next.js feature management skill that enables developers to efficiently add or modify framework feature flags, streamlining React application development.

138.4k
0
Browser

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI