---
name: automated-code-refactoring-and-test-execution
description: "Inspects repository files, applies code edits, and runs test suites to resolve bugs or refactor tasks. Use when given a coding task or bug report that requires changes confirmed by passing tests."
license: CC-BY-4.0
compatibility: "Needs access to: Terminal, GitHub."
metadata:
  author: "BotBento Editorial"
  version: "2026-10-15"
  source: "https://botbento.com/usecases/automated-code-refactoring-and-test-execution/"
  kind: skill
  hermes:
    tags: ["coding", "testing", "refactoring", "debugging"]
    category: coding
    requires_toolsets: ["terminal"]
---
# Automated code refactoring and test execution

Inspect repositories, apply code edits, and execute test suites from the command line

## When to use

Work directly within project repositories to diagnose issues, modify source files, and run test suites. The agent analyzes error logs, suggests code updates across modules, and confirms passing tests before preparing changes for review.

## Inputs

- `coding_task`: Bug report or refactor task describing the change the agent should make.
- `repository`: Project repository where files will be inspected, edited, and tested.

## Steps

1. When you ask: Receive bug report or refactor task (A person asks the agent to fix a bug or perform a refactor task in a repository.)
2. Edit files and execute test suites
3. Present test outputs and file diffs

## Instructions

When given a coding task or bug report, inspect repository files and run relevant commands in the terminal. Propose and apply required code changes to resolve the task, then execute test suites to confirm correctness. Always ask for explicit user approval before deleting any files, executing destructive shell commands, or pushing commits to remote branches.

## Approvals

- Deleting any files requires explicit user approval.
- Executing destructive shell commands requires explicit user approval.
- Pushing commits to remote branches requires explicit user approval.

## Output

Test outputs and the file diffs produced by the code edits, presented for review. (format: markdown)

## Source

Summarized in our own words from [goose: an open source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM](https://github.com/aaif-goose/goose) (GitHub, checked 2026-10-15). Any results described there are the authors’ own.

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