/samocode:code-clarityfrom samocode
Reviews changed code for human comprehension cost — naming, local reasoning, hidden state, working-memory load — and produces an impact/cost/risk assessment table.
Ships in samocode. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Review changed code for human comprehension cost.
This is review-only. Do not modify code, produce patches, or refactor. Planning or implementing fixes is OUT of scope for this skill — it ends at the report. If the user wants fixes, that is a separate task with its own plan.
Unless the user names a different scope, review the current change set: the
branch diff against the default branch (git diff origin/<default>...HEAD), or
the PR diff if a PR is named. Read enough surrounding code to judge each finding
in context — but only changed code produces findings.
Assume the reader is a competent but busy engineer with little context and limited working memory.
The reader should not have to:
The human reader's cognitive budget is the scarce resource.
Prefer storing information in the code over storing it in the reader's head.
A name should reduce how much context the reader must remember.
Bad:
const data = await load();
const result = process(data);
return handle(result);
Clearer concepts:
const activePolicies = await loadActivePolicies();
const evaluation = evaluatePolicies(activePolicies);
return buildDecision(evaluation);
Report generic or misleading names when their meaning must be remembered from elsewhere.
Do not report short names whose meaning is obvious locally.
Prefer code that can be understood from what is visible nearby.
Bad:
await prepare(user);
await execute(user);
if execute() only works because prepare() invisibly mutated fields on user.
Report hidden dependencies where understanding one operation requires discovering state or assumptions elsewhere.
Ask:
What must the reader know that is not visible here?
A high-level workflow should reveal the important steps.
Easy:
approveWithdrawal
→ validateWithdrawal
→ reserveFunds
→ createTransaction
→ publishApproval
Hard:
approve
→ handle
→ processor.process
→ manager.execute
→ helper.apply
Report navigation that exists only to discover what actually happens.
Every level of indirection should introduce useful meaning.
Look for code that requires the reader to keep multiple unresolved conditions or states in mind.
Example:
if (account) {
if (account.isActive) {
if (!account.isLocked) {
if (request.amount < account.limit) {
...
}
}
}
}
At the inner operation, four conditions must remain active in the reader's mental stack.
Report deep or complicated control flow when understanding the current line requires retaining too much previous context.
Do not complain about branching merely because branching exists.
A function should have an obvious job.
processRequest()
is a clarity problem if it secretly:
validates input
loads an account
updates the database
publishes an event
Important responsibilities and side effects should not disappear behind vague operations.
Also detect the opposite:
processOrder
→ prepareOrder
→ buildOrder
→ createOrderData
→ makeOrder
Good extraction introduces a concept. Bad extraction only moves code somewhere else.
Do not treat duplication as a clarity problem by itself.
Predictable repeated code may be cheaper to understand than generic machinery.
Prefer:
validateEmail(email);
validatePhone(phone);
validateAddress(address);
over an abstraction only if understanding the abstraction requires following configuration, callbacks, factories, or generic dispatch.
Report abstractions that reduce lines of code while increasing the amount of context required to understand them.
Flag code that is compact but requires mentally simulating language semantics.
Examples include complicated expressions, surprising mutation, evaluation-order tricks, or control flow hidden inside expressions.
Ask:
Can the reader understand what this means immediately, or must they execute it in their head?
Compact is not the same as clear.
Make sure the reader can see:
Bad:
let result = parse(input);
result = normalize(result);
result = await save(result);
The reader must continuously update the meaning of result.
Also report important side effects hidden behind innocent-looking operations.
Do not request comments for obvious code.
Report comments when they are misleading, redundant enough to distract, or necessary because an important non-obvious constraint or reason is otherwise invisible.
Comments should add context, not duplicate syntax.
For every piece of changed code ask:
What does the human reader have to remember, infer, navigate to, or mentally execute in order to understand this?
If the answer is "nothing unreasonable", do not report a finding.
If the code is clear, return no findings.
Do not invent stylistic issues to produce output.
Report each finding as:
Issue — concrete clarity problem.
Cognitive cost — exactly what the reader must remember, infer, navigate to, or mentally execute.
Evidence — relevant symbol, function, expression, or call chain (with file:line).
Direction — what information should become more explicit or local.
Do not propose a patch unless a separate task asks for one.
After the detailed findings, close the report with a summary table assessing every finding:
| # | Finding | Clarity impact | Refactoring size | Risk |
|---|
The table is an assessment of the findings, not a plan. Do not order the work, group it into phases, or start fixing. The skill's deliverable is the findings plus this table — nothing more.
Do not review based on line count, personal style, DRY, function size, or abstract "clean code" rules.
Do not produce readability scores.
Do not prefer abstraction simply because it removes duplication.
Do not use your own ability to eventually understand the code as evidence that the code is clear.
The standard is not "Can the agent understand this?"
The standard is "How much of a human's limited attention and working memory does this code consume?"
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
code-review, readability, code-clarity, cognitive-load, pr-review
Generated from the plugin's indexed repository (yuvasee/samocode) — no native marketplace selected
npx claudepluginhub p/yuvasee-samocode20 skills in this plugin
/claudeRun Anthropic Claude CLI as a subagent for second opinions, code reviews, and questions. Use from a Codex (or other) session when you want Claude's perspective./codexRun OpenAI Codex CLI as a subagent for second opinions, code reviews, and questions. Use when you want a different AI model's perspective./comment-hygieneCurate source-code comments and docstrings — delete AI-slop and stale comments, keep only the non-obvious WHY, and never change executable code. Use when cleaning up comments/docstrings, during a samocode cleanup or quality-review step, when running /comment-hygiene, or when reviewing a diff for comment quality. Works in Claude Code and Codex.Other plugins' skills for the same job