CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Essential Commands
Development
pnpm dev # Start dev server on port 3000
pnpm preview # Preview production build
Testing
pnpm test # Run unit tests
pnpm test:e2e # Run end-to-end tests with Playwright
pnpm test:unit:coverage # Run tests with coverage report
Code Quality
pnpm lint # Run both Biome and ESLint
pnpm lint:biome:write # Auto-fix with Biome
pnpm lint:eslint:fix # Auto-fix with ESLint
pnpm format # Format code with Biome
Build
pnpm build # Production build (TypeScript check + Vite build)
Architecture Overview
Feature-Based Organization
The codebase follows a feature-based structure under src/features/
:
- editor/: Core CodeMirror 6 integration with custom extensions for task lists, URL clicking, and markdown formatting
- snapshots/: Persistent storage system for saving work snapshots
- history/: UI for viewing and restoring past snapshots
- integration/: External service integrations (GitHub API)
Key Technical Decisions
- Editor Core: CodeMirror 6 with custom extensions for:
- Task list auto-completion (
- [ ]
syntax) - Keyboard shortcuts (Cmd+Enter to toggle tasks)
- URL click handling
- Theme synchronization
- Task list auto-completion (
- State Management: Jotai atoms for global state, with localStorage persistence for:
- Editor content
- Theme preferences
- Paper mode settings
- Editor width
-
Markdown Formatting: dprint WASM module loaded asynchronously for Cmd+S formatting
- Testing Strategy:
.test.ts
files run in Node environment.browser.test.ts
files run in Playwright for DOM-dependent tests- E2E tests verify critical user workflows
Development Guidelines
- Performance Focus: Minimize re-renders, use React.memo and useMemo appropriately
- Functional Design: Prefer immutable data structures and pure functions
- Side Effects Isolation: Keep side effects in custom hooks or effect handlers
- Keyboard-First: All features should be accessible via keyboard shortcuts
Important Patterns
- Custom Hooks: Extensive use of hooks for reusable logic (see
src/utils/hooks/
) - Storage Abstraction: All localStorage access through
src/utils/storage/
- Error Boundaries: Wrap feature components to prevent cascade failures
- Theme System: Coordinated theme updates across CodeMirror and Tailwind