SuperAPI AI Directory

oracle-cheatsheet

General & other

View repository

Updated 10-16 09:29

About this skill

/oracle-cheatsheet — Session Command Cheat Sheet Generator

Summarize all commands actually used in this session as a cheat sheet — ready to copy-paste, ready to send to a friend

When to invoke

  • The user says "cheatsheet", "cheat sheet", "สูตรโกง" (cheat sheet), "รวมคำสั่ง" (command collection), or "command reference".
  • After a long session ends, want to gather commands in one place
  • Want to summarize for a friend or team

Topic selection (important — don't ask)

Take it from the most recent context being discussed Don't ask the user what topic to make it about, because a cheat sheet compiles the code/commands actually used — it's already specific to the latest context

  • If just discussed maw arra plugin → cheat sheet = maw arra commands
  • If just discussed crash recovery → cheat sheet = crash recovery commands
  • If just discussed deploy → cheat sheet = deploy commands
  • Read the latest conversation memory then start writing immediately, no need for AskUserQuestion

Style guide (important — this is the DNA of this skill)

Must always write like this:

  1. Open with a title + short 1-line tagline (under #)
  2. Icon sections — use an emoji to lead each category: 🐾 🔧 📨 🔍 🌐 📋 🔁 ⚡ ⚠️
  3. Code blocks that can be copy-pasted immediately — not pseudo-code, no <placeholder> that you have to guess, put real values from the session
  4. Quick-reference table — at the end of the sheet there's a table | ทำอะไร | คำสั่ง | short summary
  5. traps actually encountered — table | trap | วิธีเลี่ยง | from this session's experience
  6. No long prose — every section is heading + code + 1-2 lines of short notes
  7. env/config section — gather env vars + config that need to be set in one place
  8. Close with 🤖 signature per Rule 6

Procedure

1. Mine session for commands

ORACLE_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
ENCODED_PWD=$(echo "$ORACLE_ROOT" | sed 's|^/|-|; s|[/.]|-|g')
PROJECT_DIR="$HOME/.claude/projects/${ENCODED_PWD}"
LATEST_JSONL=$(ls -t "$PROJECT_DIR"/*.jsonl 2>/dev/null | head -1)

Spawn a Haiku subagent (model: "haiku") with the session JSONL:

python3 - <<'PYEOF'
import json, os
jsonl = os.environ.get('LATEST_JSONL', '')
if not jsonl or not os.path.exists(jsonl): exit(0)
cmds = set()
with open(jsonl) as f:
    for line in f:
        try:
            m = json.loads(line)
            if m.get('type') != 'assistant': continue
            for block in (m.get('message', {}).get('content', []) or []):
                if isinstance(block, dict) and block.get('type') == 'tool_use':
                    if block.get('name') == 'Bash':
                        cmd = block.get('input', {}).get('command', '')
                        if cmd:
                            # extract first meaningful command
                            first = cmd.split('&&')[0].split('|')[0].strip()
                            if first and not first.startswith('#') and not first.startswith('echo'):
                                cmds.add(first[:80])
        except: pass
for c in sorted(cmds):
    print(c)
PYEOF

Pass the output to the subagent with this prompt:

"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."

2. Mine traps from conversation memory

Scan the conversation for:

  • Error messages that led to a different approach
  • Commands that were retried with different arguments
  • Explicit "trap" or "gotcha" or "bug" mentions
  • ⚠️ warnings given during the session

Format each as a row: | trap description | workaround |

3. Build the cheat sheet

Path: ψ/writing/cheatsheets/YYYY-MM-DD_<topic>.md

Use this exact structure (fill from session data):

# <topic> สูตรโกง

> <1-line tagline — what this covers, from what session>

---

## 🔧 <Category 1>

### <sub-topic>

` ` `bash
<real commands from session>
` ` `

## 📨 <Category 2>

...

## ⚡ ลัด

| ทำอะไร | คำสั่ง |
|--------|--------|
| ... | `...` |

## ⚠️ trap ที่เจอจริง

| trap | วิธีเลี่ยง |
|------|-----------|
| ... | ... |

---

🤖 ตอบโดย arra-oracle-v3 จาก Nat → arra-oracle-v3-oracle

4. Customize per topic

If the session is about a specific tool/feature (e.g., maw arra plugin, deploy, federation):

  • Focus sections on that tool's commands
  • Include install/setup at the top
  • Include env/config section

If the session is broad (many topics):

  • Group by workflow phase (setup → develop → review → deploy)
  • Include a "today's highlight" section at top

If the user says "for a friend" or the Thai phrase "ให้เพื่อน" (for a friend):

  • Add install/prereq section at top
  • Make every code block self-contained (no context needed)
  • Separate "ติดตั้งครั้งเดียว" (install once) from "ใช้ทุกวัน" (use every day).

5. Announce

PSI=$(readlink -f "$ORACLE_ROOT/ψ" 2>/dev/null || echo "$ORACLE_ROOT/ψ")
mkdir -p "$PSI/writing/cheatsheets"
SHEET_FILE="$PSI/writing/cheatsheets/$(date +%Y-%m-%d)_${SLUG}.md"
echo "📋 Cheat sheet: $SHEET_FILE"

Notes

  • Don't use /kien-thai — a cheat sheet is a code-heavy reference, not prose
  • Mixed Thai+English language — Thai heading, English code, short Thai note
  • no recap — no "summary" at the end of the file, end at the trap table
  • real values from session — put actual repo name, issue number, port, path, not generic
  • Reuse: the cheat sheet already written is in ψ/writing/cheatsheets/ — if it already exists, then append/update not rewriting everything from scratch