Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
ahmed3elshaer avatar

Mobile Compaction

  • 23 installs
  • 60 repo stars
  • Updated June 14, 2026
  • ahmed3elshaer/everything-claude-code-mobile

mobile-compaction is a Claude Code skill that provides context compaction strategies for large Android codebases to optimize token usage while preserving critical context.

About

mobile-compaction is a Claude Code skill that provides context compaction strategies for large Android codebases. It defines module, layer, build-variant, test, and pattern-based compaction plus retention levels to reduce token usage while preserving active task context, memory, and high-confidence instincts. A developer uses it when a Claude Code session grows too large during mobile work.

  • Context compaction strategies for large Android codebases
  • Module, layer, variant, test, and pattern-based compaction
  • Preserves critical context, memory, and high-confidence instincts

Mobile Compaction by the numbers

  • 23 all-time installs (skills.sh)
  • Ranked #10,004 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
At a glance

mobile-compaction capabilities & compatibility

Capabilities
context compaction · token optimization · session management
Use cases
token optimization
From the docs

What mobile-compaction says it does

Strategic context compaction for large Android projects to optimize token usage while preserving critical information.
SKILL.md
Context compaction strategies for large Android codebases. Optimize token usage while preserving critical context.
SKILL.md
npx skills add https://github.com/ahmed3elshaer/everything-claude-code-mobile --skill mobile-compaction

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs23
repo stars60
Last updatedJune 14, 2026
Repositoryahmed3elshaer/everything-claude-code-mobile

What it does

Compact a Claude Code context on a large Android codebase to cut token usage while preserving critical task context.

Who is it for?

Developers whose Claude Code sessions on large Android projects exceed the token budget.

Skip if: Mid-debugging or when unresolved errors exist - the skill lists these as anti-patterns.

When should I use this skill?

Token usage exceeds ~100,000, switching features, or the session becomes unfocused.

By the numbers

  • 5 compaction strategies (module, layer, variant, test, pattern)
  • 4 compaction levels (Lite, Medium, Standard, Minimal)

Files

SKILL.mdMarkdownGitHub ↗

Mobile Compaction Skill

Strategic context compaction for large Android projects to optimize token usage while preserving critical information.

When to Compact

Compact context when:

  • Token usage exceeds 100,000
  • Working on large refactors spanning many files
  • Switching between unrelated features
  • Session becomes unfocused
  • Context contains resolved discussions

Compaction Strategies

1. Module-Level Compaction

Focus on a single Android module:

/compact --module=feature:auth

What happens:

  • Retain: All files in feature:auth module
  • Summarize: Other modules to high-level description
  • Drop: Resolved discussions about other modules

Use when: Deep work on a specific feature

2. Layer-Based Compaction

Focus on architecture layer:

/compact --layer=ui
/compact --layer=data
/compact --layer=domain

What happens:

LayerRetainSummarize
UIComposables, ViewModels, navigationRepository details, data models
DataRepositories, data sources, modelsCompose code, UI state
DomainUse cases, domain modelsImplementation details

Use when: Working on cross-cutting concerns in a layer

3. Build Variant Focus

Narrow to specific build variant:

/compact --variant=debug

What happens:

  • Retain: Debug-specific configurations, test code
  • Summarize: Release configurations, ProGuard rules

Use when: Debugging or test development

4. Test Isolation

Compact around failing tests:

/compact --test=AuthViewModelTest
/compact --test-failing

What happens:

  • Retain: Test file, related source files
  • Summarize: Unrelated test discussions
  • Drop: Resolved test fix discussions

Use when: Fixing specific test failures

5. Pattern-Based Compaction

Compact based on architectural patterns:

/compact --pattern=compose
/compact --pattern=mvi
/compact --pattern=koin

What happens:

  • Retain: Files matching the pattern
  • Summarize: Non-matching files to pattern names only

Use when: Pattern-specific work (e.g., Compose optimization)

Compaction Levels

LevelRetentionToken SavingsUse Case
LiteCurrent task only70-80%Deep focus work
MediumCurrent + related50-60%Feature development
StandardProject summary30-40%Default compaction
MinimalEssential only80-90%Context at limit

What Gets Preserved

Always Preserve (Critical)

  • Active task context (what we're doing now)
  • Recent code changes (last 5-10 files)
  • Current errors/failures
  • Mobile memory context
  • High-confidence instincts (>0.7)
  • Unresolved questions

Usually Preserve (Important)

  • Architecture decisions
  • Recent discussions (last 50 messages)
  • Related file contents
  • Test states

Summarize (Compressible)

  • Completed features
  • Resolved bugs
  • Working code explanations
  • Background discussions

Drop (Disposable)

  • Successful build outputs
  • Trivial operations
  • Duplicated information
  • Off-topic discussions

Compaction Commands

Basic Compaction

/compact                      # Auto-select strategy
/compact --level=medium       # Specify level
/compact --focus=compose      # Focus on specific area

Smart Compaction

/compact --smart              # AI chooses strategy
/compact --adaptive           # Adjusts based on usage

Manual Compaction

/compact --keep=file1.kt,file2.kt   # Keep specific files
/compact --drop=discussion-1        # Drop specific discussion
/compact --summarize=feature-x      # Summarize specific topic

Compaction Workflow

Before Compaction

1. /memory-save all              # Save current state to memory
2. /mobile-checkpoint save pre-compact  # Optional checkpoint
3. /compact --strategy=module --focus=feature:auth

After Compaction

1. /memory-summary              # Verify memory preserved
2. /instinct-status             # Verify instincts preserved
3. Continue work...

Integration

With Checkpoints

# Pre-compact hook automatically saves checkpoint
# Restore to recover if compaction removes needed context

With Memory

# Memory survives compaction
# Query memory to recover details:
/memory-query "What was the auth flow architecture?"

With Instincts

# Instincts survive compaction
# High-confidence instincts always retained
# Low-confidence may be summarized

Anti-Patterns

Don't Compact When:

  • In the middle of debugging
  • Unresolved errors exist
  • Active discussion ongoing
  • Task almost complete

Do Compact When:

  • Starting new task
  • Switching context
  • Token limit approaching
  • Task completed, keeping summary

Recovery

If compaction removed needed context:

1. /memory-query <topic>        # Query memory
2. /mobile-checkpoint list      # Check for checkpoints
3. /mobile-checkpoint restore <name>  # Restore if needed
4. Git history for file diffs

Examples

Example 1: Feature Development

Context: Working on auth feature, context contains old home feature discussions
Action: /compact --module=feature:auth
Result: Retains auth files, summarizes home feature

Example 2: Test Fixing

Context: Many files, focus on fixing LoginTest
Action: /compact --test=LoginTest
Result: Retains LoginTest, related auth files, summarizes rest

Example 3: Compose Optimization

Context: Large project, optimizing Compose performance
Action: /compact --pattern=compose --level=medium
Result: Retains Compose files, summaries of data/network layers

---

Remember: Compaction is reversible via checkpoints and memory. When in doubt, checkpoint first.

Related skills

FAQ

When should context be compacted?

When token usage exceeds 100,000, during large multi-file refactors, when switching features, or when the session becomes unfocused.

What is always preserved?

Active task context, recent code changes, current errors, mobile memory context, high-confidence instincts (>0.7), and unresolved questions.

AI & Agent Buildingagentsautomation

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.