/superpowers:writing-readable-codefrom superpowers
Use when writing or modifying code in any language — guides naming, comments, and structure for readability and maintainability
Ships in superpowers. 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.
None: SKILL.md is the whole skill.
Code is read far more than it is written. Optimize for the reader.
Related: For file and folder organization, see superpowers:structuring-projects. For robustness and edge case coverage, see superpowers:test-driven-development — TDD supports implementation but should never be its sole driver.
Name by what it is or does, not by type or implementation.
# Bad
d = 86400 # what is d?
xs = get(u, True) # what are xs, u?
strName = "Ada" # type prefix adds nothing
# Good
seconds_per_day = 86400
active_users = get_users(include_archived=True)
name = "Ada"
remaining_attempts, not rem_attis_valid, has_children, can_retrysend_invoice, parse_configdata, info, temp, result — say what data, what resultComment the why, never the what. The code already says what.
# Bad — restates the code
i += 1 # increment i
# Good — explains a non-obvious reason
i += 1 # off-by-one: API pages are 1-indexed but our list is 0-indexed
When to comment:
When NOT to comment:
Every public function and class gets a docstring. Both humans and AI agents read these to understand intent without reading the body.
# Bad — no docstring, caller must read the implementation
def retry(fn, n, delay):
...
# Good — intent, params, and return value are clear
def retry(fn, max_attempts, delay_seconds):
"""Call fn up to max_attempts times, sleeping delay_seconds between tries.
Returns the result of fn on success.
Raises the last exception if all attempts fail.
"""
...
A good docstring answers:
Skip docstrings on trivial helpers where the name says everything (is_empty, to_json).
Small, focused units. Each function does one thing and its name says what.
Early returns over deep nesting:
# Bad — hard to follow
def process(order):
if order:
if order.is_valid():
if order.has_items():
# actual logic buried 3 levels deep
...
# Good — guard clauses first
def process(order):
if not order:
return
if not order.is_valid():
raise InvalidOrderError(order.id)
if not order.has_items():
return
# actual logic at top level
...
Avoid boolean parameters that change behavior — they hide two functions in one:
# Bad — caller must know what True means
send_email(user, True)
# Good — intent is obvious
send_email(user, include_attachment=True)
# or split: send_email(user) / send_email_with_attachment(user)
TODO without a concrete trigger for when to act on itWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub satishsolanki1990/ss-superpowers --plugin superpowers17 skills in this plugin
/brainstormingUse when building new features or components that involve meaningful design decisions, ambiguous requirements, or architectural changes — not needed for clear, well-scoped modifications to existing code/diagnosing-superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness./dispatching-parallel-agents