Trovella Wiki
HandbookConventions

Naming Patterns

Naming conventions for branches, files, database objects, packages, and identifiers -- and why they are the way they are.

Consistent naming makes code searchable, reviewable, and predictable. This page collects all naming conventions in one place. For the automated enforcement of identifier naming, see Complexity and Naming.

Identifier Naming

Identifier casing is enforced by @typescript-eslint/naming-convention. The full rule configuration and rationale is documented in Complexity and Naming. The summary:

WhatConventionExample
VariablescamelCase (default), PascalCase (React components), UPPER_CASE (constants)userId, UserCard, MAX_RETRIES
FunctionscamelCase, PascalCase (React components)createWidget, WidgetList
Route handlersUPPER_CASE onlyGET, POST, DELETE
ParameterscamelCase, PascalCasetenantId, Component
Types, interfaces, classesPascalCaseCreateWidgetInput, UserProfile
Type parametersPascalCase with T prefixTResult, TItem
Object literal propertiesExempt (match external APIs)--
Type propertiescamelCase, snake_case (external API boundaries)createdAt, model_id
Destructured variablesExempt (match source shape)--

Package Naming

All internal packages use the @repo/ scope. Packages are not published to npm -- the scope is for internal organization only.

PatternConventionExample
Internal packages@repo/<name>@repo/db, @repo/auth, @repo/ai
Config packages@repo/config-<tool>@repo/config-eslint, @repo/config-typescript
App packages@repo/<app-name>@repo/web

File and Directory Naming

WhatConventionExample
Source fileskebab-case.tstenant-context.ts, plan-engine.ts
React componentskebab-case.tsxwidget-card.tsx, sidebar-nav.tsx
Test files<source>.test.tstenant-context.test.ts
Index filesindex.tsRe-exports only; no business logic
Schema fileskebab-case.ts in schema/organizations.ts, ai-usage.ts
Migration filesDrizzle-generated names0001_initial.sql
Feature directorieskebab-caseresearch-engine/, plan-management/

Branch Naming

Branch names come from Linear. Use Linear's suggested format, which ties every branch to a ticket:

kyleolson512/tro-14-phase-0-gate-review
kyleolson512/tro-22-ai-api-layer-claude-api-integration

The pattern is: <github-username>/<ticket-id>-<slug>.

Git Worktree Naming

When using git worktrees for parallel agent development:

git worktree add .trees/<feature-name> -b feature/<feature-name>

The .trees/ directory is gitignored. Worktree branches use the feature/<name> prefix.

Database Object Naming

WhatConventionExample
Tablessnake_case, pluralorganizations, ai_usage, research_plans
Columnssnake_casecreated_at, organization_id, model_id
Foreign keys<referenced_table_singular>_iduser_id, organization_id
IndexesDrizzle-generated (based on columns)--
Enumssnake_caseplan_status, org_type
Enum valuessnake_casein_progress, completed, failed

Environment Variable Naming

WhatConventionExample
Server-side env varsUPPER_SNAKE_CASEDATABASE_URL, BETTER_AUTH_SECRET
Client-side env varsNEXT_PUBLIC_ prefixNEXT_PUBLIC_APP_URL
Locationapps/web/.env (not root .env)--

The root .env is only used by database scripts. Application env vars go in apps/web/.env.

Linear Ticket Naming

WhatConventionExample
Ticket IDsTRO-<number>TRO-22, TRO-97
Labelskebab-casefoundation, week-2, doc-update-request
MilestonesDescriptive name"Document Update Requests"

On this page