NekoCore-OS python
Python developer — write, run, test, and debug Python projects. Gives the entity the ability to create scripts, tools, data pipelines, and applications using Python and pip.
install
source · Clone the upstream repo
git clone https://github.com/voardwalker-code/NekoCore-OS
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/voardwalker-code/NekoCore-OS "$T" && mkdir -p ~/.claude/skills && cp -r "$T/project/skills/python" ~/.claude/skills/voardwalker-code-nekocore-os-python-3e7e44 && rm -rf "$T"
manifest:
project/skills/python/SKILL.mdsource content
Python Skill
You can write Python code, run it, install packages, and read output — all within the workspace. You have access to
python, pip, and file tools.
What You Can Do
- Write Python scripts — create
files with.pyws_write - Run scripts — execute with
cmd_run - Install packages — use
pip install - Run tests — execute test files or use pytest
- Create project structures — scaffold with proper
files__init__.py - Debug errors — read tracebacks, fix the code, re-run
Your Tools
File tools (write code)
[TOOL:ws_mkdir path="my-project/src"] [TOOL:ws_write path="my-project/main.py" content="print('Hello, world!')"] [TOOL:ws_read path="my-project/main.py"] [TOOL:ws_list path="my-project"]
Command tools (run and install)
[TOOL:cmd_run cmd="python main.py"] [TOOL:cmd_run cmd="python -m pytest"] [TOOL:cmd_run cmd="python -m pytest tests/ -v"] [TOOL:cmd_run cmd="pip install requests"] [TOOL:cmd_run cmd="pip install -r requirements.txt"] [TOOL:cmd_run cmd="pip list"] [TOOL:cmd_run cmd="pip freeze"]
CRITICAL RULES — Read These First
Rule 1: Always write COMPLETE files
Never write partial
.py files. Write the full source code every time with ws_write.
Rule 2: Read before editing
Before modifying any existing file:
[TOOL:ws_read path="src/app.py"]
Then write the complete modified version back.
Rule 3: Use python (not python3) as default
Try
python first. If it fails, fall back to python3. On most systems python works.
Rule 4: Read tracebacks carefully
Python tracebacks read bottom-to-top. The last line is the actual error. The lines above show the call stack. Fix the code at the location shown.
Rule 5: One command per cmd_run call
Each
cmd_run runs one command. Do NOT chain commands with && or ;.
Rule 6: Create requirements.txt for projects
If you use any
pip install, also create a requirements.txt so the project is reproducible.
How to Build a Python Project — Step by Step
Simple script
Step 1: [TOOL:ws_write path="main.py" content="...your code..."] Step 2: [TOOL:cmd_run cmd="python main.py"]
Project with dependencies
Step 1: [TOOL:ws_mkdir path="my-project"] Step 2: [TOOL:ws_write path="my-project/requirements.txt" content="requests>=2.28\nbeautifulsoup4>=4.12"] Step 3: [TOOL:cmd_run cmd="pip install -r requirements.txt"] Step 4: [TOOL:ws_write path="my-project/main.py" content="...your code..."] Step 5: [TOOL:cmd_run cmd="python main.py"]
Package with modules
Step 1: [TOOL:ws_mkdir path="my-project/src"] Step 2: [TOOL:ws_write path="my-project/src/__init__.py" content=""] Step 3: [TOOL:ws_write path="my-project/src/core.py" content="..."] Step 4: [TOOL:ws_write path="my-project/src/utils.py" content="..."] Step 5: [TOOL:ws_write path="my-project/main.py" content="from src.core import ..."] Step 6: [TOOL:cmd_run cmd="python main.py"]
Python Patterns — What Good Code Looks Like
Basic script structure
"""Brief description of what this script does.""" import sys from pathlib import Path def main(): """Entry point.""" if len(sys.argv) < 2: print("Usage: python main.py <input_file>") sys.exit(1) input_path = Path(sys.argv[1]) if not input_path.exists(): print(f"Error: {input_path} not found") sys.exit(1) process(input_path) def process(path): """Process the input file.""" content = path.read_text(encoding="utf-8") print(f"Processed {len(content)} characters") if __name__ == "__main__": main()
Classes
class Config: """Application configuration.""" def __init__(self, host="localhost", port=8080): self.host = host self.port = port def url(self): return f"http://{self.host}:{self.port}" def __repr__(self): return f"Config(host={self.host!r}, port={self.port})"
Error handling
def read_json(path): """Read and parse a JSON file.""" try: with open(path, encoding="utf-8") as f: return json.load(f) except FileNotFoundError: print(f"Error: {path} not found") return None except json.JSONDecodeError as e: print(f"Error: invalid JSON in {path}: {e}") return None
Working with files
from pathlib import Path # Read content = Path("data.txt").read_text(encoding="utf-8") # Write Path("output.txt").write_text("Hello\n", encoding="utf-8") # Iterate directory for f in Path("src").glob("*.py"): print(f.name) # Create directories Path("output/reports").mkdir(parents=True, exist_ok=True)
HTTP requests (with requests library)
import requests def fetch_data(url): response = requests.get(url, timeout=10) response.raise_for_status() return response.json()
Data processing with collections
from collections import Counter, defaultdict # Count words words = text.lower().split() counts = Counter(words) top_10 = counts.most_common(10) # Group items groups = defaultdict(list) for item in items: groups[item["category"]].append(item)
List comprehensions and generators
# Filter and transform names = [user["name"] for user in users if user["active"]] # Dictionary comprehension lookup = {item["id"]: item for item in items} # Generator for large data lines = (line.strip() for line in open("big.txt", encoding="utf-8"))
Context managers
# File I/O with open("data.csv", encoding="utf-8") as f: for line in f: process(line) # Custom context manager from contextlib import contextmanager @contextmanager def timer(label): import time start = time.time() yield print(f"{label}: {time.time() - start:.3f}s") with timer("processing"): do_work()
Common Packages by Use Case
| Need | Package | Install |
|---|---|---|
| HTTP requests | | |
| HTML parsing | | |
| JSON schema | | |
| CLI arguments | or | is built-in |
| Data analysis | | |
| Math/arrays | | |
| Plotting | | |
| Testing | | |
| Web server | or | |
| Async HTTP | or | |
| Regex | | Built-in |
| Date/time | | Built-in |
| Path handling | | Built-in |
| JSON | | Built-in |
| CSV | | Built-in |
| SQLite | | Built-in |
Testing
Writing tests with unittest (built-in)
import unittest from src.core import add class TestAdd(unittest.TestCase): def test_positive(self): self.assertEqual(add(2, 3), 5) def test_negative(self): self.assertEqual(add(-1, 1), 0) def test_zero(self): self.assertEqual(add(0, 0), 0) if __name__ == "__main__": unittest.main()
Writing tests with pytest
from src.core import add def test_positive(): assert add(2, 3) == 5 def test_negative(): assert add(-1, 1) == 0
Running tests
[TOOL:cmd_run cmd="python -m pytest tests/ -v"] [TOOL:cmd_run cmd="python -m unittest tests/test_core.py"] [TOOL:cmd_run cmd="python -m pytest tests/test_core.py -v"]
requirements.txt Patterns
Pinned versions (production)
requests==2.31.0 beautifulsoup4==4.12.2 pydantic==2.5.0
Minimum versions (libraries)
requests>=2.28 beautifulsoup4>=4.12
With extras
fastapi[all]>=0.104 uvicorn[standard]>=0.24
Debugging Workflow
When code fails:
- Read the traceback bottom-to-top — the last line is the actual error
- Find the file and line number — the traceback shows exactly where it failed
- Read the source file:
[TOOL:ws_read path="src/app.py"] - Fix the specific issue — change only what's broken
- Write the fixed file and re-run:
[TOOL:ws_write path="src/app.py" content="...fixed code..."] [TOOL:cmd_run cmd="python src/app.py"]
Common error patterns
| Error | Meaning | Fix |
|---|---|---|
| Variable/function not defined | Check spelling, add import |
| Wrong type passed | Check function signature |
| Dict key missing | Use with default |
| List index out of range | Check length before access |
| Module not found | the package |
| File doesn't exist | Check path, create if needed |
| Object doesn't have that method | Check type, wrong variable |
| Wrong whitespace | Fix indentation (4 spaces) |
Project Scaffolding Patterns
Script
my-script/ main.py requirements.txt
CLI tool
my-tool/ main.py requirements.txt (click) src/ __init__.py commands.py utils.py
Web API (Flask)
my-api/ requirements.txt (flask) app.py routes/ __init__.py health.py users.py models/ __init__.py user.py
Data pipeline
my-pipeline/ requirements.txt (pandas, numpy) main.py src/ __init__.py extract.py transform.py load.py data/ input/ output/
What NOT to Do
- Do NOT write code in chat — use
to save it as a filews_write - Do NOT write partial files — always write the complete
file.py - Do NOT guess what's in a file — always
firstws_read - Do NOT install packages without requirements.txt — keep it reproducible
- Do NOT use
in code — useos.system()
insteadsubprocess.run() - Do NOT add features the user didn't ask for — keep it focused
- Do NOT skip the
guard — always include it for scriptsif __name__ == "__main__": - Do NOT chain commands — one
call per commandcmd_run - Do NOT hardcode file paths — use
and relative pathspathlib.Path