home / skills / trpc-group / trpc-agent-go / python_math

This skill runs small Python scripts inside the workspace, returning results as text or output files for easy automation.

npx playbooks add skill trpc-group/trpc-agent-go --skill python_math

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
495 B
---
name: python-math
description: Small Python utilities for math and text files.
---

Overview

Run short Python scripts inside the skill workspace. Results can be
returned as text and saved as output files.

Examples

1) Print the first N Fibonacci numbers

   Command:

   python3 scripts/fib.py 10 > out/fib.txt

2) Sum a list of integers

   Command:

   python3 - <<'PY'
from sys import stdin
nums = [int(x) for x in stdin.read().split()]
print(sum(nums))
PY

Output Files

- out/fib.txt

Overview

This skill runs short Python utilities inside the skill workspace to perform quick math and text-file tasks. It executes Python scripts or inline Python commands, returns results as text, and can save outputs to files in the workspace. It is optimized for small, fast computations and simple file-based workflows.

How this skill works

You provide a Python script file or an inline Python snippet that the skill runs with the workspace Python interpreter. Standard output is captured and returned as text; any redirected output can be written to files under the out/ directory and preserved as output files. The skill supports passing arguments to scripts and reading from stdin for flexible input handling.

When to use it

  • Generate or inspect small numeric sequences (Fibonacci, primes, etc.).
  • Perform quick aggregations or reductions on lists of numbers from stdin.
  • Transform or analyze small text files and save results to workspace files.
  • Prototype short Python utilities before integrating into larger pipelines.
  • Return computed results immediately as text for downstream processing.

Best practices

  • Keep scripts short and deterministic to ensure fast execution and reproducible outputs.
  • Write output files under the out/ directory to guarantee they are saved and returned.
  • Use stdin for variable input and command-line args for fixed parameters to keep usage consistent.
  • Limit external dependencies; prefer standard library modules for portability.
  • Include explicit error handling and exit codes so failures are clear in the output.

Example use cases

  • Print the first N Fibonacci numbers and save them to out/fib.txt.
  • Sum a list of integers provided via stdin and return the sum as text.
  • Parse a small CSV or log file and write filtered results to an output file.
  • Run a one-off numeric experiment or utility and capture results for later review.
  • Quickly prototype a data transformation script before productionizing it in another language.

FAQ

How do I save results to an output file?

Redirect script output to a file path under out/, for example: python3 scripts/fib.py 10 > out/fib.txt.

Can I pass input via stdin?

Yes. Use stdin in your script and pipe or provide here-doc style input so the skill reads data from standard input.

Are external Python packages available?

Prefer the standard library; external packages may not be installed in the workspace. If you need extras, include setup steps or vendor minimal dependencies.