YurunChen/repo-docs-skills / docs
repo-docs
FlaggedBuild and maintain a Markdown guide that helps humans understand a repository through real behavior, concepts, and evidence. Use when a user asks to understand a repo, generate or update repo-docs, answer repo-architecture/onboarding questions, seed docs for a new project, sync docs after code changes, or delete generated repo docs.
case-studies/generated/bolt-diy/repo-docs/code-map.md
View on GitHub# bolt.diy Web Chat Code Map
This map covers the first-party source areas that own the documented browser-prompt-to-streamed-answer path. Read [how one prompt becomes a streamed answer](walkthroughs/one-real-run.md) first if the behavior is not clear yet.
| Path | Responsibility | Key code | Connection to the main path |
| --- | --- | --- | --- |
| `app/components/chat/` | Builds the browser-side request from the user message, workbench state, and selected provider/model. | [`Chat.client.tsx`](https://github.com/stackblitz-labs/bolt.diy/blob/2e254ac19a696394030601bc602f54945b12bfc4/app/components/chat/Chat.client.tsx#L134) | Creates the request contract sent to `/api/chat`. |
| `app/routes/` | Orchestrates the server request, context work, response continuation, annotations, and user-facing stream errors. | [`api.chat.ts`](https://github.com/stackblitz-labs/bolt.diy/blob/2e254ac19a696394030601bc602f54945b12bfc4/app/routes/api.chat.ts#L51) | Owns the central relay between browser and model stream. |
| `app/lib/.server/llm/` | Selects context, cleans model tags, assembles prompts, resolves the model call, and monitors streaming. | `select-context.ts`, `stream-text.ts`, `create-summary.ts` | Implements the non-trivial context and model-call boundaries. |
| `app/lib/modules/llm/` | Registers providers and exposes static and dynamic model lists. | `manager.ts`, `registry.ts` | Supplies provider/model choices to the server stream helper. |
## `app/components/chat/`
| Important code | Function | Key symbols | Called by / used by |
| --- | --- | --- | --- |
| `app/components/chat/Chat.client.tsx` | Adds workbench fields and provider/model tags, then starts or appends the chat request. | `useChat`, send path | Browser chat UI; contract fields are detailed in the chat API module. |
## `app/routes/`
| Important code | Function | Key symbols | Called by / used by |
| --- | --- | --- | --- |
| `app/routes/api.chat.ts` | Parses request/cookie state, runs MCP and context work, merges the model stream, continues length-limited output, and maps errors. | `action()`, data-stream execution, `onError` | `/api/chat`; verify nearby behavior with `pnpm run typecheck` and `pnpm run test`. |
| `app/routes/api.models.ts` | Exposes model-list behavior adjacent to chat model selection. | model route | Provider/model UI and lookup surfaces. |
## `app/lib/.server/llm/`
| Important code | Function | Key symbols | Called by / used by |
| --- | --- | --- | --- |
| `select-context.ts` | Requires a bounded XML-like file selection and rejects invalid or empty selections. | `selectContext()` | `/api/chat` context optimization. |
| `stream-text.ts` | Removes provider/model tags, resolves a model, builds the mode-specific prompt, and starts the AI SDK stream. | `streamText()` | `/api/chat` response generation. |
| `create-summary.ts` | Compresses earlier chat history before selected context is attached. | summary helper | Context optimization and usage accounting. |
| `stream-recovery.ts`, `switchable-stream.ts` | Monitor activity and support stream handoffs. | recovery and stream wrappers | The route's continuation and timeout surfaces. |
## `app/lib/modules/llm/`
| Important code | Function | Key symbols | Called by / used by |
| --- | --- | --- | --- |
| `manager.ts` | Stores registered providers and combines static with dynamic model lists. | `LLMManager` | `streamText()` and model-list routes. |
| `registry.ts` | Defines which provider classes enter the manager. | provider registry | Provider initialization. |
## Coverage
Covered: browser chat request construction, `/api/chat`, context optimization, provider/model resolution, and stream continuation/error handling. Electron startup, deployment integrations, Git and Supabase flows, workbench action-to-file writes, individual provider implementations, and MCP server internals are excluded or deferred because they sit outside the streamed-answer boundary.
Read [how chat streaming manages context pressure](modules/chat-stream.md) or [how provider tags become a model instance](modules/provider-model-selection.md) for mechanism detail.
Evidence status: Confirmed unless noted.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| claude-apianthropics/skillsReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file). | Stars: 198k | Updated | Claude CodeCodex | Unverified | Install |
| doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |