theswerd avatar

Self Documenting Code

Self-documenting code guide that splits logic into semantic and pragmatic functions and models with compile-time-safe shapes.

CCM score
50 of 100
skills.sh installs
152
GitHub stars
6
last updated
Jun 3, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers how to split logic into semantic functions (reusable, side-effect-free building blocks) and pragmatic functions (messy production flows)
  • Explains that models should make invalid states unrepresentable, using composed types and brand types like DocumentId(UUID) to prevent ID mix-ups
  • Guards against drift by naming functions after where they are used and splitting models whose fields stop cohering around their name
  • Designed for teams maintaining long-lived codebases where humans and agents must read code without relying on comments

Install

$ npx -y skills add theswerd/aicode --skill self-documenting-code -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Code should be self documenting

How you split logic into functions and shape the data they pass around determines how well a codebase holds up over time.

Semantic Functions

Semantic functions are the building blocks of any codebase, a good semantic function should be as minimal as possible in order to prioritize correctness in it. A semantic function should take in all required inputs to complete its goal and return all necessary outputs directly. Semantic functions can wrap other semantic functions to describe desired flows and usage; as the building blocks of the codebase, if there are complex flows used everywhere that are well defined, use a semantic function to codify them.

Details

Repository
github.com/theswerd/aicode
Categories
Code Review & Quality, Technical Documentation
First seen
Jun 3, 2026

Similar to Self Documenting Code

More Code Review & Quality