| name | script-consolidation-documentation |
| category | devops |
| description | Consolidate scattered utility scripts into a centralized directory with comprehensive documentation, then publish to version control. |
Script Consolidation & Documentation
When to Use
Use this skill when you need to:
- Gather utility scripts scattered across multiple directories into one place
- Create comprehensive documentation for existing scripts
- Publish a curated scripts repository for team access
- Perform "script hygiene" โ discovering what scripts actually exist and what they do
Problem Addressed
Scripts often accumulate in various locations (~/scripts/, ~/.hermes/scripts/, skill subdirectories, cron job locations) without centralized documentation. This skill provides a systematic approach to discover, curate, document, and publish them.
Step-by-Step Process
Step 1: Discovery โ Find All Scripts
Search multiple common locations to build a complete inventory:
ls -la ~/.hermes/scripts/
ls -la ~/scripts/
ls -la ~/.local/bin/
find ~/.hermes/skills -name "*.py" -path "*/scripts/*" 2>/dev/null
find ~/.hermes/skills -name "*.sh" -path "*/scripts/*" 2>/dev/null
find ~/.hermes/skills -name "*.mjs" -path "*/scripts/*" 2>/dev/null
crontab -l 2>/dev/null | grep -E '\.(py|sh|mjs)$' || true
hermes cron list
Output needed: Complete list of script paths with purpose (if recognizable from filename/context).
Step 2: Curation โ Select What to Include
Include:
- Standalone utility scripts (not tightly coupled to specific skill internals)
- Scripts referenced by cron jobs
- Monitoring/maintenance scripts
- Deployment/setup scripts
- Scripts with general reuse potential
Exclude:
- Internal skill templates (e.g.,
templates/basic_grpo_training.py)
- Empty
__init__.py files
- Scripts that are clearly one-off experiments
- Large data files or binaries masquerading as scripts
Rule of thumb: If you'd feel comfortable sharing it with a teammate for reuse, include it.
Step 3: Copy to Centralized Directory
Create a new summary directory in the skills repo root (or dedicated scripts repo):
mkdir -p scripts-summary
cp ~/.hermes/scripts/*.py scripts-summary/ 2>/dev/null || true
cp ~/.hermes/scripts/*.sh scripts-summary/ 2>/dev/null || true
cp ~/.hermes/scripts/*.mjs scripts-summary/ 2>/dev/null || true
Set executable permissions (critical for shell scripts):
chmod +x scripts-summary/*.sh
Step 4: Write Comprehensive README.md
Structure the README with these sections:
# [Repository Name] โ Scripts Collection
Brief one-liner describing the collection's purpose.
## Table of Contents
- [Category 1](#category-1)
- [Category 2](#category-2)
---
## Category 1 Name
### ScriptName.ext
**็จ้**: One-sentence purpose
**็จๆณ**:
```bash
# Basic usage
./scriptname [args]
# With options
./scriptname --option value /path/to/output
ๅทฅไฝๅ็ (optional): 1-2 sentences on how it works
ไพ่ต:
ๅ
ณ่ Cron Job (if applicable): Job name โ schedule
ๆณจๆไบ้กน:
- Known gotchas or prerequisites
- Data source limitations
- Platform requirements (macOS/Linux)
Appendix
Script Inventory Table
| Script | Purpose | Dependencies | Cron? |
|---|
daily-report.py | A-share market report | akshare, pandas | โ
|
cron_monitor.py | Job health checker | โ | โ |
Quick Reference
Common one-liners for daily use.
### Step 5: Git Commit & Push
```bash
cd ~/.hermes/skills
# Stage new directory
git add scripts-summary/
# Commit with structured message
git commit -m "Add scripts-summary: centralized utility script repository
- Create scripts-summary/ with 7 curated utility scripts
- Document each script's usage, dependencies, and examples in README.md
- Set executable permissions on shell scripts
- Cover categories: market data, monitoring, watchdog, deployment, testing
"
# Push
git push origin main
Key Decisions & Rationale
Why a scripts-summary/ subdirectory (not replace ~/.hermes/scripts/)?
- Preserve existing cron job paths (they reference
~/.hermes/scripts/ directly)
- Non-breaking change โ existing workflows continue
- Clear separation: "source of truth" vs "published documentation set"
Why document in the repo instead of separate wiki?
- Versioned alongside code โ docs evolve with scripts
- Easier to contribute via PR
- Single source of truth for developers
Why categorize instead of alphabetical?
- Faster scanning โ users look for "monitoring" not "cron_monitor"
- Groups related tools (market data scripts together)
- Better for README table of contents
Common Pitfalls & Tips
Pitfall 1: Forgetting to set executable bits
Shell scripts copied from elsewhere lose +x permission.
Fix:
chmod +x scripts-summary/*.sh
git add --chmod=+x scripts-summary/*.sh
Pitfall 2: Including skill-internal templates accidentally
Templates inside templates/ or references/ subdirectories are usually skill-specific, not general utilities.
Rule: Only copy files from */scripts/ directories, not */templates/ or */references/.
Pitfall 3: Forgetting to test scripts after copying
Scripts may have hardcoded paths (e.g., ~/market-reports/).
Fix: Spot-check 2-3 key scripts:
head -5 scripts-summary/cron_monitor.py
grep -E '\.(py|sh|mjs)$' ~/.hermes/cron_jobs.json
Pitfall 4: README becomes outdated
Scripts change but README doesn't.
Fix: When updating a script, make it a habit to also update its README section in the same commit.
Verification Checklist
Example Outcome
Before: Scripts scattered, undocumented, only original author knows what they do.
After:
~/.hermes/skills/
โโโ scripts-summary/
โโโ README.md # Central documentation
โโโ a-share-daily-report.py # Market data
โโโ cron_monitor.py # Monitoring
โโโ hermes-watchdog.sh # Ops
โโโ sync-reports.sh # Deployment
โโโ test_weixin.py # Testing
Team members can now:
- Read README to understand available tools
- Run scripts directly from
scripts-summary/
- Contribute improvements with clear context
Variations
A. Separate Scripts Repository
Instead of scripts-summary/ inside skills repo, create standalone huidge/hermes-scripts:
mkdir ~/projects/hermes-scripts
cp ~/.hermes/scripts/*.py ~/projects/hermes-scripts/
cd ~/projects/hermes-scripts
git init && git remote add origin git@github.com:huidge/hermes-scripts.git
Use when: scripts are truly independent, not skill-specific.
B. Include Usage Examples
Add examples/ subdirectory with sample invocations:
scripts-summary/
โโโ examples/
โ โโโ daily-report-output.md
โ โโโ cron-monitor-alert.json
C. Add Shell Completions
Include completions/ with bash/zsh completion scripts for frequently used CLI tools.
Skill Version: 1.0
Last Updated: 2026-04-24
Use Case: First applied to consolidate ~/.hermes/scripts/ contents into skills repo with full documentation