context-mode
Fungsinya
Skill ini memandu agent AI memproses keluaran perintah dan file besar melalui alat context-mode, alih-alih membacanya seluruhnya. Cocok untuk pengembang yang bekerja dengan log panjang, respons API besar, atau keluaran build.
Kapan dipakai
- βSaat sebuah agent diminta menganalisis log, merangkum keluaran perintah, atau menguraikan respons JSON besar.
- βSaat sebuah build atau pemeriksaan dependensi mungkin menghasilkan keluaran panjang yang perlu disaring.
- βSaat sebuah snapshot halaman atau struktur browser terlalu besar untuk dibaca langsung.
Link skill
https://github.com/mksglu/context-mode/blob/main/skills/context-mode/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βAnalisis log build ini dan beri tahu saya hanya bagian error-nya, tanpa menampilkan keluaran lengkapnya.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Skill menetapkan aturan default: gunakan alat context-mode untuk apa pun yang membaca, melakukan kueri, mengambil, mendaftar, atau membangun, dan tetap gunakan perintah shell biasa untuk tindakan kecil yang aman. Agent kemudian hanya menampilkan bagian yang penting.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Context Mode: Default for All Large Output
MANDATORY RULE
<context_mode_logic> <mandatory_rule> Default to context-mode for ALL commands. Only use Bash for guaranteed-small-output operations. </mandatory_rule> </context_mode_logic>Bash whitelist (safe to run directly):
- File mutations:
mkdir,mv,cp,rm,touch,chmod - Git writes:
git add,git commit,git push,git checkout,git branch,git merge - Navigation:
cd,pwd,which - Process control:
kill,pkill - Package management:
npm install,npm publish,pip install - Simple output:
echo,printf
Everything else β ctx_execute or ctx_execute_file. Any command that reads, queries, fetches, lists, logs, tests, builds, diffs, inspects, or calls an external service. This includes ALL CLIs (gh, aws, kubectl, docker, terraform, wrangler, fly, heroku, gcloud, etc.) β there are thousands and we cannot list them all.
When uncertain, use context-mode. Every KB of unnecessary context reduces the quality and speed of the entire session.
Decision Tree
About to run a command / read a file / call an API?
β
βββ Command is on the Bash whitelist (file mutations, git writes, navigation, echo)?
β βββ Use Bash
β
βββ Output MIGHT be large or you're UNSURE?
β βββ Use context-mode ctx_execute or ctx_execute_file
β
βββ Fetching web documentation or HTML page?
β βββ Use ctx_fetch_and_index β ctx_search
β
βββ Using Playwright (navigate, snapshot, console, network)?
β βββ ALWAYS use filename parameter to save to file, then:
β browser_snapshot(filename) β ctx_index(path) or ctx_execute_file(path)
β browser_console_messages(filename) β ctx_execute_file(path)
β browser_network_requests(filename) β ctx_execute_file(path)
β β browser_navigate returns a snapshot automatically β ignore it,
β use browser_snapshot(filename) for any inspection.
β β Playwright MCP uses a SINGLE browser instance β NOT parallel-safe.
β For parallel browser ops, use agent-browser via execute instead.
β
βββ Using agent-browser (parallel-safe browser automation)?
β βββ Run via execute (shell) β each call gets its own subprocess:
β execute("agent-browser open example.com && agent-browser snapshot -i -c")
β β Supports sessions for isolated browser instances
β β Safe for parallel subagent execution
β β Lightweight accessibility tree with ref-based interaction
β
βββ Processing output from another MCP tool (Context7, GitHub API, etc.)?
β βββ Output already in context from a previous tool call?
β β βββ Use it directly. Do NOT re-index with ctx_index(content: ...).
β βββ Need to search the output multiple times?
β β βββ Save to file via ctx_execute, then ctx_index(path) β ctx_search
β βββ One-shot extraction?
β βββ Save to file via ctx_execute, then ctx_execute_file(path)
β
βββ Reading a file to analyze/summarize (not edit)?
βββ Use ctx_execute_file (file loads into FILE_CONTENT, not context)
When to Use Each Tool
| Situation | Tool | Example |
|---|---|---|
| Hit an API endpoint | ctx_execute |
fetch('http://localhost:3000/api/orders') |
| Run CLI that returns data | ctx_execute |
gh pr list, aws s3 ls, kubectl get pods |
| Run tests | ctx_execute |
npm test, pytest, go test ./... |
| Git operations | ctx_execute |
git log --oneline -50, git diff HEAD~5 |
| Docker/K8s inspection | ctx_execute |
docker stats --no-stream, kubectl describe pod |
| Read a log file | ctx_execute_file |
Parse access.log, error.log, build output |
| Read a data file | ctx_execute_file |
Analyze CSV, JSON, YAML, XML |
| Read source code to analyze | ctx_execute_file |
Count functions, find patterns, extract metrics |
| Fetch web docs | ctx_fetch_and_index |
Index React/Next.js/Zod docs, then search |
| Playwright snapshot | browser_snapshot(filename) β ctx_index(path) β ctx_search |
Save to file, index server-side, query |
| Playwright snapshot (one-shot) | browser_snapshot(filename) β ctx_execute_file(path) |
Save to file, extract in sandbox |
| Playwright console/network | browser_*(filename) β ctx_execute_file(path) |
Save to file, analyze in sandbox |
| MCP output (already in context) | Use directly | Don't re-index β it's already loaded |
| MCP output (need multi-query) | ctx_execute to save β ctx_index(path) β ctx_search |
Save to file first, index server-side |
Pertanyaan umum
Perintah mana yang tetap bisa dijalankan langsung?
Tindakan kecil dan aman seperti membuat folder, memindahkan file, penulisan git, navigasi, dan echo tetap bisa dijalankan di shell.
Apa yang dilakukan skill dengan keluaran besar?
Skill memproses keluaran di sandbox dan hanya mengembalikan hasil yang relevan ke percakapan.
Apakah berlaku untuk setiap perintah?
Berlaku untuk sebagian besar perintah. Aturannya adalah memakai context-mode setiap kali agent tidak yakin seberapa besar keluarannya nanti.
Detail
Deskripsi asli dari pembuat
Use context-mode tools (ctx_execute, ctx_execute_file) instead of Bash/cat when processing large outputs. Triggers: "analyze logs", "summarize output", "process data", "parse JSON", "filter results", "extract errors", "check build output", "analyze dependencies", "process API response", "large file analysis", "page snapshot", "browser snapshot", "DOM structure", "inspect page", "accessibility tree", "Playwright snapshot", "run tests", "test output", "coverage report", "git log", "recent commits", "diff between branches", "list containers", "pod status", "disk usage", "fetch docs", "API referen
repo: mksglu/context-mode
Popularitas
- Bintang GitHub
- 33k
- Peringkat
- #8510
- Lisensi
- β
- Diperbarui
- 2/11/2026
Komentar
- β¦
Skill lain dari repositori ini
context-mode
33kMengajari agent Anda menggunakan alat context-mode untuk membaca, mencari, dan menjalankan tugas yang berat data, sehingga keluaran besar tetap di luar percakapan utama.
context-mode
33kMengajari agent Anda menjalankan pekerjaan berat data di sandbox dan hanya mencetak jawabannya, sehingga file mentah dan halaman web tidak membanjiri percakapan.
ctx-doctor
33kMenjalankan diagnosis context-mode yang memeriksa runtime, hook, penyimpanan pencarian, penyiapan plugin, dan versi, lalu menampilkan laporan lulus atau gagal yang jelas.
ctx-index
33kMembiarkan agent Anda mengindeks proyek atau folder lokal ke dalam penyimpanan yang bisa dicari, sehingga pertanyaan berikutnya menemukan cuplikan yang tepat tanpa membaca ulang setiap file.
Skill serupa
add-model-provider
394kMemungkinkan agent Anda menghubungkan penyedia model AI baru ke OpenClaw dengan perintah pengaturan yang aman, menjaga kunci API tetap di luar teks biasa, dan menjalankan uji langsung.
acp-router
394kMembantu agent Anda mengirim tugas ke asisten pemrograman seperti Claude Code atau Cursor lewat OpenClaw, sehingga pekerjaan dijalankan di alat tersebut.
browser-automation
394kMengajari agent Anda mengendalikan halaman web langkah demi langkah, termasuk login, tab, dan pemulihan saat halaman berhenti merespons.