Naming Forge
by @jcools1977
Solves the hardest problem in computer science: naming things. Uses linguistic principles, codebase conventions, and semantic analysis to generate precise, c...
clawhub install naming-forgeπ About This Skill
name: naming-forge version: 1.0.0 description: > Solves the hardest problem in computer science: naming things. Uses linguistic principles, codebase conventions, and semantic analysis to generate precise, consistent, discoverable names for variables, functions, types, files, routes, database tables, and everything else that needs a name. Because 'temp2_final_v3' is not a name β it's a cry for help. author: J. DeVere Cooley category: everyday-tools tags: - naming - conventions - readability - linguistics metadata: openclaw: emoji: "βοΈ" os: ["darwin", "linux", "win32"] cost: free requires_api: false tags: - zero-dependency - everyday - code-quality
Naming Forge
> "There are only two hard things in Computer Science: cache invalidation and naming things." β Phil Karlton
What It Does
You need to name a function. It takes a list of orders, filters out cancelled ones, groups them by customer, and returns the totals. You stare at the cursor. processOrders? Too vague. filterAndGroupAndSummarizeOrdersByCustomerExcludingCancelled? Too long. getOrderSummary? Misleading β it does more than "get."
Naming Forge generates names that are precise (says what it does), consistent (matches your codebase's conventions), discoverable (other developers can guess what to search for), and proportional (name length matches scope importance).
The Five Laws of Good Names
Law 1: A Name Should Be a Contract
The name is a promise.calculateTotal promises it calculates and returns a total. If it also sends an email, the name is a lie.BAD: updateUser() β does it update the DB? The UI? Both? What fields?
GOOD: saveUserProfile() β saves the user's profile (to persistent storage)
GOOD: refreshUserDisplay() β updates what the user sees on screen
Law 2: Scope Determines Length
Small scope β short name. Large scope β descriptive name. A loop variable can bei. A public API method should not be.| Scope | Name Length | Example |
|---|---|---|
| Loop variable (3 lines) | 1-2 chars | i, ch, tx |
| Local variable (10-20 lines) | 1 word | total, users, query |
| Private method (module scope) | 1-2 words | parseInput, buildQuery |
| Public method (cross-module) | 2-3 words | calculateOrderTotal, validateAddress |
| Exported constant (global) | 2-4 words | MAX_RETRY_ATTEMPTS, DEFAULT_TIMEOUT_MS |
Law 3: Verbs for Actions, Nouns for Things
Functions do things β verbs. Variables hold things β nouns. Types describe things β nouns/adjectives.FUNCTIONS (verb-first):
βββ get/fetch/load β retrieves data (getSessions, fetchUser, loadConfig)
βββ set/update/save β modifies data (setTheme, updateProfile, saveOrder)
βββ create/build/make β constructs new things (createUser, buildQuery, makeHandler)
βββ delete/remove β eliminates things (deleteAccount, removeItem)
βββ is/has/can/should β returns boolean (isValid, hasPermission, canEdit)
βββ parse/format/transform β converts between formats (parseJSON, formatDate)
βββ validate/check/verify β confirms correctness (validateEmail, checkStatus)
βββ handle/process/on β responds to events (handleClick, processPayment, onSubmit)VARIABLES (noun/adjective):
βββ Collections: plural nouns (users, orders, activeConnections)
βββ Singles: singular nouns (user, order, currentConnection)
βββ Booleans: is/has/can prefix (isLoading, hasErrors, canSubmit)
βββ Counts: noun + Count (retryCount, errorCount, userCount)
βββ Maps/Indices: noun + By + Key (userById, ordersByDate)
Law 4: Consistency Beats Cleverness
If your codebase saysfetchUser, don't introduce retrieveUser. If it says isValid, don't introduce checkValidity. Match what exists.CODEBASE AUDIT:
βββ Existing pattern: fetch* for API calls β USE fetchOrders, NOT getOrders
βββ Existing pattern: *Service for modules β USE PaymentService, NOT PaymentManager
βββ Existing pattern: on* for handlers β USE onSubmit, NOT handleSubmit
βββ Existing pattern: is* for booleans β USE isActive, NOT active or checkActive
Law 5: Avoid Semantic Noise
Words that add length without adding meaning:data, info, item, thing, object, value, manager, handler, processor, helper, utils.BAD: userData, userInfo, userObject β just "user"
BAD: orderItem β just "order" (unless distinguishing from order summary)
BAD: StringHelper, DateUtils β what do they actually do? Be specific.
GOOD: formatDate, parseCSV, slugify β specific actions
The Forge Process
INPUT: What does this thing do? (natural language description)
CONTEXT: What part of the codebase is this in?Phase 1: SEMANTIC EXTRACTION
βββ Extract the core action or concept from the description
βββ Identify: Is this a function, variable, type, file, or route?
βββ Identify: What's the scope? (local, module, public, global)
βββ Identify: What domain vocabulary applies? (business terms, tech terms)
Phase 2: CONVENTION SCAN
βββ Scan existing codebase for naming patterns:
β βββ Verb preferences (get vs. fetch vs. load vs. retrieve)
β βββ Noun preferences (User vs. Account vs. Profile)
β βββ Casing convention (camelCase, snake_case, PascalCase, kebab-case)
β βββ Prefix/suffix patterns (is*, *Service, *Controller, I* for interfaces)
β βββ Domain vocabulary already in use
βββ Identify the dominant convention for this type of name
βββ Flag any existing inconsistencies
Phase 3: CANDIDATE GENERATION
βββ Generate 3-5 candidates following conventions
βββ For each candidate, evaluate:
β βββ Precision: Does the name accurately describe the thing?
β βββ Consistency: Does it match existing patterns?
β βββ Discoverability: Could a teammate guess this name?
β βββ Proportionality: Is the length right for the scope?
β βββ Uniqueness: Does it conflict with any existing name?
βββ Rank candidates by composite score
βββ Flag tradeoffs between candidates
Phase 4: RECOMMENDATION
βββ Top recommendation with rationale
βββ Runner-up alternatives
βββ Names to AVOID (and why)
βββ If renaming: migration impact (how many references to update)
Domain-Specific Naming
API Routes / Endpoints
PATTERN: /resource/action or RESTful conventionGOOD:
βββ GET /users β list users
βββ GET /users/:id β get specific user
βββ POST /users β create user
βββ PUT /users/:id β replace user
βββ PATCH /users/:id β partial update
βββ DELETE /users/:id β delete user
βββ POST /users/:id/verify β action on user (verb as sub-resource)
BAD:
βββ GET /getUsers β verb in path (GET already implies "get")
βββ POST /createNewUser β redundant (POST already implies "create")
βββ GET /user_list β inconsistent casing, use /users
βββ POST /doUserVerification β too verbose, use /users/:id/verify
Database Tables / Columns
TABLES:
βββ Plural nouns: users, orders, payments (not user, order, payment)
βββ Join tables: user_roles, order_items (alphabetical or parent_child)
βββ Consistent casing: snake_case for SQL, camelCase for NoSQL (match your ORM)COLUMNS:
βββ Foreign keys: user_id, order_id (table_singular + _id)
βββ Booleans: is_active, has_verified, can_edit (prefix with state verb)
βββ Timestamps: created_at, updated_at, deleted_at (past_participle + _at)
βββ Counts: login_count, retry_count (noun + _count)
βββ Status: order_status, payment_state (entity + _status/_state)
CSS Classes
PATTERN: BEM (block__element--modifier) or utility classesGOOD:
βββ .card__header--highlighted
βββ .nav__link--active
βββ .form__input--error
βββ .btn--primary, .btn--disabled
BAD:
βββ .redButton β visual, not semantic
βββ .leftSidebar β positional, not semantic
βββ .big β relative to what?
βββ .myComponent β "my" adds nothing
Environment Variables
PATTERN: SCREAMING_SNAKE_CASE, grouped by serviceGOOD:
βββ DATABASE_URL, DATABASE_POOL_SIZE
βββ REDIS_HOST, REDIS_PORT, REDIS_PASSWORD
βββ SMTP_HOST, SMTP_PORT, SMTP_FROM_ADDRESS
βββ APP_SECRET_KEY, APP_DEBUG, APP_LOG_LEVEL
BAD:
βββ db, DB β too short, too ambiguous
βββ databaseUrl β wrong casing for env vars
βββ MY_APP_SETTING β "MY" adds nothing
βββ ENABLE_FEATURE_X β what feature? be specific
Output Format
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β NAMING FORGE β
β Input: "function that takes a list of orders, filters β
β out cancelled ones, groups by customer, returns totals" β
β Scope: Public method in OrderService β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£
β β
β RECOMMENDATION: summarizeActiveOrdersByCustomer β
β βββ Precise: "summarize" = aggregate, "active" = not β
β β cancelled, "by customer" = grouping key β
β βββ Convention match: codebase uses *ByField pattern β β
β βββ Discoverable: searching "order" + "customer" finds it β β
β βββ Proportional: 5 words for a public cross-module method ββ
β β
β ALTERNATIVES: β
β βββ getCustomerOrderTotals β shorter but loses "active" β
β βββ aggregateOrdersByCustomer β "aggregate" is less common β
β β in this codebase (0 uses vs 12 uses of "summarize") β
β βββ calculateCustomerOrderSummary β "calculate" implies β
β math; this is more filter + group β
β β
β AVOID: β
β βββ processOrders β "process" is meaningless β
β βββ getOrderData β "data" is noise β
β βββ doOrderStuff β please β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
When to Invoke
temp, data, result, or thingWhy It Matters
Names are the primary documentation of a codebase. Developers read names thousands of times a day. A precise name eliminates the need to read the implementation. A misleading name causes more damage than no name at all.
You'll spend 10 minutes agonizing over a name, or you'll spend 10 hours explaining what processData actually does. The Forge is faster than either.
Zero external dependencies. Zero API calls. Pure linguistic and codebase analysis.