Skip to content
Skill

Magic compact

Claude Code slash command shim for compacting a session with the Magic Compact plugin

Magic compact is an open-source agent skill for ai models and llm tooling. It is available on Claude Code.

Scripts
None
Platforms
Claude Code
GitHub stars
180
Last commit
License
BSD-3-Clause
Listing updated

Similar skills

About Magic compact

This skill is a thin shim for the /magic-compact [N] slash command in Claude Code. The actual compaction is handled by a hook from the claude-magic-compact plugin, which intercepts the command before the agent acts on it.

The SKILL.md itself holds no compaction logic. It is only reached when the hook fails to intercept the command. In that case it tells the agent to alert the user and suggest checking that the claude-magic-compact plugin is installed and enabled.

The command takes an optional numeric argument, shown as [N]. Model invocation is disabled, so the skill runs only when the user types the command, not when the agent decides a task matches.

When your agent uses it

Compact this Claude Code session.

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 1 file (345 bytes) on GitHub on 17 November 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

Copy the skill folder to ~/.claude/skills/magic-compact to use it in all your projects:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/aerovato/magic-compact.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/magic-compact &&
cp -R "$tmp/packages/claude-code-plugin/skills/magic-compact" ~/.claude/skills/magic-compact &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/magic-compact inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/magic-compact to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/aerovato/magic-compact.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/magic-compact &&
cp -R "$tmp/packages/claude-code-plugin/skills/magic-compact" ~/.agents/skills/magic-compact &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/magic-compact inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/magic-compact to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/aerovato/magic-compact.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/magic-compact &&
cp -R "$tmp/packages/claude-code-plugin/skills/magic-compact" ~/.cursor/skills/magic-compact &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/magic-compact inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/aerovato/magic-compact.git --path packages/claude-code-plugin/skills/magic-compact

Or copy the folder to ~/.gemini/skills/magic-compact yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/magic-compact:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/aerovato/magic-compact.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/magic-compact &&
cp -R "$tmp/packages/claude-code-plugin/skills/magic-compact" ~/.copilot/skills/magic-compact &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/magic-compact inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/aerovato/magic-compact.git

Then copy magic-compact/packages/claude-code-plugin/skills/magic-compact into your agent's skills folder as magic-compact. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Slash command entry point
Registers `/magic-compact [N]` so the command is available in Claude Code.
Optional argument
Accepts an optional `[N]` argument that is passed along for the plugin hook to handle.
Hook failure fallback
If the hook does not intercept the command, the agent warns the user instead of silently doing nothing.
Manual invocation only
Model invocation is disabled, so the agent never triggers it on its own.
Plugin install guidance
Points users to check that the `claude-magic-compact` plugin is installed and enabled.

Good for

  • Compact a long Claude Code session with a single slash command
  • Run `/magic-compact` with a number argument to control the compaction
  • Diagnose why the Magic Compact hook did not fire
  • Check that the claude-magic-compact plugin is installed and enabled

Magic compact FAQ

Does Magic compact compact the session by itself?

No. It is a shim. The compaction is done by a hook from the claude-magic-compact plugin, which intercepts the command.

What happens if I see its instruction text?

It means the hook failed to intercept the command. The agent will tell you and suggest checking that the claude-magic-compact plugin is installed and enabled.

Can the agent invoke Magic compact automatically?

No. Model invocation is disabled, so it only runs when you type the `/magic-compact` command.

What does the [N] argument do?

The skill declares an optional `[N]` argument hint. Its exact meaning is handled by the plugin hook and is not described in the skill.

How do I install Magic compact in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/magic-compact to use it in all your projects, or to .claude/skills/magic-compact in one project.

Does Magic compact run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Magic compact?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

What are the best alternatives to Magic compact?

The closest alternatives to Magic compact are Compact now, Conventions claude, Compress, Writing hooks and Skill update.

Where this comes from

  • Description: from the skill's own SKILL.md.