When to Use camelCase
camelCase writes the first word in lowercase and capitalizes the first letter of every subsequent word: myVariable, getUserData, handleButtonClick. It is the default convention for JavaScript variable names, function names, and object property keys. JSON uses camelCase for property names in most APIs. Java and C# method and variable names follow camelCase. TypeScript types and interfaces typically use PascalCase (same as camelCase but with the first letter also capitalized): UserProfile, ApiResponse.
When to Use snake_case
snake_case writes all words in lowercase joined by underscores: my_variable, user_id, get_user_data. It is the default convention in Python for variable names, function names, and module names. SQL column names and database table names conventionally use snake_case. PHP and Ruby variables also use snake_case. SCREAMING_SNAKE_CASE (all uppercase with underscores) is the convention for constants in many languages: MAX_RETRY_COUNT, API_BASE_URL.
When to Use kebab-case
kebab-case writes all words in lowercase joined by hyphens: my-component, button-primary, user-profile-card. It is the standard for CSS class names and custom property names. HTML attribute names, URL slugs, and file names for web assets use kebab-case. Many CLI tool flags and command names use it as well. It cannot be used for JavaScript variable names because the hyphen is interpreted as a minus operator.