KS
Killer-Skills

python-simplifier — how to use python-simplifier how to use python-simplifier, python-simplifier setup guide, python code simplification, python-simplifier alternative, python-simplifier vs telluriumgames, python code analysis, python code readability, python-simplifier install, simplifying complex python code

v1.0.0
GitHub

About this Skill

Perfect for Code Optimization Agents needing advanced Python code simplification and analysis capabilities. python-simplifier is a minimal version of telluriumgames that runs games and transforms complex Python code into clean, readable solutions

Features

Runs comprehensive analysis using python scripts/analyze_all.py
Analyzes cyclomatic and cognitive complexity with python scripts/analyze_complexity.py
Identifies code smells such as mutable defaults and bare excepts with python scripts/find_code_smells.py
Detects overengineering and YAGNI violations with python scripts/find_overengineering.py
Supports individual analyzers for targeted code improvement

# Core Topics

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

Quality Score

Top 5%
42
Excellent
Based on code quality & docs
Installation
SYS Universal Install (Auto-Detect)
Cursor IDE Windsurf IDE VS Code IDE
> npx killer-skills add charlesmsiegel/tg/python-simplifier

Agent Capability Analysis

The python-simplifier MCP Server by charlesmsiegel is an open-source Categories.community integration for Claude and other AI agents, enabling seamless task automation and capability expansion. Optimized for how to use python-simplifier, python-simplifier setup guide, python code simplification.

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 identification through scripts like analyze_all.py, analyze_complexity.py, and find_code_smells.py.

Capabilities Granted for python-simplifier MCP Server

Simplifying hard-to-maintain Python codebases
Analyzing cyclomatic and cognitive complexity in Python projects
Identifying and removing code smells like mutable defaults and bare excepts

! Prerequisites & Limits

  • Requires Python environment
  • Limited to Python code analysis
  • Needs access to project directory for analysis
Project
SKILL.md
5.1 KB
.cursorrules
1.2 KB
package.json
240 B
Ready
UTF-8

# Tags

[No tags]
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

Related Skills

Looking for an alternative to python-simplifier or building a Categories.community AI Agent? Explore these related open-source MCP Servers.

View All

widget-generator

Logo of f
f

widget-generator is an open-source AI agent skill for creating widget plugins that are injected into prompt feeds on prompts.chat. It supports two rendering modes: standard prompt widgets using default PromptCard styling and custom render widgets built as full React components.

149.6k
0
Design

chat-sdk

Logo of lobehub
lobehub

chat-sdk is a unified TypeScript SDK for building chat bots across multiple platforms, providing a single interface for deploying bot logic.

73.0k
0
Communication

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
Communication

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
Communication