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-behaviorcorrectness-under-concurrency-transactions-and-retries-is-explicit.md

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

Correctness under concurrency, transactions, and retries is explicit

The code makes ordering, atomicity, and safe re-entry understandable so concurrency, transaction handling, and repeated execution do not create hidden correctness risks.

Some of the hardest defects come from behavior that is only wrong when timing changes, retries happen, or multiple operations interleave. Concurrency model clarity, transaction boundary clarity, and idempotence all belong to one review lens because they describe whether the system remains correct when work does not happen exactly once in a simple straight line.

Strong signs include explicit ownership of shared mutable state, clear synchronization or scheduling assumptions, well-defined transaction boundaries around integrity-sensitive work, and operations that are intentionally safe or intentionally guarded when duplicate messages, retries, or repeated calls can occur. Weak signs include hidden races, ambiguous ordering requirements, transactions that are much wider or narrower than the invariants they are meant to protect, side effects that can be repeated accidentally, and code that works only if calls happen once and in a socially remembered sequence.

This symptom matters because many systems are retrying, asynchronous, distributed, or simply used by multiple actors at once. Review should therefore ask not only whether the happy path is correct, but whether the implementation stays correct when execution overlaps, partially fails, retries, or resumes. Good code makes those assumptions inspectable. Bad code leaves them implicit and turns correctness into luck.

Examples

Bad

function withdraw(requestId, accountId, amount):
  account = accounts.get(accountId)
  if account.balance < amount: reject
  account.balance -= amount
  accounts.save(account)
  result = withdrawals.insert(requestId, accountId, amount)
  mailer.sendReceipt(result)
  return result

Good

function withdraw(requestId, accountId, amount):
  transaction:
    if withdrawals.contains(requestId): return withdrawals.get(requestId)
    account = accounts.getForUpdate(accountId)
    if account.balance < amount: reject
    account.balance -= amount
    result = withdrawals.insertUnique(requestId, accountId, amount)
    outbox.insertUnique(requestId, ReceiptRequested(requestId, result))
  return result
on ReceiptRequested(e): mailer.send(e.result, idempotencyKey=e.requestId)

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