Code Naming Conventions
Operational naming rules for agentic coding assistants. Apply them as decision rules when generating, reviewing, or renaming identifiers.
Prefer the project's casing and established domain vocabulary, but do not copy semantically wrong names. Read CONVENTIONS.md only when examples or nuance are needed.
Basics
- Use English.
- Follow the language/project casing convention.
- Treat accepted acronyms/domain abbreviations as normal words:
userId, apiUrl, httpClient, UserDto.
- Avoid ad hoc contractions and unclear abbreviations: use
buttonText, not btnTxt.
- Make names short, intuitive, and descriptive.
- Avoid duplicated context: inside
MenuItem, use handleClick, not handleMenuItemClick.
- Name values by how they are consumed: prefer
isDisabled for <Button disabled={isDisabled} />.
Variables
- Variables are nouns or noun phrases that describe the held value.
- Avoid vague names:
data, value, list, info, object, temp, helper, manager, util.
- Numeric values must expose meaning or unit:
itemsCount, itemsTotalPrice, timeoutMs, durationSec, durationMin, distanceKm, priceCents, heightPx, sizeBytes.
- Boundaries use
min / max:
minItemsCount, maxItemsCount, maxDurationSec.
- Nullable expected values use
maybe when nullability is important:
- Prefer state-specific names when clearer:
selectedUser, currentUser, fallbackUser.
- Prefer meaningful defaults when absence has a safe domain meaning:
items = maybeItems ?? [], timeoutMs = maybeTimeoutMs ?? DEFAULT_TIMEOUT_MS.
- Do not hide missing data behind fake defaults:
- avoid
user = maybeUser ?? {}, email = maybeEmail ?? "", priceCents = maybePriceCents ?? 0 unless the default is a valid domain value.
- State transitions use
prev / next:
prevStatus, nextStatus, nextItems.
- Temporal values use clear suffixes:
createdAt, scheduledOn, activeFrom, activeTo, expiresBefore, timeoutMs.
Collections
- Collections are plural:
users, permissions, orders.
- Single values are singular:
- Role/state subsets use role + plural entity:
activeUsers, selectedItems, adminUsers, visibleProducts.
- Lookup collections use values +
By + key:
usersById, urlsBySlug, ordersByCustomerId, fieldErrorsByName.
Booleans
Boolean variables must read as yes/no facts.
Use:
boolean prefix + entity + property/state/capability
Prefixes:
is / are: state, quality, classification.
has: possession or presence.
can: capability or permission.
should: whether an action should happen.
Prefer:
isEmailValid, not isValidEmail.
canUserEditDocument, not userCanEditDocument.
hasUserPermission, not userPermission.
shouldUpdateUrl for action conditions.
Omit the entity only when context already supplies it, such as isEnabled inside button code.
Noun-Verb Words
Some words are nouns and verbs. Use them according to role.
- If used as a value and ambiguity is likely, add context:
queryString, filterParams, updatePayload.
- Natural boundary nouns are allowed:
request, response, command, event.
Constants
- Use upper snake case only for module-level named constants:
MAX_ITEMS_COUNT, TIMEOUT_MS, SUPPORTED_LOCALES.
- Do not use upper snake case for every local
const.
- Enum-like dictionary keys use normal property/variable casing, not capitalized enum-member casing:
roleByName = { admin: "admin", supportAgent: "supportAgent" } as const, not { Admin: "admin", SUPPORT_AGENT: "supportAgent" }.
Classes And Errors
- Class names are singular:
- Collection-like classes use a singular entity plus role suffix:
UserCollection, UserRegistry, OrderRepository, SessionStore.
- Error classes/types end with
Error:
UserNotFoundError, InvalidEmailError, PaymentFailedError.
- Use
error for generic caught errors, not err or e.
- Use contextual error variables when needed:
userCreationError, fieldErrorsByName.
Data Shapes
Use suffixes that describe the shape's role:
Input: internal operation input, e.g. CreateUserInput.
Params: named call/query/route parameters, e.g. SearchParams.
Payload: data sent to another layer/service/event/API, e.g. UserCreationPayload.
Request: full inbound boundary request, e.g. CreateUserRequest.
Response: full outbound boundary response, e.g. CreateUserResponse.
Dto: transfer object across boundaries, e.g. UserDto; use Dto, not DTO.
Record: persistence/storage shape, e.g. UserRecord.
Result: operation outcome, e.g. CreateUserResult.
Avoid UserData, UserInfo, and shape names without a role.
Functions
Functions start with a verb. For non-boolean functions use A/HC/LC:
Action + High Context + optional Low Context
- Action: operation verb, e.g.
fetch, get, build, map.
- High Context: main concept, e.g.
User, Order, AccessLevel.
- Low Context: optional qualifier, e.g.
FromCache, ToDto, CreationPayload; omit when surrounding context already supplies it.
Examples:
fetchUser
listUserMessages
getUserFromCache
buildUserCreationPayload
handleClickOutside
Choose the verb by the function's main operation, including directly wrapped helpers. Do not choose it from the return type alone.
Function Actions
fetch: load external, remote, persisted, or not-yet-loaded data via I/O when no collection-specific action is clearer.
list: load a collection when listing/enumeration is the main operation, especially with pagination/filtering.
create: create a new entity, object instance, service, tool, or local resource.
update: change an existing entity.
delete: permanently delete an entity.
get: read already available state or derive a cheap local value.
set: assign already available state to a new value.
reset: return state to initial value.
remove: detach an item from a collection/relation without deleting it.
infer: derive a conclusion from data/context.
compose: combine existing values into a simple value.
build: construct structured data through mapping/defaults/steps.
map: change object/collection shape without changing the source.
convert: change format, unit, protocol, or representation.
transform: broader structural or semantic change.
check: return a boolean.
assert: throw/fail/narrow if a condition is false.
handle: implement event/callback handling.
Function Action Selection
Choose the action from the function's main intent. The verb should show the primary operation, not just the final return type.
- Inspect directly wrapped helpers; if the wrapper mainly performs that helper's operation, preserve the operation in the wrapper's verb.
- Use I/O verbs such as
fetch, list, create, update, and delete for external, persisted, or not-yet-loaded data.
- Use local verbs such as
get, set, build, compose, map, convert, transform, and infer for already available data or local derivation.
- Async does not decide the verb; the operation does. A function that loads releases and returns the latest version is
fetchLatestVersion, not getLatestVersion.
CRUD
- Use
fetch, list, create, update, delete for external or persisted operations.
- Prefer
fetch for loading a specific resource/response; prefer list for enumerating collections.
- Reserve
get and set for available local state, cache access, cheap derivation, and local assignment.
- Use
remove for detaching from a collection/relation.
- Use
delete for permanent erasure.
Transformations
Use:
map/convert/transform + source + To + target
Prefer:
mapUserToDto
mapUserRecordToUser
convertPriceCentsToDollars
transformLegacyUserToUser
Avoid standalone toUserDto, fromUserRecord, and mapToDto unless the source is already explicit in context, such as inside UserMapper.
Boolean Functions
Boolean-returning functions use:
check + boolean prefix + entity + property/state/capability
The part after check must be a valid boolean variable name.
Prefer:
checkIsEmailValid -> isEmailValid
checkCanUserEditDocument -> canUserEditDocument
checkHasUserPermission -> hasUserPermission
Avoid:
validEmail
checkIsValidEmail
checkUserCanEditDocument
Assertion Functions
Assertion functions use:
assert + boolean prefix + entity + property/state/capability
Use check when returning boolean. Use assert when invalid state should stop execution, throw, fail, or narrow type.
Examples:
assertIsEmailValid
assertCanUserEditDocument
assertHasUserPermission
Events
- Event names describe facts that happened:
userCreated, orderCancelled, paymentFailed.
- Do not name events as commands:
- avoid
createUser, cancelOrder, paymentFail.
- Use
on for callback props/subscriptions:
- Use
handle for handler implementations:
handleClick, handleUserCreated.
1---2name: obey-code-naming3description: Apply concise code naming conventions when generating, reviewing, or refactoring code identifiers. Use for naming variables, constants, enum-like dictionaries, classes, errors, data shapes, functions, events, booleans, nullable/defaulted values, temporal values, collections, and conversion functions in any programming language.4---56# Code Naming Conventions78Operational naming rules for agentic coding assistants. Apply them as decision rules when generating, reviewing, or renaming identifiers.910Prefer the project's casing and established domain vocabulary, but do not copy semantically wrong names. Read `CONVENTIONS.md` only when examples or nuance are needed.1112## Basics1314- Use English.15- Follow the language/project casing convention.16- Treat accepted acronyms/domain abbreviations as normal words: `userId`, `apiUrl`, `httpClient`, `UserDto`.17- Avoid ad hoc contractions and unclear abbreviations: use `buttonText`, not `btnTxt`.18- Make names short, intuitive, and descriptive.19- Avoid duplicated context: inside `MenuItem`, use `handleClick`, not `handleMenuItemClick`.20- Name values by how they are consumed: prefer `isDisabled` for `<Button disabled={isDisabled} />`.2122## Variables2324- Variables are nouns or noun phrases that describe the held value.25- Avoid vague names: `data`, `value`, `list`, `info`, `object`, `temp`, `helper`, `manager`, `util`.26- Numeric values must expose meaning or unit:27 - `itemsCount`, `itemsTotalPrice`, `timeoutMs`, `durationSec`, `durationMin`, `distanceKm`, `priceCents`, `heightPx`, `sizeBytes`.28- Boundaries use `min` / `max`:29 - `minItemsCount`, `maxItemsCount`, `maxDurationSec`.30- Nullable expected values use `maybe` when nullability is important:31 - `maybeUser`.32- Prefer state-specific names when clearer:33 - `selectedUser`, `currentUser`, `fallbackUser`.34- Prefer meaningful defaults when absence has a safe domain meaning:35 - `items = maybeItems ?? []`, `timeoutMs = maybeTimeoutMs ?? DEFAULT_TIMEOUT_MS`.36- Do not hide missing data behind fake defaults:37 - avoid `user = maybeUser ?? {}`, `email = maybeEmail ?? ""`, `priceCents = maybePriceCents ?? 0` unless the default is a valid domain value.38- State transitions use `prev` / `next`:39 - `prevStatus`, `nextStatus`, `nextItems`.40- Temporal values use clear suffixes:41 - `createdAt`, `scheduledOn`, `activeFrom`, `activeTo`, `expiresBefore`, `timeoutMs`.4243## Collections4445- Collections are plural:46 - `users`, `permissions`, `orders`.47- Single values are singular:48 - `user`, `permission`, `order`.49- Role/state subsets use role + plural entity:50 - `activeUsers`, `selectedItems`, `adminUsers`, `visibleProducts`.51- Lookup collections use values + `By` + key:52 - `usersById`, `urlsBySlug`, `ordersByCustomerId`, `fieldErrorsByName`.5354## Booleans5556Boolean variables must read as yes/no facts.5758Use:5960```text61boolean prefix + entity + property/state/capability62```6364Prefixes:6566- `is` / `are`: state, quality, classification.67- `has`: possession or presence.68- `can`: capability or permission.69- `should`: whether an action should happen.7071Prefer:7273- `isEmailValid`, not `isValidEmail`.74- `canUserEditDocument`, not `userCanEditDocument`.75- `hasUserPermission`, not `userPermission`.76- `shouldUpdateUrl` for action conditions.7778Omit the entity only when context already supplies it, such as `isEnabled` inside button code.7980## Noun-Verb Words8182Some words are nouns and verbs. Use them according to role.8384- If used as a value and ambiguity is likely, add context:85 - `queryString`, `filterParams`, `updatePayload`.86- Natural boundary nouns are allowed:87 - `request`, `response`, `command`, `event`.8889## Constants9091- Use upper snake case only for module-level named constants:92 - `MAX_ITEMS_COUNT`, `TIMEOUT_MS`, `SUPPORTED_LOCALES`.93- Do not use upper snake case for every local `const`.94- Enum-like dictionary keys use normal property/variable casing, not capitalized enum-member casing:95 - `roleByName = { admin: "admin", supportAgent: "supportAgent" } as const`, not `{ Admin: "admin", SUPPORT_AGENT: "supportAgent" }`.9697## Classes And Errors9899- Class names are singular:100 - `User`, `Order`, `Payment`.101- Collection-like classes use a singular entity plus role suffix:102 - `UserCollection`, `UserRegistry`, `OrderRepository`, `SessionStore`.103- Error classes/types end with `Error`:104 - `UserNotFoundError`, `InvalidEmailError`, `PaymentFailedError`.105- Use `error` for generic caught errors, not `err` or `e`.106- Use contextual error variables when needed:107 - `userCreationError`, `fieldErrorsByName`.108109## Data Shapes110111Use suffixes that describe the shape's role:112113- `Input`: internal operation input, e.g. `CreateUserInput`.114- `Params`: named call/query/route parameters, e.g. `SearchParams`.115- `Payload`: data sent to another layer/service/event/API, e.g. `UserCreationPayload`.116- `Request`: full inbound boundary request, e.g. `CreateUserRequest`.117- `Response`: full outbound boundary response, e.g. `CreateUserResponse`.118- `Dto`: transfer object across boundaries, e.g. `UserDto`; use `Dto`, not `DTO`.119- `Record`: persistence/storage shape, e.g. `UserRecord`.120- `Result`: operation outcome, e.g. `CreateUserResult`.121122Avoid `UserData`, `UserInfo`, and shape names without a role.123124## Functions125126Functions start with a verb. For non-boolean functions use A/HC/LC:127128```text129Action + High Context + optional Low Context130```131132- Action: operation verb, e.g. `fetch`, `get`, `build`, `map`.133- High Context: main concept, e.g. `User`, `Order`, `AccessLevel`.134- Low Context: optional qualifier, e.g. `FromCache`, `ToDto`, `CreationPayload`; omit when surrounding context already supplies it.135136Examples:137138- `fetchUser`139- `listUserMessages`140- `getUserFromCache`141- `buildUserCreationPayload`142- `handleClickOutside`143144Choose the verb by the function's main operation, including directly wrapped helpers. Do not choose it from the return type alone.145146## Function Actions147148- `fetch`: load external, remote, persisted, or not-yet-loaded data via I/O when no collection-specific action is clearer.149- `list`: load a collection when listing/enumeration is the main operation, especially with pagination/filtering.150- `create`: create a new entity, object instance, service, tool, or local resource.151- `update`: change an existing entity.152- `delete`: permanently delete an entity.153- `get`: read already available state or derive a cheap local value.154- `set`: assign already available state to a new value.155- `reset`: return state to initial value.156- `remove`: detach an item from a collection/relation without deleting it.157- `infer`: derive a conclusion from data/context.158- `compose`: combine existing values into a simple value.159- `build`: construct structured data through mapping/defaults/steps.160- `map`: change object/collection shape without changing the source.161- `convert`: change format, unit, protocol, or representation.162- `transform`: broader structural or semantic change.163- `check`: return a boolean.164- `assert`: throw/fail/narrow if a condition is false.165- `handle`: implement event/callback handling.166167## Function Action Selection168169Choose the action from the function's main intent. The verb should show the primary operation, not just the final return type.170171- Inspect directly wrapped helpers; if the wrapper mainly performs that helper's operation, preserve the operation in the wrapper's verb.172- Use I/O verbs such as `fetch`, `list`, `create`, `update`, and `delete` for external, persisted, or not-yet-loaded data.173- Use local verbs such as `get`, `set`, `build`, `compose`, `map`, `convert`, `transform`, and `infer` for already available data or local derivation.174- Async does not decide the verb; the operation does. A function that loads releases and returns the latest version is `fetchLatestVersion`, not `getLatestVersion`.175176## CRUD177178- Use `fetch`, `list`, `create`, `update`, `delete` for external or persisted operations.179- Prefer `fetch` for loading a specific resource/response; prefer `list` for enumerating collections.180- Reserve `get` and `set` for available local state, cache access, cheap derivation, and local assignment.181- Use `remove` for detaching from a collection/relation.182- Use `delete` for permanent erasure.183184## Transformations185186Use:187188```text189map/convert/transform + source + To + target190```191192Prefer:193194- `mapUserToDto`195- `mapUserRecordToUser`196- `convertPriceCentsToDollars`197- `transformLegacyUserToUser`198199Avoid standalone `toUserDto`, `fromUserRecord`, and `mapToDto` unless the source is already explicit in context, such as inside `UserMapper`.200201## Boolean Functions202203Boolean-returning functions use:204205```text206check + boolean prefix + entity + property/state/capability207```208209The part after `check` must be a valid boolean variable name.210211Prefer:212213- `checkIsEmailValid` -> `isEmailValid`214- `checkCanUserEditDocument` -> `canUserEditDocument`215- `checkHasUserPermission` -> `hasUserPermission`216217Avoid:218219- `validEmail`220- `checkIsValidEmail`221- `checkUserCanEditDocument`222223## Assertion Functions224225Assertion functions use:226227```text228assert + boolean prefix + entity + property/state/capability229```230231Use `check` when returning boolean. Use `assert` when invalid state should stop execution, throw, fail, or narrow type.232233Examples:234235- `assertIsEmailValid`236- `assertCanUserEditDocument`237- `assertHasUserPermission`238239## Events240241- Event names describe facts that happened:242 - `userCreated`, `orderCancelled`, `paymentFailed`.243- Do not name events as commands:244 - avoid `createUser`, `cancelOrder`, `paymentFail`.245- Use `on` for callback props/subscriptions:246 - `onClick`, `onUserCreated`.247- Use `handle` for handler implementations:248 - `handleClick`, `handleUserCreated`.