Place it after all the code, as the very last lines of the file.
Required structure:
# ===== SUMMARY =====
# Brief description of what the script does and when to use it.
# Syntax: python script.py <args>
# ===== END SUMMARY =====
Reason: LLMs/agents pay the most attention to the end of the text; placing the summary there ensures the most up-to-date information is captured when generating docs.
pyscripts_docs.md – generated automatically by summary.py
This is the index of all scripts, containing a table:
| Script | Summary | Syntax |
|--------|---------|--------|
| … | … | … |
The script summary.py scans all .py files, reads the # ===== SUMMARY ===== block at the end of each file, extracts the description and syntax, then writes pyscripts_docs.md.
pyscripts_pitfall.md – manually recorded errors
Whenever an agent runs a script and encounters an error, it will:
pyscripts_pitfall.md using this template:
### Error: [script name] – [short description]
- Cause: ...
- Fix: ...
- Date encountered: ...
This file helps avoid repeating mistakes and speeds up future handling.
pyscripts_docs.md.
python (or via terminal tool).
pyscripts_pitfall.md if the error is worth remembering, to prevent it in the future.
summary.py every time a script is added/modified/deleted to update pyscripts_docs.md.
execute_code – script files remain primary
Even small scripts are saved as standalone .py files for easy reuse.
execute_code is only used for one-liners or quick checks.
| Script | Function |
|--------|-----------|
| summary.py | Scans all .py files, extracts end-of-file summaries, generates pyscripts_docs.md |
Other utility scripts (query, update, fix…) will be listed in pyscripts_docs.md.
Summary of key changes:
pyscripts-org.
pyscripts_docs.md (auto-generated).
pyscripts_pitfall.md (manual error log).
共 1 个版本