Data & AI
delete-claude-code-history - Claude MCP Skill
Clear accumulated chat history from Claude Code's .claude.json configuration file to reduce file size and improve performance
SEO Guide: Enhance your AI agent with the delete-claude-code-history tool. This Model Context Protocol (MCP) server allows Claude Desktop and other LLMs to clear accumulated chat history from claude code's .claude.json configuration file to reduce file siz... Download and configure this skill to unlock new capabilities for your AI workflow.
Documentation
SKILL.md# Delete Claude Code History
When this command is used, execute the bash script to clear all project history from Claude Code's configuration file while preserving all other settings.
---
<instruction>
Clear the accumulated chat history from Claude Code's .claude.json configuration file to reduce file size and improve performance. This removes only the "history" arrays from each project while preserving all other configuration and settings.
</instruction>
<context>
Claude Code stores chat history for every project in ~/.claude.json. Over time, this file grows significantly large as it accumulates history for all projects. The file structure contains a "projects" key at root level with project paths as keys, each containing an object with a "history" array that needs to be cleared periodically.
</context>
<script>
```bash
#!/bin/bash
# Clear Claude Code history from .claude.json
CLAUDE_CONFIG="$HOME/.claude.json"
# Check if file exists
if [ ! -f "$CLAUDE_CONFIG" ]; then
echo "ā Claude Code config not found at: $CLAUDE_CONFIG"
exit 1
fi
# Create backup
BACKUP_FILE="${CLAUDE_CONFIG}.backup.$(date +%Y%m%d_%H%M%S)"
cp "$CLAUDE_CONFIG" "$BACKUP_FILE"
echo "ā
Created backup: $BACKUP_FILE"
# Clear history for all projects using jq
if command -v jq &> /dev/null; then
# Use jq to clear history arrays
jq '.projects |= with_entries(.value.history = [])' "$CLAUDE_CONFIG" > "${CLAUDE_CONFIG}.tmp" && \
mv "${CLAUDE_CONFIG}.tmp" "$CLAUDE_CONFIG"
# Count cleared projects
PROJECT_COUNT=$(jq '.projects | keys | length' "$CLAUDE_CONFIG")
# Calculate size reduction
ORIGINAL_SIZE=$(stat -f%z "$BACKUP_FILE" 2>/dev/null || stat -c%s "$BACKUP_FILE" 2>/dev/null)
NEW_SIZE=$(stat -f%z "$CLAUDE_CONFIG" 2>/dev/null || stat -c%s "$CLAUDE_CONFIG" 2>/dev/null)
SIZE_REDUCTION=$((ORIGINAL_SIZE - NEW_SIZE))
SIZE_REDUCTION_MB=$(echo "scale=2; $SIZE_REDUCTION / 1048576" | bc)
echo "ā
Cleared history for $PROJECT_COUNT projects"
echo "š File size reduced by ${SIZE_REDUCTION_MB}MB ($(echo "scale=1; $SIZE_REDUCTION * 100 / $ORIGINAL_SIZE" | bc)%)"
echo "š Original: $(echo "scale=2; $ORIGINAL_SIZE / 1048576" | bc)MB ā New: $(echo "scale=2; $NEW_SIZE / 1048576" | bc)MB"
else
echo "ā jq is required but not installed. Install with: brew install jq (macOS) or apt-get install jq (Linux)"
exit 1
fi
echo "⨠Claude Code history cleared successfully!"
```
</script>
<constraints>
- Must preserve all non-history configuration data
- Must create a timestamped backup before modification
- Must use atomic file operations to prevent corruption
- Must handle both macOS and Linux file systems
- Requires jq for safe JSON manipulation
</constraints>
<output_format>
Execute the bash script and report:
1. Number of projects processed
2. File size reduction achieved
3. Backup file location
4. Confirmation of successful completion
</output_format>
<usage>
Run this command when:
- Claude Code feels sluggish due to large config file
- Starting fresh conversations while preserving settings
- Regular maintenance (monthly recommended)
- Before sharing or debugging configuration issues
</usage>
<example>
User: /plx:clear-claude-code-history
Assistant: I'll clear the accumulated chat history from your Claude Code configuration.
[Executes script]
ā
Created backup: /Users/username/.claude.json.backup.20240109_143022
ā
Cleared history for 48 projects
š File size reduced by 15.3MB (87%)
š Original: 17.5MB ā New: 2.2MB
⨠Claude Code history cleared successfully!
Your Claude Code history has been cleared while preserving all settings. A backup was saved in case you need to restore any conversation history.
</example>Signals
Information
- Repository
- appboypov/pew-pew-plaza-packs
- Author
- appboypov
- Last Sync
- 3/12/2026
- Repo Updated
- 3/4/2026
- Created
- 1/16/2026
Reviews (0)
No reviews yet. Be the first to review this skill!
Related Skills
browser-use
Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, or extract information from web pages.
remote-browser
Controls a cloud browser from a sandboxed remote machine. Use when the agent is running in a sandbox (no GUI) and needs to navigate websites, interact with web pages, fill forms, take screenshots, or expose local dev servers via tunnels.
agent-builder
Design and build AI agents for any domain. Use when users: (1) ask to "create an agent", "build an assistant", or "design an AI system" (2) want to understand agent architecture, agentic patterns, or autonomous AI (3) need help with capabilities, subagents, planning, or skill mechanisms (4) ask about Claude Code, Cursor, or similar agent internals (5) want to build agents for business, research, creative, or operational tasks Keywords: agent, assistant, autonomous, workflow, tool use, multi-step, orchestration
troubleshooting
Uses Chrome DevTools MCP and documentation to troubleshoot connection and target issues. Trigger this skill when list_pages, new_page, or navigate_page fail, or when the server initialization fails.
Related Guides
Mastering the Oracle CLI: A Complete Guide to the Claude Skill for Database Professionals
Learn how to use the oracle Claude skill. Complete guide with installation instructions and examples.
Python Django Best Practices: A Comprehensive Guide to the Claude Skill
Learn how to use the python django best practices Claude skill. Complete guide with installation instructions and examples.
Building Full-Stack Applications with Claude: The Node.js MongoDB JWT Express React Skill Guide
Learn how to use the nodejs mongodb jwt express react Claude skill. Complete guide with installation instructions and examples.