Performance playbook
N+1 Detector
Finds database or network calls executed inside iteration and proposes a batch fetch, join, or safe concurrency rewrite.
Scans pull requests for database or network calls executed inside loops or iterations, queries in `for` blocks, `await` inside `.map`, lookups per item, or resolvers that fetch per element. Reports each finding with the loop bound, an estimated call count at realistic data volumes, and a specific rewrite such as batch fetch, join, or `Promise.all` where concurrency is safe.
- Identifier
n-plus-one-detector- Version
- 1.0.0
- Steps
- 4
- Triggers
- 1
- performance
- database
- n-plus-one
- review
- automated
When it runs
pull_request.opened- Settle delay
- 20s after the event
Only when all hold
- pullRequest.isDraft not equals true
- actor.username not in dependabot, dependabot[bot], renovate, renovate[bot], github-actions, github-actions[bot]
- actor.username not contains [bot]
The pipeline
The graph below is the one the workflow opens with in the builder, same steps, same layout, drawn on the same canvas. The run playing through it is a simulation; the branches and conditions are real.
- 01PR Opened
triggerThe event that starts the run.
- 02Clone Repository
git.cloneShallow-clones the repository at the right ref.
- 03Detect N+1 Patterns
agent.runOne agent works the task with its toolkit.
- 04Publish N+1 Report
report.publishPosts or updates a deduplicated report comment.
The agent
N+1 Detector
- Base type
- Code Reviewer
- Temperature
- 0.2
- Max iterations
- 30
- Tools
- 5
Git provider · 2
get_pull_request_diffGet Pull Request Diff · readadd_pull_request_review_threadAdd PR Review Thread · write
Filesystem · 1
read_fileRead File · read
Code search · 1
code_searchCode Search · read
Status · 1
update_statusUpdate Status · write