---
name: investigating-slow-test-suites-and-profiling-code
description: "Profiles test suites to identify the slowest test cases, redundant network or database calls, and refactoring opportunities. Use when a repository's tests are slow and you need timing metrics and clear optimization guidance."
license: CC-BY-4.0
compatibility: "Needs access to: GitHub, Terminal, Docs."
metadata:
  author: "BotBento Editorial"
  version: "2026-10-15"
  source: "https://botbento.com/usecases/investigating-slow-test-suites-and-profiling-code/"
  kind: skill
  hermes:
    tags: ["testing", "profiling", "codebase", "performance", "debugging"]
    category: coding
    requires_toolsets: ["terminal", "file"]
---
# Investigating slow test suites and profiling code execution

Pinpoint sluggish test cases in your repository and receive clear explanations for test bottlenecks.

## When to use

Examines project repositories and automated test results to identify the slowest test suites. The bot isolates slow assertions, uncovers redundant network or database calls, and suggests concrete refactoring steps to reduce overall test execution duration.

## Inputs

- `repository`: Project repository containing the test suite and dependencies to inspect.
- `test_results` (optional): Automated test results with timing metrics for identifying slow suites.

## Steps

1. When you ask: Request test performance review (A person asks to review a repository's test suite for slow tests and bottlenecks.)
2. Profile test execution times
3. Provide test optimization report

## Instructions

When requested to analyze tests, run diagnostic commands via the terminal to gather timing metrics. Inspect test files and dependencies to find what causes high latency. Summarize findings with exact file paths and execution times. Always ask for user confirmation before modifying code, pushing commits, or deleting test fixtures.

## Approvals

- Modifying code must wait for user confirmation.
- Pushing commits must wait for user confirmation.
- Deleting test fixtures must wait for user confirmation.

## Output

Report with slow test suites, exact file paths, execution times, and concrete refactoring suggestions. (format: markdown)

## Source

Summarized in our own words from [harness-sdk: Build an agent harness and control it end-to-end. Open-source SDK for production AI agents in Python & TypeScript - any model, ](https://github.com/strands-agents/harness-sdk) (GitHub, checked 2026-10-15). Any results described there are the authors’ own.

From the BotBento use-case directory: https://botbento.com/usecases/investigating-slow-test-suites-and-profiling-code/. Licence: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
