Skip to content
Skillpedia
Agents33k Β· #8510

context-mode

What it does

This skill guides an AI agent to process large command output and files through context-mode tools instead of reading them in full. It is for developers who work with long logs, big API responses and build output.

When to use it

  • βœ“When an agent is asked to analyze logs, summarize command output or parse a large JSON response.
  • βœ“When a build or dependency check may produce a long output that should be filtered.
  • βœ“When a page snapshot or browser structure is too large to read directly.

Skill link

https://github.com/mksglu/context-mode/blob/main/skills/context-mode/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/mksglu/context-mode/blob/main/skills/context-mode/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œAnalyze these build logs and tell me only the errors, without showing me the full output.”

5 new skills a week. 1 minute to read.

How it works

The skill sets a default rule: use context-mode tools for anything that reads, queries, fetches, lists or builds, and keep plain shell commands for small, safe actions. The agent then shows only the parts that matter.

Technical content (original SKILL.md)

Original text by the author, straight from 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
FAQ

Which commands can still run directly?

Small, safe actions such as making folders, moving files, git writes, navigation and echo can still run in the shell.

What does it do with big output?

It processes the output in the sandbox and returns only the relevant results to the conversation.

Does it apply to every command?

It applies to most commands, and the rule is to use context-mode whenever the agent is unsure how large the output will be.

Details

Original description by the author

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

Popularity

GitHub stars
33k
Ranking position
#8510
License
β€”
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills