Clean Code logo

Clean Code

Organization
Mindrally
clean-code

Clean, maintainable, human-readable code principles combined with anti-over-engineering discipline: naming, single responsibility, DRY, and scoping changes to exactly what was requested. Use when writing new code, refactoring existing code, reviewing code for quality, or deciding how much abstraction a change actually needs.

Overview

PublisherMindrally
Repositoryskills
Skill nameclean-code
Stars
259
Forks
41
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by Mindrally on GitHub. Read the source before you install it.

Installation

Install the Clean Code AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Mindrally/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/clean-code .claude/skills/clean-code
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Clean Code in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Clean Code on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Clean Code is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Clean Code

This skill covers writing code that is easy to read and change, and — just as important — avoiding the over-engineering that makes code harder to read and change in the name of "best practices." Both halves matter together: clean code is simple code, not merely well-decorated code.

Workflow for Writing or Reviewing Code

  1. Scope the change — Identify exactly what was asked for. Note what's out of scope before writing anything.
  2. Reach for the simplest solution first — Prefer the direct, obvious implementation over a general or configurable one, unless a concrete current need justifies more.
  3. Name things for their purpose — Choose names that reveal intent before writing the body of a function or the shape of a type.
  4. Keep functions single-purpose — If a function needs a comment to explain what it does, split it.
  5. Remove duplication deliberately — Extract shared logic only once it's actually duplicated (see Rule of Three below), not preemptively.
  6. Write or update tests — Cover the new behavior and the edge cases it introduces.
  7. Verify scope before delivery — Confirm only the requested code changed, check for a simpler approach you might have missed, and confirm no unrequested files were touched.

Meaningful Names

  • Variables, functions, and classes should reveal their purpose from the name alone.
  • Names should explain why something exists and how it's used, not just its type or contents (activeUserIds, not list1).
  • Avoid abbreviations unless they're universally understood in the domain (id, url — fine; usrCfgTmp — not fine).

Constants Over Magic Numbers

  • Replace hard-coded values with named constants (MAX_RETRY_COUNT = 3, not a bare 3 three call sites later).
  • Use descriptive constant names that explain the value's purpose, not just its value.
  • Keep constants at the top of the file or in a dedicated constants module when shared across files.

Smart Comments

  • Don't comment on what the code does — make the code self-documenting through naming and structure instead.
  • Use comments to explain why something is done a certain way, especially when the reason isn't visible in the code (a workaround for a library bug, a non-obvious ordering requirement).
  • Document public APIs, genuinely complex algorithms, and non-obvious side effects.

Single Responsibility

  • Each function should do exactly one thing.
  • Functions should be small and focused enough to be understood without scrolling.
  • If a function needs a comment to explain what it does, that's a signal to split it into named sub-functions instead.

DRY — Don't Repeat Yourself

  • Extract repeated code into reusable functions once the repetition is real, not anticipated.
  • Share common logic through a proper abstraction — a shared function or module, not copy-paste with tweaks.
  • Maintain a single source of truth for any given piece of business logic or configuration value.

Encapsulation

  • Hide implementation details behind a clear interface; callers shouldn't need to know how a thing works to use it.
  • Move nested conditionals into well-named functions or guard clauses instead of deep if/else trees.
js
// Before
function canCheckout(cart) {
  if (cart.items.length > 0) {
    if (cart.user.isVerified) {
      if (cart.total <= cart.user.creditLimit) {
        return true;
      }
    }
  }
  return false;
}

// After
function canCheckout(cart) {
  const hasItems = cart.items.length > 0;
  const isWithinCreditLimit = cart.total <= cart.user.creditLimit;
  return hasItems && cart.user.isVerified && isWithinCreditLimit;
}

Clean Structure

  • Keep related code together (a feature's components, hooks, and styles in one directory, not scattered by file type).
  • Organize code in a logical hierarchy that mirrors how the domain is understood.
  • Use consistent file and folder naming conventions across the codebase.

Avoiding Over-Engineering

  • Only change what was asked. The simplest solution that satisfies the request comes first.
  • When the right level of abstraction is unclear, ask rather than guessing toward the more elaborate option.
  • Do not modify unrequested code, even if it looks improvable — a drive-by refactor in an unrelated function expands the review surface and the risk of the change.
  • Do not add abstractions (interfaces, factories, plugin systems, config layers) without a concrete, current need. A single implementation doesn't need an interface "in case" a second one shows up later — that's speculative generality (YAGNI: "You Aren't Gonna Need It").
  • Do not import a new dependency to solve a problem a few lines of existing code already solve.
  • Do not rewrite entire files for small changes — a targeted diff is easier to review and safer to ship than a full-file rewrite.
  • Do not add error handling for scenarios that cannot occur given the surrounding code's guarantees — defensive code for impossible states adds reading cost without adding safety.

Rule of Three

  • Tolerate duplication the first two times a pattern appears.
  • Extract an abstraction on the third occurrence, once the actual shape of the shared logic is clear — extracting after one or two instances often guesses wrong about what's actually shared.

Signs of Over-Engineering

  • A configuration option that has only ever been set to one value.
  • An interface with exactly one implementation and no test double that needs a second.
  • A generic options object accreting fields for hypothetical future callers.
  • A plugin/strategy pattern introduced before there are two strategies to switch between.

Code Quality Maintenance

  • Refactor continuously in small steps rather than deferring cleanup to a dedicated "refactor sprint."
  • Fix technical debt early, while the context for why the code looks the way it does is still fresh.
  • Leave code cleaner than you found it, scoped to the area you're already touching — not as license to refactor unrelated files.

Testing

  • Write a failing test before fixing a bug, so the fix is verified and the bug can't silently regress.
  • Keep tests readable and maintainable — a test that's harder to understand than the code it tests has failed at its job.
  • Test edge cases and error conditions explicitly, not just the happy path.

Version Control

  • Write clear, specific commit messages that explain why a change was made.
  • Make small, focused commits — one logical change per commit.
  • Use meaningful branch names that describe the work, not the author or the date.

Before Delivery Checklist

  • Only the requested code changed — no unrelated files touched.
  • No abstraction was added without a concrete need that exists today.
  • No dependency was added that duplicates something already available.
  • A simpler approach was considered and ruled out, not just skipped.
  • New behavior has test coverage, including at least one edge case.

Frequently asked questions

What does the Clean Code AI skill do?

Clean, maintainable, human-readable code principles combined with anti-over-engineering discipline: naming, single responsibility, DRY, and scoping changes to exactly what was requested. Use when writing new code, refactoring existing code, reviewing code for quality, or deciding how much abstraction a change actually needs.

Why use Clean Code on TypingMind?

Because you install it once and use it with any model. Clean Code is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Clean Code in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Mindrally/skills/tree/main/clean-code. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Clean Code?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Clean Code?

As many as you like. As long as a model supports skills, you can use Clean Code with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Clean Code AI skill free?

Yes. It is published on GitHub by Mindrally under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇