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.

referencesstate-effects-and-failure-behaviorerror-semantics-are-intentional-and-consistent.md

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

Error semantics are intentional and consistent

Failures are surfaced in deliberate, diagnosable, and system-consistent ways, without silent semantic drift, swallowed exceptions, or arbitrary local error styles.

Error handling is part of the contract of a system, not cleanup logic added after the happy path. Good code makes it clear what can fail, how failure is represented, what degradation is acceptable, and what must be surfaced immediately. It also uses the same broad error vocabulary and handling style across similar situations so that callers and operators do not have to relearn failure semantics for each module.

Strong signs include explicit failure modes, consistent representation of similar errors, propagation or transformation that preserves meaning, and fallback behavior that either preserves semantics or clearly signals degradation. Weak signs include catch-all blocks that erase useful information, silent fallback paths that change what the system means, modules that mix exceptions, return codes, logs, and null-like sentinels arbitrarily, and error handling that leaves the system in an unclear state.

This symptom matters because many serious defects are not caused by the initial failure but by confusion about what the failure meant. Inconsistent or hidden error semantics make systems difficult to diagnose, difficult to integrate with safely, and easy to corrupt under stress. A reviewer should be able to see not only that failures are handled, but that they are handled truthfully and in line with the rest of the system.

Examples

Bad

function loadOrder(id):
  try: return orders.find(id)
  catch NotFound: return null
  catch error:
    log("load failed")
    return null

Good

function loadOrder(id) -> Result<Order, OrderFailure>:
  try: return Ok(orders.find(id))
  catch NotFound as cause:
    return Err(OrderFailure.NotFound(orderId: id, cause: cause))
  catch Timeout or ConnectionFailure as cause:
    return Err(OrderFailure.Unavailable(orderId: id, cause: cause))

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