---
name: review-tool-speed-ceb4964cc369
description: Review query tools for runtime optimization opportunities
user-invocable: true
disable-model-invocation: true
---
Enter planning mode. Investigate query tool runtime and find optimization opportunities.

The query tools (`query_*.ps1` in `tools/`) are critical for keeping context bloat down and getting programmatic answers.

1. Investigate each query tool for potential optimizations to decrease runtime. Optimizations must be **internal only** — no change to output, function, or contract of the tool.
2. For each recommendation, include an analysis statement explaining why it's internal-only and doesn't change the tool's job or contract.
3. Consider: caching, pipeline vs loop, regex precompilation, redundant file reads, shared parsing, startup overhead, etc.

Research the query tools deeply. Write a plan for all optimizations found. Ignore any existing plans — create a fresh one.

## Measurement & Verification Tools

Two tools in `tools/` support this workflow. Use them — do not reinvent timing or golden-output infrastructure.

### `tools/bench_query.ps1` — Timing benchmark
Runs all query tools with representative args, reports external and internal timing.
```
powershell -File tools/bench_query.ps1                  # 3 iterations, full report
powershell -File tools/bench_query.ps1 -InternalOnly    # internal timing only
powershell -File tools/bench_query.ps1 -Iterations 5    # more iterations for stability
```

### `tools/verify_query.ps1` — Golden output capture & verification
Captures tool output before changes, verifies output is unchanged after. Strips timing lines automatically. 22 test cases across all query tools.
```
powershell -File tools/verify_query.ps1 -Capture        # save golden (prints dir path)
powershell -File tools/verify_query.ps1 -Verify <dir>   # compare against golden
```

### Required workflow
1. **Before changes:** Run `verify_query.ps1 -Capture` and `bench_query.ps1` for baseline
2. **After each change:** Run `verify_query.ps1 -Verify <golden-dir>` — must pass
3. **After all changes:** Run `bench_query.ps1` — compare against baseline, no regressions


---
Source attribution: cwilliams5
Original project: https://github.com/cwilliams5/Alt-Tabby/blob/6e941fe6d8344facc4f24c373f41999ff6da4c04/.claude/skills/review-tool-speed/SKILL.md
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2025 Cody Williams

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: cwilliams5
Original project: https://github.com/cwilliams5/Alt-Tabby/blob/6e941fe6d8344facc4f24c373f41999ff6da4c04/.claude/skills/review-tool-speed/SKILL.md
Attribution basis: Source repository record

Fields of work: Data & Analytics, Development & Engineering
Roles: Backend Developer, Data Analyst, Data Scientist
Specialties: Backend
Tools: Powershell
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: 48c24acd929ae73853eb9ad9c3bf19849974e1a0ac4dc6ef73fdf9781e7aa308
