Context Optimization

Analyze Claude Code session context usage from JSONL chat history.

29|2|Updated Jan 11, 2026
One-click install
npx skills add https://github.com/jbdamask/john-claude-skills --skill context-optimization-jbdamask
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Context Optimization
Source: https://github.com/jbdamask/john-claude-skills/tree/main/plugins/context-analyzer/skills/context-optimization
Command: npx skills add https://github.com/jbdamask/john-claude-skills --skill context-optimization-jbdamask

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This skill helps users understand and manage the context window in Claude Code, preventing sessions from becoming slow or unresponsive due to excessive data.

Core Features & Use Cases

  • Context Consumption Analysis: Identifies what elements (messages, images, file reads) consume the most context.
  • Optimization Strategies: Provides actionable advice on reducing context usage, such as compressing screenshots and optimizing file reads.
  • Use Case: If your Claude Code session is running slowly and you suspect it's due to too much information, use this skill to diagnose the problem and get recommendations for cleaning up the context.

Quick Start

Run /context-analyzer:analyze-context to get a breakdown of your current context usage.

Frequently Asked Questions about Context Optimization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why is my Claude Code session running slowly or becoming unresponsive?

Claude Code session performance degrades when the context window fills with excessive data like pasted images, large file reads, and bash output accumulation. This skill analyzes your JSONL chat history to identify these specific consumption patterns and provides actionable optimization strategies.

How do I analyze context window usage in Claude Code to diagnose performance issues?

To analyze context window usage, you can parse your JSONL chat history files to get a detailed breakdown of context consumption. Run the /context-analyzer:analyze-context command to identify what elements are consuming the most session resources.

What is the best way to optimize context window consumption during a Claude Code session?

The best way to optimize context window consumption is to identify heavy elements and apply actionable strategies like compressing pasted screenshots and optimizing file reads. This skill evaluates your session patterns to recommend specific reductions for message overhead and bash output accumulation.

Can I use this context optimization skill without any external dependencies?

Yes, you can use this context optimization skill without external dependencies. It operates by parsing your local JSONL chat history files to provide a detailed breakdown of context usage and actionable recommendations.

Does this tool diagnose context consumption from pasted images and bash output accumulation?

Yes, this tool diagnoses context consumption from pasted images, bash output accumulation, file reads, and message overhead. It parses your chat history to pinpoint exactly which elements are consuming the most context window space.

When should I run a context consumption analysis on my chat history?

You should run a context consumption analysis when your Claude Code session is running slowly and you suspect excessive data is causing the context window to fill. It helps diagnose the problem by identifying specific consumption patterns in your JSONL chat history.