Index of every page on this site: llms.txt
All skills
meza avatar

/clean-code

@982e21e
by mezameza/skills2 stars
Run it yourself

Use when designing, writing, refactoring, reviewing, or explaining code, tests, APIs, modules, or architecture. Provides a progressive catalog of clean-code qualities covering comprehension, domain modeling, state and failure behavior, boundaries, evolvability, operability, safety, and test design.

Use this Skill: https://skilld.dev/gh/meza/skills/clean-code

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencescomprehension-and-intentfunction-shape-is-cohesive-and-tractable.md

≈555 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Function shape is cohesive and tractable

A function has one clear job, stays small enough to understand as a whole, and takes a set of inputs that reflects its true responsibility.

A good function is cohesive in purpose, tractable in size, and honest about what it depends on. These properties reinforce each other. When a function truly has one job, its flow tends to stay compact enough to hold in working memory, and its parameters tend to reflect the minimum meaningful inputs for that responsibility rather than a grab bag of context.

Strong signs include a function whose name describes one responsibility, whose internal steps all serve that responsibility, whose size does not force the reader through multiple unrelated conceptual phases, and whose parameters reveal the data or collaborators the function genuinely needs. Weak signs include orchestration, validation, transformation, persistence, logging, and formatting all mixed together; long functions that scroll through several mental modes; parameter lists that are bloated, generic, or obviously shaped around caller convenience; and context objects passed only because the function has unclear boundaries.

This symptom matters because function shape is where maintainability is often won or lost. Overgrown or unfocused functions become hard to review, hard to test, and hard to change without collateral damage. A cohesive and bounded function makes intent visible, isolates reasons to change, and gives reviewers a realistic chance of understanding the whole unit rather than merely skimming fragments of it.

Examples

Bad

function processOrder(order, pricing, invoices, mailer, logger):
  require order.hasItems()
  total = pricing.totalFor(order.items)
  invoice = Invoice(order.customer, total)
  invoices.save(invoice)
  mailer.send(invoice)
  logger.record("invoice sent")

Good

function fulfillOrder(order, pricing, invoices, mailer, logger):
  invoice = createInvoice(order, pricing)
  invoices.save(invoice)
  mailer.send(invoice)
  logger.record("invoice sent")

function createInvoice(order, pricing):
  require order.hasItems()
  return Invoice(order.customer, pricing.totalFor(order.items))

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts28d3 checks · Risk SAFE
  • Gen Agent Trust Hub28d

    The skill 'clean-code' is a comprehensive educational catalog of software engineering principles and clean-code qualities. It provides structured guidance and pseudocode examples to help AI agents reason about code quality, security, and maintainability. No malicious code, hidden instructions, or security risks were identified during the analysis.

  • Socket28d

    No alerts

  • Snyk28d

    Risk: LOW · No issues

Signed by skilld at 982e21e. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 weeks ago.

Activeupdated 3 months ago

README badge

README badge for meza/skills/clean-code