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.

referencestest-placement-and-isolationunit-tests-mock-physical-boundaries.md

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

Unit tests mock physical boundaries

Unit tests avoid real filesystem, network, database, clock, process, and environment access unless the physical boundary itself is the behavior under test.

Unit tests should keep physical I/O out of the feedback loop by default. The preferred shape is to isolate the unit from operating system and infrastructure boundaries through interfaces, adapters, mocks, fakes, or in-memory substitutes. Strong signs include mocked filesystem clients, in-memory repositories, injected environment readers, injected clocks, explicit fake process runners, and tests that can run in parallel without touching shared physical state. Weak signs include casual OS tmpfile usage, real path assumptions, real environment variable dependence, real subprocess calls, real sockets, real databases, sleeps, and tests that fail because of machine state rather than product behavior. Physical I/O is acceptable only when the test is explicitly proving filesystem, OS, process, or infrastructure semantics that cannot be represented faithfully by a fake. This symptom matters because unit tests should provide immediate behavior feedback without environmental cost or flakiness. Review should ask whether the physical boundary is genuinely the subject of the test. If not, the boundary should be mocked or the test should be reclassified as integration.

Examples

Bad

class ReceiptStore:
  function save(receipt):
    files = OperatingSystemFiles()
    files.write("/receipts/" + receipt.id, receipt.text)
test "saves receipt":
  store = ReceiptStore()
  store.save(receipt)
  assert OperatingSystemFiles().read("/receipts/" + receipt.id) == receipt.text

Good

interface Files:
  write(path, text)
class ReceiptStore(files):
  function save(receipt):
    files.write("/receipts/" + receipt.id, receipt.text)
production = ReceiptStore(OperatingSystemFiles())
test "saves receipt":
  files = mock(Files)
  ReceiptStore(files).save(receipt)
  verify files.write("/receipts/" + receipt.id, receipt.text)

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