Intent Clarity Audit
What This Skill Does
Audits source code for patterns that make it harder to understand what the code
is doing and why. Focuses on five categories of intent obscurity:
- Unclear names: Single-letter variables outside tiny loops, generic names
(
data, temp, result, val, info, item) in non-trivial scopes,
abbreviated names that sacrifice readability.
- Nested ternaries: Ternary or conditional expressions nested two or more
levels deep.
- Unnamed boolean parameters: Function calls passing bare
true/false
literals without a named parameter, comment, or object wrapper to explain
the meaning.
- Overly clever one-liners: Dense expressions that chain multiple
operations, bitwise tricks used for non-bitwise purposes, regex used inline
without explanation, or reduce/fold with complex accumulators.
- Restating comments: Comments that describe what the next line does rather
than why (e.g.,
// increment counter before counter++).
Reports findings with file:line, the offending snippet, the category, and a
brief explanation of why it harms clarity.
When To Use
- On a weekly schedule to audit recently changed files.
- After a large feature branch merges.
- When reviewing code written by unfamiliar contributors.
- When the user asks to "find unclear code" or "audit code clarity".
Do Not Use
- For method length — use
hone:method-brevity-audit instead.
- For duplicated code — use
hone:duplication-hunt instead.
- For test naming — use
hone:test-naming-audit instead.
- For naming specificity (Manager, Handler, Utils) — use
hone:naming-specificity-audit instead.
- To rewrite code. This skill reports findings only.
Inputs To Confirm
- Scope: Which directories or file patterns to scan (default: files changed
in the last 14 days per git log, falling back to entire repo if no git
history).
- Recency window: Number of days to look back for changed files (default:
14).
- Categories: Which of the five categories to check (default: all).
- Exclusions: Glob patterns for files or directories to skip.
- Top-N: Maximum findings to report (default: 25).
Instructions
Determine file scope. If git history is available, run
git log --since="<N> days ago" --diff-filter=ACMR --name-only to get
recently changed files. Deduplicate and filter to source files only. If git
is unavailable, scan the full tree (respecting exclusions).
Exclude non-source files. Skip vendored directories, build output,
generated files, lock files, binary files, and user-specified exclusions.
Scan each file for all enabled categories. For each source file:
a. Unclear names: Identify variable, parameter, and function declarations.
Flag single-character names outside for/while loop indices of 5 lines
or fewer. Flag generic names (data, temp, result, val, info,
item, obj, thing, stuff, foo, bar, x, y outside math)
in scopes longer than 3 lines.
b. Nested ternaries: Find ternary operators (?: in C-family,
if/else inline in Python, etc.) where a ternary appears inside another
ternary expression.
c. Unnamed booleans: Find function/method calls with bare boolean
literal arguments. Exclude well-known single-boolean APIs (e.g.,
setVisible(true), Array.sort(reverse=true) with keyword syntax).
d. Clever one-liners: Flag lines that combine 3+ chained operations,
use bitwise operators in non-bitwise contexts, contain inline regex
longer than 40 characters without a comment, or use reduce/fold with
accumulators longer than one line.
e. Restating comments: Find comments directly above or inline with code
where the comment merely describes the operation (e.g., "add 1 to x"
above x += 1). Use simple heuristic: if the comment contains the same
verbs/nouns as the code tokens, flag it.
Classify severity. For each finding assign a severity:
- High: Nested ternaries 3+ deep, single-letter names in 20+ line
scopes, boolean parameters in public API calls.
- Medium: Two-level nested ternaries, generic names in 5-20 line scopes,
clever one-liners.
- Low: Restating comments, minor naming issues.
Rank and truncate. Sort by severity (high first), then by file path for
grouping. Truncate to top-N.
Produce the report per Output Requirements.
Output Requirements
Produce a Markdown report:
# Intent Clarity Audit
**Repo**: <repo name>
**Scope**: <N> files changed in last <D> days | **Findings**: <count>
## Findings
### High Severity
| # | Category | File | Line | Snippet | Why |
|---|----------|------|------|---------|-----|
| 1 | Nested ternary | src/parser.ts | 142 | `a ? b ? c : d : e` | 2-level nested ternary obscures control flow |
### Medium Severity
| ... |
### Low Severity
| ... |
## Summary
- **By category**: 5 unclear names, 3 nested ternaries, 2 unnamed booleans, ...
- **Hotspot files**: file1.ts (7 findings), file2.py (4 findings)
- **Trend**: [if prior run data available, compare finding counts]
Every finding must reference a real file path and line number. Snippets must be
actual code from the file, truncated to fit a table cell (max 80 characters).
Quality Bar
- Every finding must be verifiable at the stated file:line.
- Snippets must be real code, not fabricated examples.
- Severity assignments must follow the criteria defined in step 4.
- Do not flag idiomatic patterns that are universally understood in the
language (e.g.,
i in a 3-line for loop, _ for unused variables).
- Do not flag code in test fixtures or snapshot files.
- If no findings exist, state that explicitly.
- Keep the "Why" column concise (one sentence) and specific to the finding.
1---2name: hone-intent-clarity-audit3description: Finds code that obscures its intent: unclear variable names, nested ternaries, boolean parameters without names, overly clever one-liners, and comments that restate code instead of explaining why. Focuses on recently changed files. Do NOT use for method length, duplication, or test naming concerns.4---56# Intent Clarity Audit78## What This Skill Does910Audits source code for patterns that make it harder to understand what the code11is doing and why. Focuses on five categories of intent obscurity:12131. **Unclear names**: Single-letter variables outside tiny loops, generic names14 (`data`, `temp`, `result`, `val`, `info`, `item`) in non-trivial scopes,15 abbreviated names that sacrifice readability.162. **Nested ternaries**: Ternary or conditional expressions nested two or more17 levels deep.183. **Unnamed boolean parameters**: Function calls passing bare `true`/`false`19 literals without a named parameter, comment, or object wrapper to explain20 the meaning.214. **Overly clever one-liners**: Dense expressions that chain multiple22 operations, bitwise tricks used for non-bitwise purposes, regex used inline23 without explanation, or reduce/fold with complex accumulators.245. **Restating comments**: Comments that describe what the next line does rather25 than why (e.g., `// increment counter` before `counter++`).2627Reports findings with file:line, the offending snippet, the category, and a28brief explanation of why it harms clarity.2930## When To Use3132- On a weekly schedule to audit recently changed files.33- After a large feature branch merges.34- When reviewing code written by unfamiliar contributors.35- When the user asks to "find unclear code" or "audit code clarity".3637## Do Not Use3839- For method length — use `hone:method-brevity-audit` instead.40- For duplicated code — use `hone:duplication-hunt` instead.41- For test naming — use `hone:test-naming-audit` instead.42- For naming specificity (Manager, Handler, Utils) — use43 `hone:naming-specificity-audit` instead.44- To rewrite code. This skill reports findings only.4546## Inputs To Confirm47481. **Scope**: Which directories or file patterns to scan (default: files changed49 in the last 14 days per git log, falling back to entire repo if no git50 history).512. **Recency window**: Number of days to look back for changed files (default:52 14).533. **Categories**: Which of the five categories to check (default: all).544. **Exclusions**: Glob patterns for files or directories to skip.555. **Top-N**: Maximum findings to report (default: 25).5657## Instructions58591. **Determine file scope.** If git history is available, run60 `git log --since="<N> days ago" --diff-filter=ACMR --name-only` to get61 recently changed files. Deduplicate and filter to source files only. If git62 is unavailable, scan the full tree (respecting exclusions).63642. **Exclude non-source files.** Skip vendored directories, build output,65 generated files, lock files, binary files, and user-specified exclusions.66673. **Scan each file for all enabled categories.** For each source file:6869 a. **Unclear names**: Identify variable, parameter, and function declarations.70 Flag single-character names outside `for`/`while` loop indices of 5 lines71 or fewer. Flag generic names (`data`, `temp`, `result`, `val`, `info`,72 `item`, `obj`, `thing`, `stuff`, `foo`, `bar`, `x`, `y` outside math)73 in scopes longer than 3 lines.7475 b. **Nested ternaries**: Find ternary operators (`?:` in C-family,76 `if/else` inline in Python, etc.) where a ternary appears inside another77 ternary expression.7879 c. **Unnamed booleans**: Find function/method calls with bare boolean80 literal arguments. Exclude well-known single-boolean APIs (e.g.,81 `setVisible(true)`, `Array.sort(reverse=true)` with keyword syntax).8283 d. **Clever one-liners**: Flag lines that combine 3+ chained operations,84 use bitwise operators in non-bitwise contexts, contain inline regex85 longer than 40 characters without a comment, or use reduce/fold with86 accumulators longer than one line.8788 e. **Restating comments**: Find comments directly above or inline with code89 where the comment merely describes the operation (e.g., "add 1 to x"90 above `x += 1`). Use simple heuristic: if the comment contains the same91 verbs/nouns as the code tokens, flag it.92934. **Classify severity.** For each finding assign a severity:94 - **High**: Nested ternaries 3+ deep, single-letter names in 20+ line95 scopes, boolean parameters in public API calls.96 - **Medium**: Two-level nested ternaries, generic names in 5-20 line scopes,97 clever one-liners.98 - **Low**: Restating comments, minor naming issues.991005. **Rank and truncate.** Sort by severity (high first), then by file path for101 grouping. Truncate to top-N.1021036. **Produce the report** per Output Requirements.104105## Output Requirements106107Produce a Markdown report:108109```markdown110# Intent Clarity Audit111112**Repo**: <repo name>113**Scope**: <N> files changed in last <D> days | **Findings**: <count>114115## Findings116117### High Severity118119| # | Category | File | Line | Snippet | Why |120|---|----------|------|------|---------|-----|121| 1 | Nested ternary | src/parser.ts | 142 | `a ? b ? c : d : e` | 2-level nested ternary obscures control flow |122123### Medium Severity124125| ... |126127### Low Severity128129| ... |130131## Summary132133- **By category**: 5 unclear names, 3 nested ternaries, 2 unnamed booleans, ...134- **Hotspot files**: file1.ts (7 findings), file2.py (4 findings)135- **Trend**: [if prior run data available, compare finding counts]136```137138Every finding must reference a real file path and line number. Snippets must be139actual code from the file, truncated to fit a table cell (max 80 characters).140141## Quality Bar142143- Every finding must be verifiable at the stated file:line.144- Snippets must be real code, not fabricated examples.145- Severity assignments must follow the criteria defined in step 4.146- Do not flag idiomatic patterns that are universally understood in the147 language (e.g., `i` in a 3-line for loop, `_` for unused variables).148- Do not flag code in test fixtures or snapshot files.149- If no findings exist, state that explicitly.150- Keep the "Why" column concise (one sentence) and specific to the finding.