
Fix Slow Database Queries
Diagnose slow Paperclip PostgreSQL queries, benchmark a fix, prove output is unchanged, and prepare a PR
- Repository
- paperclipai/paperclip
- Stars
- 110,078
- Licence
- MIT
- Files
- 4 files
What it does
When installed, the agent follows a structured workflow for finding and fixing slow database queries in the Paperclip codebase. It starts from production evidence (query statistics and Neon database metadata), traces each slow query back to the code that generates it, reproduces the slowness on a local PostgreSQL with synthetic data, and only then makes a change. Each change must be shown to be faster and to return identical results, with regression tests and passing checks before a pull request is considered done.
Great for
- Paperclip maintainers or contributors investigating slow requests or costly queries
- Engineers who want a disciplined, evidence-first performance workflow instead of guesswork indexes
- Teams using Neon-hosted PostgreSQL who need to map a slow endpoint to its database branch and role
Skip it if
- Projects other than Paperclip: the paths, rules and tooling it references are specific to that repository and its private control plane, so it would mislead elsewhere
- Quick one-off SQL questions or diagnosis-only requests: the workflow is long and expects a full fix, branch and PR
- Production databases changed directly by an agent: the skill involves migrations, schema changes and access to hosted infrastructure, which carry risk if run without human review
Try asking
- “Investigate why the issues list endpoint is slow on our hosted workspace and propose a measured fix”
- “Reproduce the slow query for the agent-run scheduler locally and compare results before and after a change”
- “Review whether a proposed index is justified by query plans and caller evidence”
- “Diagnose lock waits in an advisory-lock path without removing lock safety”
Install in 3 steps
- 1
Download the skill
The ZIP contains the 4 original files, the MIT licence and an attribution note.
fix-slow-queries.zip - 2
Add it to your agent
Claude Code (all projects)
mkdir -p ~/.claude/skills && unzip fix-slow-queries.zip -d ~/.claude/skills/Claude Code / Agent SDK (this project only)
mkdir -p .claude/skills && unzip fix-slow-queries.zip -d .claude/skills/Claude apps (web/desktop): Settings → Capabilities → Skills → Upload skill, and choose the ZIP.
- 3
Ask for the task
No special command needed — the agent reads the skill's description and loads it when your request matches. Try one of the prompts above.
Get better results
- Give the agent a specific slow URL, environment and time window so it does not have to guess; ask for diagnosis only if you do not want code changes
- Keep a live development server's checkout separate; the skill expects a dedicated branch or worktree for benchmarks
- Review any migration proposal yourself: the skill itself says migrations over about two minutes must be flagged for human review
What's inside
- agents/openai.yaml
- references/cloud-discovery.md
- references/local-proof.md
- SKILL.md
Redistributed unmodified from paperclipai/paperclip under the MIT licence. The assessment was drafted with AI from the skill's files on 2026-10-29. Skills can instruct your agent to run code — read SKILL.md and any scripts before installing.