Skip to main content

Code Style Philosophy

Autonome enforces strict code style to maintain consistency and quality across the codebase:
  • Zero tech debt: Do things right from the start, no workarounds
  • Adaptive refactoring: Clean up sloppy code whenever you encounter it
  • No bandaid fixes: Fix issues at their source, not with patches
  • Complete implementations: Build for scale (>1000 users), not quick hacks
From AGENTS.md: “Early development, no users. No backwards compatibility concerns. Do things RIGHT: clean, organized, zero tech debt. Never create compatibility shims.”

Biome Configuration

Autonome uses Biome for linting and formatting instead of ESLint + Prettier:
  • Faster than ESLint (10-100x speedup)
  • Single tool for both linting and formatting
  • Zero config required (sensible defaults)
  • Native to the JavaScript ecosystem

Configuration File

Biome is configured in biome.json:

Running Biome

Run bun run check before committing to catch style violations early.

Core Style Rules

1. Indentation: Tabs

Always use tabs for indentation, never spaces:
Why tabs?
  • Accessibility: Users can configure tab width to their preference
  • Smaller file sizes
  • Easier to navigate with keyboard

2. Quotes: Double

Always use double quotes for strings:
Exception: Use backticks for template literals:

3. Import Organization

Biome automatically organizes imports:

4. Semicolons

Biome enforces semicolons at the end of statements:

TypeScript Conventions

Type Annotations

Use explicit types for function parameters and return values:

Type vs Interface

Prefer type over interface for most cases:

Avoid any

Never use any - use unknown or proper types:

React Component Patterns

Component Structure

Hooks Conventions

Custom hooks must start with use:

Event Handlers

Prefix event handlers with handle:

Naming Conventions

Variables & Functions

camelCase for variables and functions:

Constants

UPPER_SNAKE_CASE for constants:

Types & Interfaces

PascalCase for types, interfaces, and enums:

Files & Directories

kebab-case for file names (except components):

Database Conventions

Quoted Identifiers

Always quote capitalized table and column names:

Monetary Values

Store as TEXT, cast to NUMERIC for calculations:

oRPC Patterns

Procedure Structure

Client Usage

Critical Rules from AGENTS.md

1. Package Manager: Bun Only

2. Data Fetching: oRPC Only

3. Environment Variables: T3Env

4. No Workarounds

5. Adaptive Refactoring

Before:
After:

6. Edge Case Exhaustion

Component Styling (Tailwind + CVA)

Using CVA for Variants

Using cn() for Class Merging

VS Code Integration

Add to .vscode/settings.json:

Pre-Commit Checklist

Before committing code:
  • Run bun run check (no errors)
  • Run bun run test (all tests pass)
  • Verify no console.log statements (unless intentional)
  • Check for unused imports/variables
  • Ensure proper TypeScript types (no any)
  • Verify database queries use quoted identifiers
  • Confirm environment variables use env.ts
  • Test affected functionality manually

Common Mistakes

Mistake 1: Using spaces instead of tabs

Fix: Run bun run format --write

Mistake 2: Single quotes

Fix: Run bun run format --write

Mistake 3: Unquoted database identifiers

Mistake 4: Direct process.env access

Mistake 5: Not organizing imports

Fix: Run bun run check --write

Next Steps

  • Set up your editor: Configure VS Code with Biome extension
  • Practice: Follow these conventions in your daily work
  • Review: Read Testing for QA workflow
  • Contribute: See Contributing Guidelines for the full development process
Consistency is more important than personal preference. Follow the style guide even if you disagree with specific choices.