AgentSkillsCN

naming-review

依据清晰性原则对命名进行审核,查找专业术语、语义模糊之处以及前后不一致的表述。

SKILL.md
--- frontmatter
name: naming-review
description: Review names for clarity principles. Find jargon, ambiguity, inconsistency.

/naming-review [path]

Review names in code or configuration for clarity, consistency, and intent.

"Say what you mean, simply and directly."

Also Detect: AI-Generated Naming Antipatterns

In addition to clarity-style naming issues, flag these AI naming smells:

AntipatternExampleProblem
Enterprise suffixesUserManager, DataHandler, ServiceHelperVague, adds no information
Unnecessary prefixesIUserService, AbstractBaseHungarian notation for types
Generic -er namesProcessor, Handler, ManagerSays nothing about what it does
Impl suffixesUserServiceImplOnly one implementation exists
Over-qualified namesUserEntityDataModelObjectAfraid to commit to a name

A name should say what it IS, not what category it belongs to.


Process

Step 1: Collect Names

Gather all names in scope:

  • Function/method names
  • Variable names
  • Class/type names
  • File/directory names
  • Config keys
  • CLI commands/flags
  • API endpoints

Step 2: Apply Naming Principles

Review each name against these criteria:

Naming Principles

1. Say What It Does (Clarity)

Names should describe behavior, not implementation.

BadGoodWhy
processData()validateUserInput()Says what it actually does
doStuff()sendEmailNotification()Specific action
handle()retryFailedPayment()Reveals intent

2. Verbs for Actions, Nouns for Things (Clean Code)

TypePatternExamples
Functions that DOverb-nouncreateUser, deleteFile, validateInput
Functions that ASKis/has/canisValid, hasPermission, canRetry
Classes/TypesnounUser, PaymentProcessor, FileReader
Booleansis/has/shouldisActive, hasErrors, shouldRetry

3. Consistent Patterns (Google Style)

Pick a pattern and stick to it across the codebase:

PatternStick WithDon't Mix
get/setgetUser, setUserfetchUser, updateUser
create/deletecreateOrder, deleteOrdernewOrder, removeOrder
start/stopstartJob, stopJobbeginJob, endJob
read/writereadFile, writeFileloadFile, saveFile

4. No Jargon or Insider Terms

Names should be clear to someone new to the codebase.

JargonClearWhy
canonReportskillUsageReport"Canon" is internal terminology
ralphLoopKeep if documentedProper noun, acceptable if explained
PSFpageSortFilterAbbreviations obscure meaning
ctxcontextDon't abbreviate unnecessarily

5. No Abbreviations (Unless Universal)

AcceptableUnacceptable
id, url, html, apiusr, msg, btn, cfg
max, min, avgcnt, idx, tmp
async, syncdb (use database)

6. Length Matches Scope (Code Complete)

ScopeLengthExample
Loop counter1 chari, j, k
Local variableshortuser, count
Function parametermediumuserId, filterOptions
Class fielddescriptiveactiveUserCount, lastLoginDate
Global/exportedvery clearMAX_RETRY_ATTEMPTS, defaultTimeoutMs

7. Suffix Patterns for Behavior

Use consistent suffixes to signal behavior:

SuffixMeaningExamples
-scanRead-only, reportsgemini-scan, qodana-scan
-fixModifies, repairsgemini-fix, dedupe-fix
-checkValidates, returns booltype-check, lint-check
-reportGenerates outputskill-usage-report
-configConfiguration objectappConfig, dbConfig
-handlerEvent/request handlererrorHandler, clickHandler
-factoryCreates instancesuserFactory, connectionFactory

8. Prefix Patterns for Type

PrefixMeaningExamples
is-, has-, can-BooleanisActive, hasError
get-, fetch-Retrieves datagetUser, fetchOrders
set-, update-Modifies datasetName, updateStatus
create-, build-Constructs newcreateUser, buildQuery
delete-, remove-DestroysdeleteFile, removeItem
on-Event handleronClick, onSubmit

Output Format

markdown
## Naming Review: [target]

### Summary

| Metric | Value |
|--------|-------|
| Names reviewed | N |
| Issues found | N |
| Patterns broken | N |

### Issues Found

#### Unclear Names 🔴

| Current | Problem | Suggested |
|---------|---------|-----------|
| `processData()` | Vague verb | `validateUserInput()` |
| `handle()` | Says nothing | `routeHttpRequest()` |

#### Jargon/Abbreviations 🟠

| Current | Problem | Suggested |
|---------|---------|-----------|
| `getPSF()` | Abbreviation | `getPageSortFilter()` |
| `canonPath` | Insider jargon | `skillLibraryPath` |

#### Inconsistent Patterns 🟡

| Pattern A | Pattern B | Recommendation |
|-----------|-----------|----------------|
| `getUser` | `fetchOrder` | Standardize on `get-` |
| `createFile` | `newDirectory` | Standardize on `create-` |

#### Wrong Part of Speech 🟡

| Current | Problem | Suggested |
|---------|---------|-----------|
| `validation()` | Noun for action | `validate()` |
| `active` (function) | Adjective for action | `isActive()` or `activate()` |

### Patterns Detected

- [x] Consistent get/set usage
- [ ] Mixed create/new usage
- [x] Boolean prefixes (is/has)
- [ ] Unclear abbreviations

### Recommendations

1. **Standardize on `create-`** — Replace `new-` prefix with `create-`
2. **Expand abbreviations** — `cfg` → `config`, `msg` → `message`
3. **Add verb to vague names** — `data()` → `fetchData()` or `processData()`

---
NAMES_REVIEWED: N
ISSUES_FOUND: N
NAMING_REVIEW_COMPLETE: yes

Rules

  • BE SPECIFIC — Point to exact names, not vague categories
  • SUGGEST ALTERNATIVES — Don't just criticize, propose better names
  • CHECK CONSISTENCY — Same concept should use same words everywhere
  • RESPECT CONTEXT — Domain terms (medical, financial) may look like jargon but are correct

When to Use

  • Before PR review
  • After major refactoring
  • Onboarding new codebase
  • API design review
  • CLI/config design

Anti-Patterns (Don't Do)

  • Renaming without understanding context
  • Enforcing personal preference over team conventions
  • Flagging domain-specific terms as jargon
  • Suggesting longer names just to be "clearer"
  • Ignoring existing codebase conventions