---
name: automated-code-refinement-from-runtime-errors
description: "Analyzes runtime tracebacks and failing code, drafts corrected snippets, and prepares a patch report. Use when an execution error log, bug report, or failing script needs a proposed fix before any edits are applied."
license: CC-BY-4.0
compatibility: "Needs access to: Terminal, GitHub, Chat."
metadata:
  author: "BotBento Editorial"
  version: "2026-10-16"
  source: "https://botbento.com/usecases/automated-code-refinement-from-runtime-errors/"
  kind: skill
  hermes:
    tags: ["debugging", "python", "code-review", "refactoring"]
    category: coding
    requires_toolsets: ["terminal"]
---
# Automated code refinement from runtime errors

Analyze runtime tracebacks, generate candidate patches, and refine failing code snippets iteratively

## When to use

Review error logs and stack traces from script executions, retrieve relevant patterns from previous runs, and draft corrected code snippets. The bot inspects error messages, updates the source code to resolve the defect, and prepares a patch report for developer verification.

## Inputs

- `error_traceback`: Runtime error log or stack trace from the failing script execution
- `source_code`: The script or code snippet that produced the reported runtime error
- `bug_report` (optional): Optional written bug report describing the observed failure

## Steps

1. When you ask: Receive error log and script (A person provides an execution traceback, bug report, or failing script in chat)
2. Analyze traceback and draft patch
3. Submit patch for engineer review

## Instructions

When an execution traceback or bug report is provided, isolate the root cause and inspect the failing code block. Search saved patterns or documentation for relevant fixes. Generate an updated code version that directly addresses the reported error. Before applying any edits or pushing changes to the repository, present the proposed diff and explanation to the engineer and wait for approval.

## Approvals

- Applying code edits to the failing source must wait for engineer approval
- Pushing changes to the repository must wait for engineer approval

## Output

Proposed diff, root-cause explanation, and patch report submitted for engineer review (format: markdown)

## Source

Summarized in our own words from [ThinkGPT: Agent techniques to augment your LLM and push it beyond its limits ![GitHub Repo stars](https://img.shields.io/github/stars/jina-a](https://github.com/jina-ai/thinkgpt) (GitHub, checked 2026-10-16). Any results described there are the authors’ own.

From the BotBento use-case directory: https://botbento.com/usecases/automated-code-refinement-from-runtime-errors/. Licence: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
