## Phase 4a — Backend Add a backend endpoint that uses Claude to suggest tags for a theme based on its content. ### Acceptance Criteria - [ ] `anthropic` added to `pyproject.toml` dependencies - [ ] `ANTHROPIC_API_KEY` env var documented and added to Railway - [ ] `POST /api/themes/{theme_id}/suggest-tags` endpoint (auth required) - Fetches theme `body_md` from DB - Queries all existing tag names for context (prefer reuse) - Calls Claude Haiku with prompt to suggest 3–5 tags - Returns `{"tags": ["tag-one", "tag-two"]}`, normalized via existing tag format - [ ] Returns 404 if theme not found - [ ] Tests with mocked anthropic client ### Notes - No migration needed - Tag names normalized through existing `[a-z0-9-]` format
Phase 4a — Backend
Add a backend endpoint that uses Claude to suggest tags for a theme based on its content.
Acceptance Criteria
anthropicadded topyproject.tomldependenciesANTHROPIC_API_KEYenv var documented and added to RailwayPOST /api/themes/{theme_id}/suggest-tagsendpoint (auth required)body_mdfrom DB{"tags": ["tag-one", "tag-two"]}, normalized via existing tag formatNotes
[a-z0-9-]format