Read query plans with EXPLAIN. Look for sequential scans on big tables. These show missing indexes. Watch for nested loop joins. Manage connections. Each connection uses memory and CPU. Use PgBouncer ...
- Look for nested loop joins. These need better join plans. Add the right indexes. - Index columns in WHERE, JOIN, and ORDER BY. - Use composite indexes for multiple columns. - Put equality filters ...
For manual tool loops, handle `tool_use` blocks in the response, send `tool_result` back, loop until `stop_reason` is `"end_turn"`. See shared tool use concepts.
All parts of Claude Code's system prompt, 27 builtin tool descriptions, sub agent prompts (Plan/Explore/Task), utility prompts (CLAUDE.md, compact, statusline, magic docs, WebFetch, Bash cmd, ...