agentleFS
LetermeFlorentLetermeFlorent/claude-skills/clean-architecture/SKILL.md

clean-architecture

Skill0 starsChanged 3 days agoMITView on GitHub

Use when the user types /clean-arch, asks to audit or reorganise a project's folder layout, or files look misplaced, duplicated or useless, or a folder has become a dumping ground.

33 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use convention-learner, opentelemetry and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • codewithmukeshSkill

    convention-learner

    Detects and enforces project-specific coding conventions by analyzing existing codebase patterns. Learns naming conventions, folder structure, test organization, and coding style from the existing code. Load when: "conventions", "coding standards", "project patterns", "enforce style", "detect patterns", "learn conventions", "code consistency".

    Also in 3 projects that use this

  • codewithmukeshSkill

    opentelemetry

    OpenTelemetry observability for .NET 10 applications. Covers traces, metrics, and logs using the OpenTelemetry SDK with OTLP export. Includes custom ActivitySource, IMeterFactory metrics, resource configuration, and Aspire Dashboard integration. Load this skill when setting up distributed tracing, custom metrics, OTLP export, or when the user mentions "OpenTelemetry", "OTLP", "traces", "spans", "Activity", "ActivitySource", "metrics", "IMeterFactory", "Meter", "Counter", "Histogram", "Gauge", "telemetry", "observability", "distributed tracing", "OTEL", or "Aspire Dashboard".

    Also in 3 projects that use this

  • MovGP0Skill

    modern-csharp

    Modern C# style guidance for Bendex and MicroSea code changes, including primary constructors, expression-bodied members, var usage, target-typed new, lambdas, and pattern matching.

    Also in 3 projects that use this

  • MicrosoftSkill

    resilience

    Apply resilience patterns (retry, backoff, circuit breaking) when writing or reviewing code that makes outbound HTTP/REST calls, database operations, or any I/O that can experience transient failures. Use this skill when: (1) writing new code that calls external services or APIs, (2) reviewing code that uses fetch, HTTP clients, or service-to-service calls, (3) adding queue consumers or workers that interact with remote systems, (4) debugging intermittent failures in production.

    Also in 3 projects that use this

  • hongyuancSkill

    vertical-slice

    Build and evaluate a production-quality vertical slice before advancing from Pre-Production to Production.

    Also in 3 projects that use this

  • wpankSkill

    caching

    Caching strategies, invalidation, eviction policies, HTTP caching, distributed caching, and anti-patterns. Use when designing cache layers, choosing eviction policies, debugging stale data, or optimizing read-heavy workloads.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 2 are distinctive, and 6 are very specific to this project.

  • 0

    Common

    Most of the 31 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    No two files with same content.

    line 20
  2. Distinctive:

    No import cycle between folders.

    line 25
  3. Very specific:

    No needless depth: chain of folders holding one subfolder only, depth over max_depth [6].

    line 26
  4. Very specific:

    Read: tree (git ls-files <scope>), then files the candidates name.

    line 47
  5. Very specific:

    Verify: one fresh Agent call, never a fork, prompt verify-brief.md.

    line 51
  6. Very specific:

    Commit through the clean-commits skill with the step's Files: only, hurry or not: a hand git commit skips its checks.

    line 70
  7. Very specific:

    Before each commit, rg old path and old module path (dotted) in project: no hit left.

    line 73
  8. Very specific:

    Delete only after rg of the name finds no reference.

    line 74

“Common” is measured: kept by at least 6 in 10 of the 31 edited versions of this file we could read. “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

Clean architecture

Audit scope's folder layout: misplaced, duplicated, useless files and folders, missing groups, folder cycles. Note /20 from script on verified findings, then plan, then apply. Same machine as the clean-code skill: its "Rules that never bend", Apply and Report hold here. Needs clean-code installed next to this folder.

<skill> = this folder. Scripts from project root: python -I "<skill>/scripts/<tool>.py". Run goes to .ia/clean-architecture/<run>/, thresholds in .ia/clean-architecture/config.json.

Rules

Defaults in brackets.

  1. Bad layout outside grid, 0.5 to 3 points.
  2. No two files with same content. Script. Look-alike files: by reading.
  3. File lives with its users: used only from one unrelated folder, it moves there, or to a new folder when rule 9 says the users' folder is the wrong concern. Script.
  4. Nothing useless: folder of empty files, tracked junk (logs, backups, copies, OS files, built output). Script.
  5. Folder over max_files [8] code files splits by name prefix, group_min [3] files a group. Script.
  6. No import cycle between folders. Script.
  7. No needless depth: chain of folders holding one subfolder only, depth over max_depth [6]. Script.
  8. One file naming style per folder. Script.
  9. Tests in one place, one convention. Script.
  10. One folder, one concern: no folder mixing layers or domains (UI, data, clients, models). Reading.
  11. Tree fits project kind and framework; root holds entry points, manifests, docs, config only. Reading.
RuleDeduction
0its points
1, 51 per finding, 3 at most
2, 3, 4, 9, 100.5 per finding, 2 at most
80.5 per finding, 1 at most
6, 70.25 per finding, 1 at most

Audit

Each step ends before next.

  1. Scope: /clean-arch argument, else AskUserQuestion, narrowest folder first.
  2. Measure: measure.py <scope>.
  3. Suite: run project tests once, low priority, two workers at most. Result = plan Suite: line.
  4. Read: tree (git ls-files <scope>), then files the candidates name. Rules 9, 10, 0, look-alike files: findings.py add --rule <n> --file <path> --line <n> --what "<defect>" --proof "<paths or lines>". Rules 9 and 10 each need a finding or findings.py checked --rule <n> --why "<what was read>", on every run, new measure included, else score.py refuses.
  5. Verify: one fresh Agent call, never a fork, prompt verify-brief.md.
  6. Score: score.py. At 20: stop, no plan.
  7. Plan: <run>/plan.md shaped like clean-code plan-template.md, first line <!-- clean-architecture plan v1 -->, phases below. plan_check.py until plan ok.
  8. Print note alone as heading, # 14/20, then apply whole plan without asking.

Apply

clean-code Apply section, this phase table:

PhaseRules
10, 3: delete
21: point every import at kept copy, delete other
32, 4, 6, 8: move
47: rename
55, 9, 10: restructure
  • Finding an earlier step already solves (file merged or deleted, cycle gone): Left as is, naming that step.
  • Commit through the clean-commits skill with the step's Files: only, hurry or not: a hand git commit skips its checks. Never git add -A or a folder: it takes __pycache__, .ia/ and other sessions' files.
  • Move = git mv, then every import, path string, config entry and doc link fixed in same step.
  • Before each commit, rg old path and old module path (dotted) in project: no hit left.
  • Delete only after rg of the name finds no reference.
  • Public path (package export, route, URL, file another repo reads) never moves: Left as is.

Report

clean-code Report, after a new measure, verify and score on same scope.

Files

New check = module in scripts/checks/layout/ with check(files, root, config) returning (findings, stats). Tests: python -I -B -m unittest discover -s tests -p "test_*.py" from this folder.

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.