agentleFS
yaaabsyaaabs/nextjs-16-boilerplate/.claude/skills/clean-code/SKILL.md

clean-code

Skill3 starsChanged 5 months agoMITView on GitHub

Clean code and structure standards for this repo. Use when writing or refactoring any TypeScript/React code — covers naming, file layout, typing, and testing discipline.

135 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use intelligent-routing, designing-data-intensive-applications and 10 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.
  • SKB3002Skill

    intelligent-routing

    Automatic agent selection and intelligent task routing. Analyzes user requests and automatically selects the best specialist agent(s) without requiring explicit user mentions.

    Also in 5 projects that use this

  • ciemborSkill

    designing-data-intensive-applications

    Apply Martin Kleppmann-inspired data-system rules when designing reliability, scalability, consistency, replication, transactions, streams, or schema evolution.

    Also in 3 projects that use this

  • ciemborSkill

    implementing-domain-driven-design

    Apply Vaughn Vernon-inspired implementation DDD rules when building aggregates, domain events, repositories, application services, or context integrations.

    Also in 3 projects that use this

  • SKB3002Skill

    nextjs-react-expert

    React and Next.js performance optimization from Vercel Engineering. Use when building React components, optimizing performance, eliminating waterfalls, reducing bundle size, reviewing code for performance issues, or implementing server/client-side optimizations.

    Also in 3 projects that use this

  • xfstudioSkill

    bash-pro

    Master of defensive Bash scripting for production automation, CI/CD

    Also in 4 projects that use this

  • xfstudioSkill

    code-refactoring-tech-debt

    You are a technical debt expert specializing in identifying, quantifying, and prioritizing technical debt in software projects. Analyze the codebase to uncover debt, assess its impact, and create acti

    Also in 4 projects that use this

  • +1 more from xfstudio
  • +1 more from ciembor

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 124 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No abbreviations that save three characters at the cost of a mental lookup.

    line 28
  2. Very specific:

    No dead code, no commented-out code, no console.log left behind — git remembers.

    line 42
  3. Distinctive:

    Don't catch errors you can't handle.

    line 44
  4. Very specific:

    Test behavior, not implementation: query by role/label (getByRole("button", { name: /save/i })), never by class names or test IDs when a …

    line 48
  5. Distinctive:

    Every bug fix gets a test that fails without the fix.

    line 50

“Common” is measured: kept by at least 6 in 10 of the 124 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 Code

Optimize for the next reader. This repo is a template people clone repeatedly — every pattern in it gets copied, so every pattern must be worth copying.

TypeScript discipline

  • Strict mode is on; keep it meaningful: no any, no as unknown as, no ! non-null assertions to silence errors you should fix.
  • Derive types instead of duplicating them: z.infer<typeof Schema>, ComponentProps<typeof Button>, ReturnType<...>.
  • Type function boundaries (params, return values); let inference handle locals.
  • Model states that can't coexist as discriminated unions, not boolean soup (status: "idle" | "loading" | "error" beats isLoading + isError).

Naming

  • Components: PascalCase. Hooks: useCamelCase. Everything else: camelCase. Files: match the main export (user-card.tsx exporting UserCard — kebab-case files, per shadcn convention).
  • Names say what, not how: activeUsers, not filteredArr.
  • Booleans read as predicates: isOpen, hasAccess, canEdit.
  • No abbreviations that save three characters at the cost of a mental lookup.

Structure

  • src/app/ — routes only (pages, layouts, route handlers).
  • src/components/ui/ — shadcn primitives (managed by the CLI, don't hand-edit).
  • src/components/ — shared feature components composed from primitives.
  • src/lib/ — pure utilities, schemas, clients. No React in lib/.
  • Small components: when a component needs a scroll to read, extract pieces.
  • Co-locate what changes together; extract only on the second use, not speculatively.

Functions & flow

  • Early returns over nested if/else pyramids.
  • No dead code, no commented-out code, no console.log left behind — git remembers.
  • Comments explain why (constraints, gotchas), never what the next line does.
  • Don't catch errors you can't handle; let them reach the error boundary with context.

Testing discipline

  • Test behavior, not implementation: query by role/label (getByRole("button", { name: /save/i })), never by class names or test IDs when a semantic query exists.
  • Every bug fix gets a test that fails without the fix.
  • Tests live in src/__tests__/ or co-located as *.test.tsx.

Commits

  • Conventional Commits, enforced by commitlint: feat:, fix:, docs:, refactor:...
  • One logical change per commit; subject in imperative mood, ≤ 72 chars.

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.