authentication
latitude-dev/latitude-llm/.agents/skills/authentication/SKILL.md
Sessions, sign-in/sign-up flows, OAuth, magic links, or organization context on the session.
Skill4.7k starsChanged 8 days ago
What's in it
- Authentication (Better Auth)
- Stack
- Web app helpers
- Domain alignment
---
name: authentication
description: Sessions, sign-in/sign-up flows, OAuth, magic links, or organization context on the session.
---
# Authentication (Better Auth)
**When to use:** Sessions, sign-in/sign-up flows, OAuth, magic links, or organization context on the session.
## Stack
- **`@platform/db-postgres`** exposes **`createBetterAuth()`** in `packages/platform/db-postgres/src/create-better-auth.ts`, wiring **better-auth** with the Drizzle adapter against the shared Postgres client.
- Sessions: `auth.api.getSession({ headers })` → `{ user, session }` with typed fields.
- **`User`** includes `id`, `email`, `name` — use those fields directly (no assertions).
## Web app helpers
- Session helpers: `apps/web/src/domains/sessions/session.functions.ts` (`getSession`, `ensureSession`, etc.).
- **Organization context** is added via the **`customSession`** plugin (multi-tenant product behavior).
## Domain alignment
- Auth **intent** flows (login/signup completion) use use-cases from **`@domain/auth`** composed with Postgres repositories — keep policy in domain, wiring in apps.
For HTTP boundary rules (who may call what), see [architecture-boundaries](../architecture-boundaries/SKILL.md).
More agent context in latitude-dev/latitude-llm
30 other files this repository gives its agents.
AGENTS.md
Skill
- agentation-watch-mode.agents/skills/agentation-watch-mode/SKILL.md
- analyze-problem.agents/skills/analyze-problem/SKILL.md
- api-endpoints.agents/skills/api-endpoints/SKILL.md
- architecture-boundaries.agents/skills/architecture-boundaries/SKILL.md
- artifact-designer.agents/skills/artifact-designer/SKILL.md
- async-jobs-and-events.agents/skills/async-jobs-and-events/SKILL.md
- backoffice.agents/skills/backoffice/SKILL.md
- better-auth-best-practices.agents/skills/better-auth-best-practices/SKILL.md
- ci-watchdog.agents/skills/ci-watchdog/SKILL.md
- code-style.agents/skills/code-style/SKILL.md
- create-pr.agents/skills/create-pr/SKILL.md
- database-clickhouse-weaviate.agents/skills/database-clickhouse/SKILL.md
- database-postgres.agents/skills/database-postgres/SKILL.md
- docs.agents/skills/docs/SKILL.md
- effect-and-errors.agents/skills/effect-and-errors/SKILL.md
- env-configuration.agents/skills/env-configuration/SKILL.md
- explain-diff-html.agents/skills/explain-diff-html/SKILL.md
- fix-datadog-issues.agents/skills/fix-datadog-issues/SKILL.md
- gh-issue.agents/skills/gh-issue/SKILL.md
- humanizer.agents/skills/humanizer/SKILL.md
- managing-maintenance-windows.agents/skills/managing-maintenance-windows/SKILL.md
- mintlify-preview.agents/skills/mintlify-preview/SKILL.md
- notifications.agents/skills/notifications/SKILL.md
- production-release.agents/skills/production-release/SKILL.md
- review-pr-comments.agents/skills/review-pr-comments/SKILL.md
- temporal-developer.agents/skills/temporal-developer/SKILL.md
- testing.agents/skills/testing/SKILL.md
- toolchain-commands.agents/skills/toolchain-commands/SKILL.md
- web-frontend.agents/skills/web-frontend/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool registry_write, action report. How to connect one.

