AgentSkillsCN

naming-conventions

践行通用命名原则:避免使用“Manager”“Helper”“Util”等术语,选用能清晰传达意图的命名,善用领域语言,采用“动词+名词”的函数命名方式。

SKILL.md
--- frontmatter
name: naming-conventions
user-invocable: false
description: "Apply universal naming principles: avoid Manager/Helper/Util, use intention-revealing names, domain language, verb+noun functions."
allowed-tools:
  - Read
  - Grep

Naming Conventions

Universal principles for clear, intention-revealing names. Language-agnostic.

Core Principle

Names reveal intent and domain, not implementation.

  • users not userArray
  • calculateTax not doTaxCalculation
  • PaymentProcessor not PaymentManager

Prohibited Patterns

NEVER: Manager, Helper, Util, Misc, Common, temporal names (step1, doFirst) RARELY: Service, Handler, Processor (acceptable when domain-specific)

Positive Patterns

TypePatternExamples
VariablesDescriptive nounsactiveUsers, totalRevenue
FunctionsVerb + nouncalculateTotal, fetchUser, formatDate
BooleansQuestion prefixisActive, hasPermission, canEdit
ClassesSingular nounUser, PaymentProcessor, OrderRepository
CollectionsPlural nounsusers, items, userById (keyed)

Function Verbs

  • Pure: describe transformation (format, parse, convert)
  • Side effects: verb implies action (save, send, fetch, update, delete)
  • Boolean returns: question prefix (is, has, can, should)
  • Avoid: get, do, handle, manage, process (without context)

Boolean Prefixes

  • is: State (isActive, isLoading, isValid)
  • has: Possession (hasPermission, hasChildren)
  • can: Capability (canEdit, canDelete)
  • should: Conditional (shouldRefetch, shouldValidate)

Collections

  • Plural indicates multiple: users, selectedItems
  • Keyed: userById, configByEnv, productsByCategory
  • Never: userList, userArray, userCollection

Context-Aware Exceptions

  • Framework patterns: EventBus, RequestHandler (convention)
  • Repository pattern: UserRepository (suffix adds meaning)
  • Factory pattern: UserFactory (pattern clarifies purpose)

Philosophy

"If you can't name it, you don't understand it."

Naming forces design decisions. Bad names indicate unclear thinking. Use domain language. Names are for humans, not compilers.