$npx -y skills add Soul-Brews-Studio/arra-oracle-skills-cli --skill oracle-cheatsheetGenerate a copy-paste cheat sheet from the current session — commands used, traps hit, shortcuts discovered. Style: icon sections, code blocks, quick-ref tables, trap warnings. Use when user says 'cheatsheet', 'cheat sheet', 'สูตรโกง', 'รวมคำสั่ง', 'command reference', or wants a
| 1 | # /oracle-cheatsheet — Session Command Cheat Sheet Generator |
| 2 | |
| 3 | > สรุปทุกคำสั่งที่ใช้จริงใน session นี้เป็น cheat sheet — copy-paste ได้เลย ส่งให้เพื่อนได้เลย |
| 4 | |
| 5 | ## When to invoke |
| 6 | |
| 7 | - User says "cheatsheet", "cheat sheet", "สูตรโกง", "รวมคำสั่ง", "command reference" |
| 8 | - หลังจบ session ยาว ๆ อยากรวมคำสั่งไว้ที่เดียว |
| 9 | - อยากสรุปให้เพื่อนหรือทีม |
| 10 | |
| 11 | ## Topic selection (สำคัญ — ไม่ต้องถาม) |
| 12 | |
| 13 | **เอาจากบริบทล่าสุดที่คุยกันอยู่เลย** ไม่ต้องถาม user ว่าจะทำเรื่องอะไร เพราะ cheat sheet เป็นการรวบรวม code/command ที่ใช้จริง — มัน specific กับ context ล่าสุดอยู่แล้ว |
| 14 | |
| 15 | - ถ้าเพิ่งคุยเรื่อง maw arra plugin → cheat sheet = maw arra commands |
| 16 | - ถ้าเพิ่งคุยเรื่อง crash recovery → cheat sheet = crash recovery commands |
| 17 | - ถ้าเพิ่งคุยเรื่อง deploy → cheat sheet = deploy commands |
| 18 | - **อ่าน conversation memory ล่าสุด** แล้วเริ่มเขียนเลย ไม่ต้อง AskUserQuestion |
| 19 | |
| 20 | ## Style guide (สำคัญ — นี่คือ DNA ของ skill นี้) |
| 21 | |
| 22 | **ต้องเขียนแบบนี้เสมอ:** |
| 23 | |
| 24 | 1. **เปิดด้วย title + tagline สั้น 1 บรรทัด** (ใต้ `#`) |
| 25 | 2. **Icon sections** — ใช้ emoji นำแต่ละหมวด: 🐾 🔧 📨 🔍 🌐 📋 🔁 ⚡ ⚠️ |
| 26 | 3. **Code blocks copy-paste ได้ทันที** — ไม่ใช่ pseudo-code, ไม่มี `<placeholder>` ที่ต้องเดา ใส่ค่าจริงจาก session |
| 27 | 4. **ตาราง ลัด** — ท้าย sheet มีตาราง `| ทำอะไร | คำสั่ง |` สรุปสั้น ๆ |
| 28 | 5. **trap ที่เจอจริง** — ตาราง `| trap | วิธีเลี่ยง |` จากประสบการณ์ session นี้ |
| 29 | 6. **ไม่มี prose ยาว** — ทุก section คือ heading + code + หมายเหตุสั้น 1-2 บรรทัด |
| 30 | 7. **env/config section** — รวม env vars + config ที่ต้องตั้งไว้ที่เดียว |
| 31 | 8. **ปิดด้วย 🤖 signature** ตาม Rule 6 |
| 32 | |
| 33 | ## Procedure |
| 34 | |
| 35 | ### 1. Mine session for commands |
| 36 | |
| 37 | ```bash |
| 38 | ORACLE_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd) |
| 39 | ENCODED_PWD=$(echo "$ORACLE_ROOT" | sed 's|^/|-|; s|[/.]|-|g') |
| 40 | PROJECT_DIR="$HOME/.claude/projects/${ENCODED_PWD}" |
| 41 | LATEST_JSONL=$(ls -t "$PROJECT_DIR"/*.jsonl 2>/dev/null | head -1) |
| 42 | ``` |
| 43 | |
| 44 | Spawn a **Haiku subagent** (model: "haiku") with the session JSONL: |
| 45 | |
| 46 | ```bash |
| 47 | python3 - <<'PYEOF' |
| 48 | import json, os |
| 49 | jsonl = os.environ.get('LATEST_JSONL', '') |
| 50 | if not jsonl or not os.path.exists(jsonl): exit(0) |
| 51 | cmds = set() |
| 52 | with open(jsonl) as f: |
| 53 | for line in f: |
| 54 | try: |
| 55 | m = json.loads(line) |
| 56 | if m.get('type') != 'assistant': continue |
| 57 | for block in (m.get('message', {}).get('content', []) or []): |
| 58 | if isinstance(block, dict) and block.get('type') == 'tool_use': |
| 59 | if block.get('name') == 'Bash': |
| 60 | cmd = block.get('input', {}).get('command', '') |
| 61 | if cmd: |
| 62 | # extract first meaningful command |
| 63 | first = cmd.split('&&')[0].split('|')[0].strip() |
| 64 | if first and not first.startswith('#') and not first.startswith('echo'): |
| 65 | cmds.add(first[:80]) |
| 66 | except: pass |
| 67 | for c in sorted(cmds): |
| 68 | print(c) |
| 69 | PYEOF |
| 70 | ``` |
| 71 | |
| 72 | Pass the output to the subagent with this prompt: |
| 73 | > "Here are shell commands actually used in a Claude Code session. Group them by purpose (team management, search/query, git/PR, fleet communication, server, etc.). For each group, pick the most useful 3-5 commands. Return as markdown sections with code blocks. No prose — just heading + code + 1-line note." |
| 74 | |
| 75 | ### 2. Mine traps from conversation memory |
| 76 | |
| 77 | Scan the conversation for: |
| 78 | - Error messages that led to a different approach |
| 79 | - Commands that were retried with different arguments |
| 80 | - Explicit "trap" or "gotcha" or "bug" mentions |
| 81 | - `⚠️` warnings given during the session |
| 82 | |
| 83 | Format each as a row: `| trap description | workaround |` |
| 84 | |
| 85 | ### 3. Build the cheat sheet |
| 86 | |
| 87 | **Path**: `ψ/writing/cheatsheets/YYYY-MM-DD_<topic>.md` |
| 88 | |
| 89 | Use this exact structure (fill from session data): |
| 90 | |
| 91 | ```markdown |
| 92 | # <topic> สูตรโกง |
| 93 | |
| 94 | > <1-line tagline — what this covers, from what session> |
| 95 | |
| 96 | --- |
| 97 | |
| 98 | ## 🔧 <Category 1> |
| 99 | |
| 100 | ### <sub-topic> |
| 101 | |
| 102 | ` ` `bash |
| 103 | <real commands from session> |
| 104 | ` ` ` |
| 105 | |
| 106 | ## 📨 <Category 2> |
| 107 | |
| 108 | ... |
| 109 | |
| 110 | ## ⚡ ลัด |
| 111 | |
| 112 | | ทำอะไร | คำสั่ง | |
| 113 | |--------|--------| |
| 114 | | ... | `...` | |
| 115 | |
| 116 | ## ⚠️ trap ที่เจอจริง |
| 117 | |
| 118 | | trap | วิธีเลี่ยง | |
| 119 | |------|-----------| |
| 120 | | ... | ... | |
| 121 | |
| 122 | --- |
| 123 | |
| 124 | 🤖 ตอบโดย arra-oracle-v3 จาก Nat → arra-oracle-v3-oracle |
| 125 | ``` |
| 126 | |
| 127 | ### 4. Customize per topic |
| 128 | |
| 129 | **If the session is about a specific tool/feature** (e.g., maw arra plugin, deploy, federation): |
| 130 | - Focus sections on that tool's commands |
| 131 | - Include install/setup at the top |
| 132 | - Include env/config section |
| 133 | |
| 134 | **If the session is broad** (many topics): |
| 135 | - Group by workflow phase (setup → develop → review → deploy) |
| 136 | - Include a "today's highlight" section at top |
| 137 | |
| 138 | **If user says "for a friend" / "ให้เพื่อน"**: |
| 139 | - Add install/prereq section at top |
| 140 | - Make every code block self-contained (no context needed) |
| 141 | - Add "ติดต |