python-debug-execution-911f17

python-debug-execution-911f17 is a skill for Claude Code, Codex from HKUDS/OpenSpace. It costs 23 tokens per session (824 once invoked), scanned A, original, MIT.

A method for diagnosing failed Python scripts by capturing the full error traceback, exit code, and working directory.

In plain words
What is it for?
It is for investigating Python execution errors and file-operation problems.
Why use it?
It replaces vague failure messages with the details needed to identify whether the script or its file paths caused the problem.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

About the project

OpenSpace is a skill-management layer for AI agents that stores, retrieves, evaluates, shares, and improves reusable workflows. It is intended for people using multiple coding agents who want skills to be reused and refined based on task outcomes. The catalogue provides 200 skills for use with OpenSpace and the agents it supports.

HKUDS/OpenSpace · 7,510 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/hkuds/openspace/python-debug-execution-911f17
Any agent
npx skills add HKUDS/OpenSpace --skill python-debug-execution-911f17
Clone the repo
git clone --depth 1 https://github.com/HKUDS/OpenSpace

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for python-debug-execution-911f17

README.md
[![agentmods](https://agentmods.dev/badge/skills/hkuds/openspace/python-debug-execution-911f17.svg)](https://agentmods.dev/skills/hkuds/openspace/python-debug-execution-911f17)
Your own site
<a href="https://agentmods.dev/skills/hkuds/openspace/python-debug-execution-911f17"><img src="https://agentmods.dev/badge/skills/hkuds/openspace/python-debug-execution-911f17.svg" alt="Measured on agentmods" height="20"></a>
Per session 23 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 824 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00023 $0.00824
Opus 5 $0.00012 $0.00412
Sonnet 5 $0.00005 $0.00165
Haiku 4.5 $0.00002 $0.00082

Measured 2d ago against content hash 61612d9de0cb, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

python-debug-execution-911f17 scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

benchmarks/gdpval/skills/python-debug-execution-911f17/SKILL.md · 129 lines

How it starts

The opening of the file, as written. The whole thing — 129 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Python Debug Execution

This skill provides a pattern for debugging Python script execution failures. It ensures you capture actual tracebacks instead of opaque errors and verifies the working directory before file operations.

Core Pattern

1. Execute with Full Traceback Capture

Always run Python scripts with stderr redirected and exit code reported:

python3 script.py 2>&1 ; echo Exit code: $?

This pattern:

  • 2>&1 - Redirects stderr to stdout so all output (including tracebacks) is captured together
  • echo Exit code: $? - Reports the exit code to distinguish between successful runs and failures

Why this matters: Opaque errors without tracebacks make it impossible to identify the root cause. The exit code tells you if the script succeeded (0) or failed (non-zero).

2. Verify Working Directory Before File Operations

Before any file read/write operations in your Python script, add:

import os
print(f"Current working directory: {os.getcwd()}")

Or for debugging, add at the start of your script:

import os
import sys

# Debug: show execution context
print(f"Script path: {__file__}")
print(f"Working directory: {os.getcwd()}")
print(f"Python version: {sys.version}")

Why this matters: File operations often fail due to incorrect assumptions about the current working directory. Verifying os.getcwd() helps diagnose path-related errors.

Usage Examples

Example 1: Running a Script with Debug Output

# Instead of:
python3 analyze.py

# Use:
python3 analyze.py 2>&1 ; echo Exit code: $?

Example 2: Script with Directory Verification

#!/usr/bin/env python3
import os
import pandas as pd

# Verify execution context
print(f"Working directory: {os.getcwd()}")

# Now safe to do file operations
data_path = "data/input.csv"
print(f"Attempting to read: {data_path}")

# Check if file exists before reading
if os.path.exists(data_path):
    df = pd.read_csv(data_path)
    print(f"Successfully loaded {len(df)} rows")
else:
    print(f"ERROR: File not found at {os.path.abspath(data_path)}")
    print(f"Directory contents: {os.listdir('.')}")

Read the full file on GitHub · 129 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 129 lines · 23 tokens per session scan A 61612d9de0cb

Subscribe to this mod's changes

python-debug-execution-911f17 is a skill published in the GitHub repository HKUDS/OpenSpace (7,510 stars, last pushed 24d ago), licensed MIT. It adds 23 tokens to every session and 824 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

python-code-quality

Code quality checks, linting, formatting, and type checking commands for the Agent Framework Python codebase. Use this when running checks, fixing lint errors, or troubleshooting CI failures.

microsoft/agent-framework · 40 tokens

plugin-architecture-patterns

Design, implement, or diagnose Xberg plugin traits, typed registries, priority collisions, lifecycle, native extractors, and Alef-generated Python plugin bridges. Load for plugin-system work, not ordinary extractor parsing.

xberg-io/xberg · 49 tokens

test-corpus

The testdocuments submodule is a bucket-fetched fixture corpus that is not committed. This skill covers readtestfixture, missing fixtures, valid A/B controls, and submodule push order. Load before running Rust tests on a fresh clone, setting up an A/B control, adding a fixture-backed test, or diagnosing…

xberg-io/xberg · 72 tokens

idapython

IDA Pro Python scripting for reverse engineering. Use when writing IDAPython scripts, analyzing binaries, working with IDA's API for disassembly, decompilation (Hex-Rays), type systems, cross-references, functions, segments, or any IDA database manipulation. Covers ida modules (50+), idautils iterators, and common…

mrexodia/ida-pro-mcp · 77 tokens

stack-trace-python-probe

Internal helper for meta-stack-trace-investigator. Use when a Python traceback needs Python-specific root-cause checks, pytest reproducer guidance, and defensive patch targets.

opensquilla/opensquilla · 40 tokens

pyghidra-scripting

Write and run Python (PyGhidra) code inside the Ghidra session that ReVa's MCP server is already attached to, using the five ReVa scripting tools — run-script, list-scripts, read-script, write-script, edit-script. Use this whenever the user asks to execute Python against the current program, reach for the Ghidra Flat…

cyberkaida/reverse-engineering-assistant · 209 tokens