How to add the Database Optimizer subagent to Claude Code
- Open the publisher’s Markdown file and save it as .claude/agents/database-optimizer.md at the root of your project.
- Ask Claude Code to delegate your sample task to the database-optimizer subagent. If it does not appear in the transcript, restart Claude Code and retry.
Try this workflow
Give it a query and development query plans for fetching a customer’s latest orders. Ask it to explain the scan and sort, and propose the smallest index change worth testing.
Compare returned rows and sort order on the same fixtures, then check whether the new plan removes the sort or reduces the number of scanned rows.
What you need
The publisher’s file grants the subagent these tools. Read, Write, Edit, Bash, Glob, Grep. Review the list before using the file in a shared project.