python-cli
Skill4 starsChanged 6 months agoMITView on GitHub
Execute Python inline scripts via heredocs for complex log processing, data transformation, or CLI utilities like URL encoding/decoding. You MUST load this skill when processing large logs or performing one-liner data operations.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- hugobatista/agent-skillstheir own version, first seen Sep 20, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- hugobatista/agent-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository124 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/AGENTS.mdAGENTS.md
- .github/workflows/AGENTS.mdAGENTS.md
- .vscode/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- agent-log-analysisSkill
- agent-mdSkill
- agent-md-writerSkill
- agent-skill-md-writerSkill
- agentskillsSkill
- agents-md-writerSkill
- ai-prompt-writerSkill
- ansibleSkill
- apache-airflow-apiSkill
- apache-airflow-dagsSkill
- astro-cliSkill
- astronomer-docsSkill
- awesome-copilotSkill
- brainstorm-agent-runsSkill
- brainstorm-github-prSkill
- brainstormSkill
- catSkill
- chrome-devtoolsSkill
- claude-docsSkill
- codeqlSkill
- code-reviewSkill
- code-tourSkill
- coding-standard-writerSkill
- context-aware-opsSkill
- copilot-cliSkill
- copilot-docsSkill
- critical-thinkingSkill
- datadog-agentSkill
- datadog-apiSkill
- datadog-mcpSkill
- datadog-monitorsSkill
- datadog-pulumiSkill
- devcontainerSkill
- dictationSkill
- direnvSkill
- dockerfileSkill
- dockerSkill
- docs-reviewSkill
- docs-writerSkill
- dot-claudeSkill
- dotfilesSkill
- dot-githubSkill
- editorconfigSkill
- fact-writerSkill
- gdpr-compliantSkill
- gh-agent-taskSkill
- gh-apiSkill
- gh-aw-compileSkill
- gh-aw-firewall-debugSkill
- gh-aw-firewallSkill
- gh-aw-newSkill
- gh-awSkill
- gh-aw-troubleshootingSkill
- gh-codespaceSkill
- gh-issueSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Use Python via python3 - <<'PY' heredocs or one-liners when processing large log files, performing data transformations (like URL …
- Very specific: line 21
When processing complex JSON structures in shell scripts where jq is insufficient or unavailable.
- Distinctive: line 23
When iterating over massive log files requiring stateful parsing that breaks standard bash pipelines.
- Very specific: line 28
When a simple grep or sed command is completely sufficient and more performant for the task.
- Distinctive: line 29
If the environment explicitly lacks a Python interpreter.
- Very specific: line 40
Self-Contained Execution: Use heredoc (<<'PY') to execute inline Python without writing temporary .py scripts.
- Very specific: line 41
Quote the delimiter: Always quote the heredoc delimiter (<<'PY') to prevent variable expansion by bash.
- Distinctive: line 81
Use this pattern when you need to extract and print a specific slice of lines from a file.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: python-cli
<!-- markdownlint-disable MD013 MD023 MD031 MD032 -->Use Python via python3 - <<'PY' heredocs or one-liners when processing large log files,
performing data transformations (like URL encoding/decoding), or parsing structured data (like JSON)
where standard bash utilities (awk/sed/grep) become unwieldy or fragile. If python3 is
unavailable, you may fall back to python.
When to Use
- When processing complex JSON structures in shell scripts where
jqis insufficient or unavailable. - To perform multi-line text transformations, URL encoding, or regex processing inline.
- When iterating over massive log files requiring stateful parsing that breaks standard bash pipelines.
When Not to Use
- For writing permanent, complex application logic (create a proper
.pymodule instead). - When a simple
greporsedcommand is completely sufficient and more performant for the task. - If the environment explicitly lacks a Python interpreter.
Common Pitfalls
- Unquoted Heredocs: Failing to quote the heredoc delimiter (
<<'PY'), causing bash to prematurely expand$variablesintended for Python logic. - Memory Exhaustion: Using
file.read()orreadlines()on multi-gigabyte log files instead of iterating line-by-line (for line in file:). - Silent Failures: Forgetting to wrap file operations in a
try...exceptblock, causing the entire inline script to crash if one log file is missing.
Core Principles
- Avoid Fragile Bash Pipelines: Transition to Python for multi-file processing, stateful parsing, or complex data transformations.
- Self-Contained Execution: Use heredoc (
<<'PY') to execute inline Python without writing temporary.pyscripts. - Quote the delimiter: Always quote the heredoc delimiter (
<<'PY') to prevent variable expansion by bash. - Robust Parsing: Utilize built-in
json,pathlib, andremodules for robust text parsing.
Usage Patterns
Generic Log Processing and Filtering
Process multiple files, parse JSON structures, and filter for specific keywords or conditions dynamically.
python3 - <<'PY'
import json
import pathlib
# Define input sources mapping logical names to file paths
files = {
'system-A': '/tmp/log-A.json',
'system-B': '/tmp/log-B.json'
}
keywords = ['failed', 'fatal', 'error']
for name, path in files.items():
print(f'===== {name} =====')
try:
# Use streaming approach for large files to minimize memory footprint
with open(path, 'r', encoding='utf-8') as f:
for i, line in enumerate(f):
lower_line = line.lower()
if any(k in lower_line for k in keywords):
# strip() removes trailing newline for cleaner output
print(f'{i+1}: {line.strip()}')
except Exception as e:
print(f"Failed to process {name} (path: {path}): {e}")
print()
PYRead Specific Line Range
Use this pattern when you need to extract and print a specific slice of lines from a file.
python3 -c "import sys; print(''.join(open('<file-path>').readlines()[140:160]))"URL Encoding and Decoding
Perform quick URL encoding or decoding using Python's urllib.parse.
URL Encode:
echo "text to encode" | python3 -c "import urllib.parse; print(urllib.parse.quote(input()))"URL Decode:
echo "text%20to%20decode" | python3 -c "import urllib.parse; print(urllib.parse.unquote(input()))"Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

