Code Style
Python
Section titled “Python”Formatter and linter: ruff
Section titled “Formatter and linter: ruff”Snippbot uses ruff for both formatting and linting:
ruff check packages/ # Lintruff check packages/ --fix # Auto-fixruff format packages/ # FormatType checking: mypy
Section titled “Type checking: mypy”mypy packages/Conventions
Section titled “Conventions”- Functions:
snake_case - Classes:
PascalCase - Constants:
UPPER_SNAKE_CASE - Private:
_prefixed - Max line length: 100 characters
- Imports: stdlib → third-party → local, each group alphabetical
- Docstrings: only on public module-level functions and classes
All route handlers and core operations are async. Use asyncio throughout — no blocking calls in async context.
# Goodasync def get_project(project_id: str) -> Project: return await project_store.get(project_id)
# Bad — blocks the event loopdef get_project(project_id: str) -> Project: return db.execute("SELECT ...").fetchone()TypeScript / React
Section titled “TypeScript / React”Formatter: Prettier
Section titled “Formatter: Prettier”cd packages/ui && pnpm formatLinter: ESLint
Section titled “Linter: ESLint”cd packages/ui && pnpm lintConventions
Section titled “Conventions”- Components:
PascalCase.tsx - Hooks:
useXxx.ts - Utils:
camelCase.ts - Types:
PascalCase, defined intypes/or co-located - Zustand stores: one file per domain in
store/ - React Query keys: string array
['projects', id]
Component structure
Section titled “Component structure”// Props interface at topinterface Props { projectId: string; onComplete?: () => void;}
// Componentexport function ProjectCard({ projectId, onComplete }: Props) { // hooks first const { data } = useProject(projectId); // render return <div>...</div>;}- Branch naming:
feat/description,fix/description,docs/description - Commits: imperative mood — “Add scheduler NL parsing” not “Added”
- No force-push to
main