···11# Claude Code
22-CLAUDE.md
32.claude/
4354# Logs
+70
AGENTS.md
···11+# Barazo Lexicons -- Schema Definitions
22+33+<!-- Auto-generated from barazo-workspace. To propose changes, edit the source:
44+ https://github.com/barazo-forum/barazo-workspace/tree/main/agents-md -->
55+66+MIT | Part of [github.com/barazo-forum](https://github.com/barazo-forum)
77+88+Lexicon schemas for the Barazo forum platform. Defines all `forum.barazo.*` record types and generates TypeScript types consumed by barazo-api and barazo-web.
99+1010+## Namespace
1111+1212+`forum.barazo.*`
1313+1414+## What This Repo Does
1515+1616+- Defines AT Protocol lexicon schemas (JSON files) for all forum record types
1717+- Generates TypeScript types from lexicon schemas
1818+- Published as an npm package consumed by barazo-api and barazo-web
1919+- Schemas are the contract between users' PDSs, the AppView, and any frontend
2020+2121+## Core Record Types (MVP)
2222+2323+- `forum.barazo.topic.post` -- main thread posts
2424+- `forum.barazo.topic.reply` -- replies to threads
2525+- `forum.barazo.interaction.reaction` -- reactions (configurable per forum)
2626+2727+Categories are AppView-only (admin-managed, stored in PostgreSQL), not PDS records.
2828+2929+## Lexicon-Specific Standards
3030+3131+- Schema-first -- lexicon JSON files are the source of truth; TypeScript types are generated, never hand-written
3232+- Backwards compatibility -- once published, fields can be added but never removed or changed
3333+- Follow AT Protocol lexicon conventions (see [AT Protocol Lexicon spec](https://atproto.com/specs/lexicon))
3434+- Strict TypeScript -- `strict: true`, no `any`, no `@ts-ignore`
3535+3636+---
3737+3838+## Project-Wide Standards
3939+4040+### About Barazo
4141+4242+Federated forum built on the [AT Protocol](https://atproto.com/). Portable identity, user-owned data, cross-community reputation.
4343+4444+- **Organization:** [github.com/barazo-forum](https://github.com/barazo-forum)
4545+- **License:** AGPL-3.0 (backend) / MIT (frontend, lexicons, deploy, website)
4646+- **Contributing:** See [CONTRIBUTING.md](https://github.com/barazo-forum/.github/blob/main/CONTRIBUTING.md)
4747+4848+### Coding Standards
4949+5050+1. **Test-Driven Development** -- write tests before implementation (Vitest).
5151+2. **Strict TypeScript** -- `strict: true`, no `any`, no `@ts-ignore`.
5252+3. **Conventional commits** -- `type(scope): description`.
5353+4. **CI must pass** -- lint, typecheck, tests, security scan on every PR.
5454+5. **Input validation** -- Zod schemas on all API inputs and firehose records.
5555+6. **Output sanitization** -- DOMPurify on all user-generated content.
5656+7. **No raw SQL** -- Drizzle ORM with parameterized queries only.
5757+8. **Structured logging** -- Pino logger, never `console.log`.
5858+9. **Accessibility** -- WCAG 2.2 AA, semantic HTML, keyboard navigable.
5959+6060+### Git Workflow
6161+6262+All changes go through Pull Requests -- never commit directly to `main`. Branch naming: `type/short-description` (e.g., `feat/add-reactions`, `fix/xss-sanitization`).
6363+6464+### AT Protocol Context
6565+6666+- Users own their data (stored on their Personal Data Server)
6767+- The AppView (barazo-api) indexes data from the AT Protocol firehose
6868+- Lexicons (`forum.barazo.*`) define the data schema contract
6969+- Identity is portable via DIDs -- no vendor lock-in
7070+- All record types are validated against lexicon schemas