# Example: Prompt Service PRD (调用测试 + 集合)

> This is a real PRD produced for prompt.ephron.ren. It demonstrates the full workflow: codebase analysis → draft → interactive decisions → finalization.

## Project Context

- **Tech Stack**: FastAPI + Jinja2 templates + SQLite + vanilla JS
- **Design System**: Dark theme, Inter/JetBrains Mono, CSS custom properties
- **CSP Policy**: `connect-src 'self'; script-src 'self' 'unsafe-inline'`
- **Auth**: Shared `ephron_auth` Cookie across sub-services
- **Existing API**: 7 endpoints (public list/detail + service CRUD)

## Codebase Analysis Approach

1. `find` to enumerate all files in the prompt service
2. Read `src/main.py` → FastAPI app with 4 routers (pages, api, admin, service_api)
3. Read `src/services/db.py` → `prompts` + `prompt_versions` tables
4. Read `src/services/prompts.py` → full CRUD with version management
5. Read `src/routes/api.py` → public API with PromptResponse schema
6. Read `src/routes/service_api.py` → service token auth pattern
7. Read `src/routes/admin.py` → admin CRUD with CSRF, audit logging
8. Read `templates/public/detail.html` → current detail page (view + copy only)
9. Read `templates/public/index.html` → grid layout with filter bar
10. Read `src/config.py` → env-based config, shared DB path
11. Read `prompt-api-spec/api-specification.md` → existing API spec to extend
12. Checked `shared/` directory for reusable utilities

## Decisions Collected (7 items)

| # | Decision | User's Choice | Notes |
|---|----------|---------------|-------|
| 1 | LLM Provider | Direct Anthropic API | Admin settings page for model config |
| 2 | API Key storage | .env | Model params in DB + admin UI |
| 3 | Streaming | SSE | Simple, FastAPI native support |
| 4 | Markdown rendering | Frontend (marked.js) | Less server overhead |
| 5 | Login required | Yes | Rate limiting + audit |
| 6 | Multi-collection membership | Yes | UNIQUE(collection_key, prompt_key) |
| 7 | Collection ordering | Manual (sort_order) | Author controls flow |

## Workflow Notes

- User preferred decision questions asked ONE AT A TIME (not all at once)
- User asked for recommendations before answering — always include your pick
- PRD was saved to `prompt-api-spec/prd-test-and-collections.md` (project-relative)
- `clarify` tool was not available in this execution context — fell back to direct Q&A

## Output Stats

- ~24KB markdown document
- 7 tables (data model, API spec, decision record, risk matrix, etc.)
- 2 new SQL tables proposed (collections, collection_items)
- 6 new API endpoints proposed
- 5.5 day estimated implementation
