clean-code-patterns

A Python clean-code skill focused on making code easier to read by applying principles such as single responsibility, SOLID, DRY, and KISS.

In plain words
What is it for?
Use it during refactoring and code review to improve class and function responsibilities, structure, and readability.
Why use it?
It helps reveal when code is doing too much, is difficult to understand, or repeats logic unnecessarily.

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/ruslan-korneev/claude-plugins/clean-code-patterns
Any agent
npx skills add ruslan-korneev/claude-plugins --skill clean-code-patterns
Clone the repo
git clone --depth 1 https://github.com/ruslan-korneev/claude-plugins

Made for: Claude Code, Codex.

Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,768 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.00000 $0.01768
Opus 5 $0.00000 $0.00884
Sonnet 5 $0.00000 $0.00354
Haiku 4.5 $0.00000 $0.00177

Measured 2d ago against content hash 2bcd0c4387bd, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

clean-code-patterns 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.

plugins/python/skills/clean-code-patterns/SKILL.md · 325 lines

How it starts

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

Clean Code Patterns

Clean code principles for Python. Code should read like well-written prose.

Triggers

Use this skill when:

  • Code is hard to read or understand
  • Function/class does too much
  • Refactoring is needed
  • Code review revealed issues
  • Questions about SOLID, DRY, KISS

SOLID

More details: ${CLAUDE_PLUGIN_ROOT}/skills/clean-code-patterns/references/solid.md

S — Single Responsibility

# Bad — class does everything
class UserService:
    def create_user(self, data): ...
    def send_welcome_email(self, user): ...
    def generate_report(self, users): ...
    def export_to_csv(self, users): ...

# Good — each class = one responsibility
class UserService:
    def create_user(self, data): ...

class EmailService:
    def send_welcome_email(self, user): ...

class UserReportGenerator:
    def generate(self, users): ...
    def export_to_csv(self, users): ...

O — Open/Closed

# Bad — modify code when adding new type
def calculate_discount(order_type: str, amount: float) -> float:
    if order_type == "regular":
        return amount * 0.1
    elif order_type == "premium":
        return amount * 0.2
    elif order_type == "vip":  # Added new type — modified function
        return amount * 0.3

# Good — extend through new classes
from abc import ABC, abstractmethod

class DiscountStrategy(ABC):
    @abstractmethod
    def calculate(self, amount: float) -> float: ...

class RegularDiscount(DiscountStrategy):
    def calculate(self, amount: float) -> float:
        return amount * 0.1

class PremiumDiscount(DiscountStrategy):
    def calculate(self, amount: float) -> float:
        return amount * 0.2

# Add VIP — create new class, don't modify existing code
class VIPDiscount(DiscountStrategy):
    def calculate(self, amount: float) -> float:
        return amount * 0.3

L — Liskov Substitution

# Bad — subclass violates parent's contract
class Bird:
    def fly(self) -> None: ...

class Penguin(Bird):
    def fly(self) -> None:
        raise NotImplementedError("Penguins can't fly")  # LSP violation!

# Good — correct hierarchy
class Bird:
    def move(self) -> None: ...

class FlyingBird(Bird):
    def fly(self) -> None: ...

class Penguin(Bird):
    def move(self) -> None:
        self.swim()

Read the full file on GitHub · 325 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 · 325 lines · 0 tokens per session scan A 2bcd0c4387bd

Subscribe to this mod's changes

clean-code-patterns is a skill published in the GitHub repository ruslan-korneev/claude-plugins (4 stars, last pushed 6mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,768 tokens. 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

mastering-engineer

Guides audio mastering for streaming platforms including loudness optimization and tonal balance. Use when the user has approved tracks and wants to master audio files.

bitwize-music-studio/claude-ai-music-skills · 34 tokens

suno-engineer

Constructs technical Suno V5/V5.5 style prompts, selects genres, and optimizes generation settings. Use when creating or refining Suno prompts for track generation.

bitwize-music-studio/claude-ai-music-skills · 40 tokens

lyric-reviewer

Reviews lyrics against a quality checklist before Suno generation. Use before generating tracks to catch rhyme, prosody, pronunciation, and structural issues.

bitwize-music-studio/claude-ai-music-skills · 33 tokens

promo-writer

Generates platform-specific social media copy from album themes, track concepts, and lyrics. Use when promo/ templates need to be populated before release.

bitwize-music-studio/claude-ai-music-skills · 33 tokens

researcher

Conducts investigative-grade research with primary source analysis, cross-verification, and trial-level depth. Use when an album needs factual research, source material, or verification of claims.

bitwize-music-studio/claude-ai-music-skills · 38 tokens

voice-checker

Reviews lyrics and prose for AI-written patterns (abstract noun stacking, over-explained metaphors, cliche escalation, missing idiosyncrasy, prose AI tells). Advisory Warning/Info severity — flags issues, does not block or rewrite. Use when reviewing lyrics for authenticity or before generation to catch AI-sounding…

bitwize-music-studio/claude-ai-music-skills · 70 tokens