--- name: skill-augmentation-from-source description: Clone external repos, extract knowledge, and merge into existing Hermes skills. Use when user asks to add a tool/plugin's knowledge into a skill by referencing a GitHub repo or documentation URL. category: software-development --- # Skill Augmentation from Source Clone external knowledge (repos, docs) และ integrate เข้ากับ existing skill โดยไม่ต้อง rewrite ทั้งหมด ## When to Use - User ขอให้เพิ่มความรู้เกี่ยวกับ tool/plugin จาก GitHub repo เข้าสู่ existing skill - External repo มี structured docs (SKILL.md, README ที่ดี) ที่สามารถ extract ได้เลย - User ต้องการให้ skill รู้จัก new tool ที่ไม่เคยมี ## Core Workflow ``` [1] Locate existing skill ↓ [2] Read existing skill — ดูว่ามีอะไรแล้ว ขาดอะไร ↓ [3] Clone/extract external source ↓ [4] Analyze gap — อะไรใน source ที่ยังไม่มีใน skill ↓ [5] Patch existing skill — เพิ่มเฉพาะส่วนที่ขาด ↓ [6] Add new skill if needed — ถ้าเป็น topic ใหม่ที่ไม่เคยมี ``` ## Step 1: Locate Existing Skill Hermes skills อยู่ที่: ``` ~/.hermes/skills/ ``` ถ้าเป็น sub-skill อาจอยู่ใน: ``` ~/.hermes/skills/// ~/.config/opencode/skills// ``` ```bash # ค้นหา skill ที่มีอยู่แล้ว find ~/.hermes/skills -name "SKILL.md" | xargs grep -l "keyword" 2>/dev/null find / -name "website-creator" -type d 2>/dev/null | head -5 ``` ## Step 2: Read Existing Skill ```bash # ดู line count ก่อน wc -l /path/to/SKILL.md # อ่านทีละส่วน (offset/limit) read_file(path, offset=1, limit=200) ``` **Focus หา:** - Sub-skill routing table (ถ้ามี) - Workflow steps - Troubleshooting section - Templates section ## Step 3: Clone/Extract External Source ```bash # Clone entire repo git clone --depth 1 https://github.com/user/repo.git /tmp/repo-clone # ถ้าเป็น monorepo — ค้นหา skill/docs path find /tmp/repo-clone -type f -name "SKILL.md" | head -10 find /tmp/repo-clone -type f -name "README.md" | head -10 # ถ้าเป็น tool ที่มี package.json cat /tmp/repo-clone/package.json ``` ## Step 4: Analyze Gap Compare: 1. **สิ่งที่ source มี** — ดูจาก README/docs 2. **สิ่งที่ existing skill มี** — จากการ read 3. **สิ่งที่ขาด** — patch เฉพาะส่วนที่ขาด ### Gap Analysis Checklist | สิ่งที่ต้องเช็ค | เครื่องมือ | |----------------|-----------| | Configuration patterns | Config files, examples | | Code patterns | Example code blocks | | Installation commands | package.json, README | | Integration steps | Setup sections | | Sub-skill routing | Skills table | | Troubleshooting | Known issues section | ## Step 5: Patch Existing Skill ใช้ `patch` tool เพื่อเพิ่มเฉพาะส่วนที่ขาด: ### Pattern A: เพิ่มใน Sub-skill Routing Table ```markdown // หา routing table | Existing | `some-skill` | Description | // Patch old_string: "| Existing | `some-skill` | Description |" new_string: "| Existing | `some-skill` | Description |\n| New Tool | `new-tool` | What it does |" ``` ### Pattern B: เพิ่ม Section ใหม่ ```markdown // หา landmark ที่ชัดเจน (header หรือ divider ก่อน section ที่ต้องการ) // เพิ่มก่อน section นั้น old_string: "---\n\n## Templates" new_string: "---\n\n## New Section\n\nContent here.\n\n---\n\n## Templates" ``` ### Pattern C: อัปเดต Workflow Step ```markdown // หา step ที่เกี่ยวข้อง old_string: "### Step 8: SEO Setup\n\n**เรียก skills: `seo-analyzers`" new_string: "### Step 8: SEO Setup\n\n**เรียก skills: `seo-analyzers` + `new-tool`**\n\n1. **New Tool Integration:**\n - ติดตั้ง package\n - เพิ่ม config" ``` ## Step 6: Create New Skill (if needed) ถ้า topic ใหม่ที่ไม่เคยมีใน existing skills: ```bash # Clone skill content mkdir -p ~/.hermes/skills/ cp /tmp/repo-clone/path/to/SKILL.md ~/.hermes/skills//SKILL.md # Copy reference files if any mkdir -p ~/.hermes/skills//reference cp /tmp/repo-clone/reference/*.md ~/.hermes/skills//reference/ ``` ## Critical Rules 1. **อย่า rewrite ทั้งหมด** — patch เฉพาะส่วนที่ขาด 2. **อ่าน existing skill ก่อน** — ต้องรู้ว่ามีอะไรแล้วบ้าง 3. **เช็ค path จริง** — skills อยู่หลายที่ (`~/.hermes/skills/`, `~/.config/opencode/skills/`, etc.) 4. **หา sub-skill routing table** — ถ้ามี เพิ่มเข้าไปที่นั่นก่อน 5. **ทดสอบ patch** — grep หาสิ่งที่เพิ่มหลัง patch เสร็จ ## Example: Adding SEO Plugin to website-creator ``` Source: https://github.com/pOwn3d/payload-seo-analyzer.git Existing skill: website-creator Action: Add SEO analyzer plugin integration + Lexical rendering docs ``` Steps: 1. Clone SEO analyzer repo 2. Read README (full content — this tool has detailed docs) 3. Find existing skill: `~/.hermes/skills/software-development/website-creator/SKILL.md` 4. Gap analysis: - Existing skill has `richText` field in collections - Missing: how to render Lexical JSON in frontend - Missing: SEO plugin integration - Missing: content seeding workflow 5. Patch: - Add `SEO Analyzer Plugin Integration` section - Add `Lexical RichText Rendering in Frontend` section - Add to Sub-skill Routing table 6. Create payload sub-skill from official Payload CMS claude-plugin