summaryrefslogtreecommitdiff
path: root/skills/python/SKILL.md
diff options
context:
space:
mode:
authortanaka takashi <isazaka@gmail.com>2026-08-12 00:02:23 +0900
committertanaka takashi <isazaka@gmail.com>2026-08-12 00:02:23 +0900
commitce550a127b7dc972651bd15b9f09979a2c38688f (patch)
treef4e09d0f64f74a585e015e6f548c5589fd2442ba /skills/python/SKILL.md
parent55db81082f9165a3965f860cd618bac4242c56b1 (diff)
feat: harden Python workflow and structured planning
Replace the uv-specific skill with a portable Python skill and rewrite the default user system prompt as a concise, structured Markdown execution policy. Normalize a single fenced structured-JSON response, retry invalid skill selection with think disabled, validate selected skill output, and make coding plans keep editing and verification in one task. Document the file_edit patch payload, expose that contract in the tool catalog, and convert malformed patch input into a retryable tool failure instead of terminating the agent task. Update configuration and runtime tests for the Python skill, exact tool catalog, structured-output retry, and implementation-and-verification planning guidance. Verified with 82 Agent.Core tests and an agent-mcp Python scheduling scenario with 49 passing unittest cases.
Diffstat (limited to 'skills/python/SKILL.md')
-rw-r--r--skills/python/SKILL.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/skills/python/SKILL.md b/skills/python/SKILL.md
new file mode 100644
index 0000000..966a4fd
--- /dev/null
+++ b/skills/python/SKILL.md
@@ -0,0 +1,30 @@
+---
+name: python
+description: Pythonコードを作成・実行・検証する。計算、データ処理、自動化、CLI、試作、デバッグ、またはPython testを求められたときに使用する。
+---
+
+# Python
+
+## Workflow
+
+1. 目的、入出力、作業directory、Python version、完了条件を確認する。
+2. 既存projectでは関連fileを先に読み、新規作成では標準ライブラリで満たせるか確認する。
+3. 複雑なコードは許可された作業directory内の`.py`へ保存する。`python -c`へ長いコードを埋め込まない。
+ - 小さな修正で`file_edit`の`patch` operationを使う場合、`patch` fieldにはJSON文字列`{"old_text":"置換前","new_text":"置換後"}`を渡す。unified diffや`@@`形式を渡さない。置換前文字列はfile内で正確に1回だけ一致させる。
+4. 承認済みのPython executableを直接`process_run`し、cwdとargsを分ける。shell、launcher、環境探索Toolを経由しない。
+5. 通常のscriptは`-I <script>`で実行する。単一test scriptは`unittest.main()`を持たせて`-I <test-script>`で実行するか、`-I -m unittest discover -s <test-directory> -p <pattern> -v`で明示的に探索する。isolated modeでimport不能になるfile pathを`-m unittest`へ直接渡さない。
+6. test codeでも`subprocess`、`multiprocessing`、`os.system`を使用しない。CLIはentry functionへ引数とI/Oを渡し、同一process内で検証する。
+7. 正常系に加え、重要な境界条件と失敗条件を決定的なtestで確認する。
+8. stdout、stderr、exit codeを確認し、exit code 0と期待結果の両方を満たした場合だけ成功と報告する。
+
+## Dependency Rules
+
+- 標準ライブラリを優先する。
+- dependencyが不足していても、依頼なしにnetwork接続やpackage installを行わない。
+- 外部packageが必要な場合は、package名、理由、必要な許可をユーザーへ示す。
+
+## Safety and Reporting
+
+- Python executableまたは作業directoryの権限が不足している場合は迂回しない。
+- descendant processを生成するコードや、依頼されていないfilesystem/network操作を追加しない。
+- 最終応答では作成・変更したfile、実行したtest、exit code、主要結果、未検証事項を簡潔に示す。