agentleFS
jenrehjenreh/appkit/.claude/skills/code-cleanup/SKILL.md

code-cleanup

Skill4 starsChanged 5 months agoMITView on GitHub

Refactor and simplify Python files modified in the current session — minimal diff, clean code principles, then lint/format/typecheck. Use when the user asks to clean up, simplify, or refactor code.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 4 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If $ARGUMENTS is provided, use those files.

    line 12
  2. Distinctive:

    If no modified Python files are found, report that and stop.

    line 19
  3. Distinctive:

    Remove dead code, unused imports, redundant comments, and unnecessary variables.

    line 29
  4. Distinctive:

    Ensure every function and method has a type annotation.

    line 33
  5. Very specific:

    No f-strings in logger calls: log.info("x: %s", x) not log.info(f"x: {x}").

    line 35
  6. Distinctive:

    If a file exceeds 1000 lines after refactoring, split it and update imports accordingly.

    line 36
  7. Very specific:

    After all edits: run task format && task lint && task typecheck and fix any issues.

    line 42

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Code Cleanup

Target files

If $ARGUMENTS is provided, use those files. Otherwise, run:

git diff --name-only HEAD && git ls-files --others --exclude-standard

Filter the output to .py files only — those are the files to clean up. If no modified Python files are found, report that and stop.

Rules

  • Minimal diff — change only what clearly improves the file; do not restructure things that already work.
  • No new features — preserve all existing behavior exactly.
  • Per-file scope — do not modify files outside the target list unless an import must be fixed.

What to apply (per file)

  • Remove dead code, unused imports, redundant comments, and unnecessary variables.
  • Simplify overly complex conditionals; prefer early returns over deep nesting.
  • Break functions > 20 lines into focused, well-named helpers — but only when the split is obvious.
  • Replace verbose loops with list/dict/set comprehensions or generator expressions where readable.
  • Ensure every function and method has a type annotation.
  • No print statements — use logging (default level: logger.debug).
  • No f-strings in logger calls: log.info("x: %s", x) not log.info(f"x: {x}").
  • If a file exceeds 1000 lines after refactoring, split it and update imports accordingly.

Process

  1. Determine the target file list as described above and show it to the user.
  2. For each file: read it, identify improvements, apply as a single focused edit pass.
  3. After all edits: run task format && task lint && task typecheck and fix any issues.
  4. Summarize what changed per file (one line per change group).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.