modules/home/programs/cli-agents/shared/skills/coding/cognitive-load/SKILL.md
Reduce cognitive load when writing, reviewing, or refactoring code. Use when code should be simpler, more local, and easier to understand while preserving behavior.
npx skillsauth add not-matthias/dotfiles-nix cognitive-loadInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Write code for human working memory first.
A maintainer should not need to remember many hidden facts, jump through many layers, or understand clever tricks to verify what the code does. Preserve behavior, but prefer the version with fewer moving parts and fewer active mental chunks.
Minimize extraneous cognitive load.
Intrinsic complexity belongs to the problem. Extraneous complexity comes from how the code is shaped. Remove the extraneous part.
Use this skill when:
Look for facts the reader must keep in memory:
Reduce the number of facts the reader must remember at once.
Prefer:
Avoid:
if / else trees.Extract complex boolean expressions into named intermediate values.
Bad:
if value > limit && (user.canEdit || user.isOwner) && !resource.locked
Better:
isWithinLimit = value > limit
canModify = user.canEdit || user.isOwner
isUnlocked = !resource.locked
if isWithinLimit && canModify && isUnlocked
Names must describe intent, not repeat syntax.
Prefer deep modules:
Avoid shallow modules:
Do not add a helper, class, trait, interface, hook, factory, service, or module unless it removes more cognitive load than it adds.
Some duplication is cheaper than an abstraction.
Keep duplication when:
Abstract only when:
Prefer the smallest language subset that clearly solves the problem.
Avoid clever constructs when they require specialized knowledge or hide control flow, allocation, lifetime, error handling, or side effects.
Use advanced features only when they make the code easier to understand for maintainers of this project.
Do not write comments that restate the code.
Write comments only for:
If better names or structure make the comment unnecessary, change the code instead.
Before finishing, check:
Avoid these unless the project already depends on them and changing them is out of scope:
Manager, Processor, Handler, or Factory names with unclear domain meaning.A good change has the same behavior with fewer things to remember.
If simplification and minimal diff conflict, preserve correctness first, then choose the smallest simplification that removes real cognitive load.
documentation
Save notes, journal entries, and research to the personal-notes Obsidian vault (personal-vault-v2). Use when the user asks to 'save note', 'save to notes', 'write to personal notes', 'save to daily notes', 'note this down', or wants to persist findings/analysis to their personal vault.
documentation
Use whenever the user asks to address, fix, resolve, review, or respond to pull-request comments or review feedback.
development
Apply Not Matthias's Rust-first personal coding style. Use whenever the user explicitly asks to apply or review their code style, make Rust match their preferences, perform a style pass, or simplify/refactor according to their conventions. Inspect only task-touched code, honor local project conventions first, and make only safe opt-out style edits.
development
Guide for writing ast-grep rules to perform structural code search and analysis. Use when users need to search codebases using Abstract Syntax Tree (AST) patterns, find specific code structures, or perform complex code queries that go beyond simple text search. This skill should be used when users ask to search for code patterns, find specific language constructs, or locate code with particular structural characteristics.