naming-conventions
Consistent naming patterns for files, variables, types, and exports
When & Why to Use This Skill
This Claude skill establishes a standardized framework for naming conventions in software development, covering files, variables, types, and exports. By enforcing consistent patterns like kebab-case for filenames and PascalCase for TypeScript interfaces, it enhances code maintainability, reduces cognitive load for developers, and ensures a professional, unified codebase across team projects. It is an essential tool for maintaining clean code standards and improving long-term project scalability.
Use Cases
- Standardizing Project Structure: Automatically applying kebab-case for React components and project files to ensure cross-platform compatibility and a clean, predictable directory hierarchy.
- Enforcing TypeScript Best Practices: Implementing PascalCase for types and interfaces while utilizing descriptive generics (e.g., TItem instead of T) to improve type safety and developer experience.
- Refactoring Boolean Logic: Enhancing code readability by prefixing boolean variables with 'is', 'has', 'can', or 'should', making conditional logic self-documenting and easier to audit.
- Modernizing Legacy Codebases: Identifying and replacing outdated patterns, such as ALL_CAPS constants or single-letter variables, with modern naming standards to reduce technical debt.
| name | naming-conventions |
|---|---|
| description | Consistent naming patterns for files, variables, types, and exports |
Naming Conventions
Purpose: Consistent, readable naming patterns (improve clarity, maintainability)
- Keywords: naming, variable, function, class, interface, type, const, camelCase, PascalCase, kebab-case, snake_case
Quick Reference
| Category | Convention | Examples |
|---|---|---|
| Files | kebab-case |
order-form.tsx, checkout-modal.tsx |
| Files (Convex) | snake_case |
convex/stripe_webhook.ts |
| Variables/Functions | camelCase |
selectedAmount, handleSubmit |
| Types/Interfaces | PascalCase |
PaymentMethod, ButtonProps |
| Constants | camelCase + as const |
minOrderAmount |
| Generics | Descriptive | TItem, TData, TError |
| Booleans | Prefixed | isValid, hasError, canSubmit |
| DB/API Fields | snake_case |
transaction_id, _creationTime |
Clear Prefixes
// Functions
function handleSubmit() { }
function getOrderTotal() { }
function isValidEmail() { }
function buildPayload() { }
// Booleans
const isLoading = true
const hasError = false
const canProceed = true
const didComplete = false
const willExpire = true
const shouldRetry = false
Modern Constants
const bitcoinConfirmations = { mainnet: 3 } as const
const paymentMethods = ["card", "bitcoin"] as const
Avoid Old Patterns
// ❌ ALL_CAPS (outdated)
const MAX_AMOUNT = 100
// ❌ Single-letter generics (complex cases)
function map<T, U>(items: T[]): U[]
// ✅ Descriptive generics
function map<TItem, TResult>(items: TItem[]): TResult[]
Named Exports (Default)
// ✅ Prefer named
export function OrderForm() { }
export const config = { }
// Default only when framework requires (Next.js pages)
export default function Page() { }
Convex Exception
Convex requires snake_case for function files:
// ✅ convex/stripe_webhook.ts
// ✅ convex/bitcoin_mutations.ts
Props Naming
interface ButtonProps {
variant: "primary" | "secondary"
onClick: () => void
}
export function Button({ variant, onClick }: ButtonProps) { }