skills/mobile-compaction/SKILL.md
Context compaction strategies for large Android codebases. Optimize token usage while preserving critical context.
npx skillsauth add ahmed3elshaer/everything-claude-code-mobile mobile-compactionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Strategic context compaction for large Android projects to optimize token usage while preserving critical information.
Compact context when:
Focus on a single Android module:
/compact --module=feature:auth
What happens:
Use when: Deep work on a specific feature
Focus on architecture layer:
/compact --layer=ui
/compact --layer=data
/compact --layer=domain
What happens:
| Layer | Retain | Summarize | |-------|--------|-----------| | UI | Composables, ViewModels, navigation | Repository details, data models | | Data | Repositories, data sources, models | Compose code, UI state | | Domain | Use cases, domain models | Implementation details |
Use when: Working on cross-cutting concerns in a layer
Narrow to specific build variant:
/compact --variant=debug
What happens:
Use when: Debugging or test development
Compact around failing tests:
/compact --test=AuthViewModelTest
/compact --test-failing
What happens:
Use when: Fixing specific test failures
Compact based on architectural patterns:
/compact --pattern=compose
/compact --pattern=mvi
/compact --pattern=koin
What happens:
Use when: Pattern-specific work (e.g., Compose optimization)
| Level | Retention | Token Savings | Use Case | |-------|-----------|---------------|----------| | Lite | Current task only | 70-80% | Deep focus work | | Medium | Current + related | 50-60% | Feature development | | Standard | Project summary | 30-40% | Default compaction | | Minimal | Essential only | 80-90% | Context at limit |
/compact # Auto-select strategy
/compact --level=medium # Specify level
/compact --focus=compose # Focus on specific area
/compact --smart # AI chooses strategy
/compact --adaptive # Adjusts based on usage
/compact --keep=file1.kt,file2.kt # Keep specific files
/compact --drop=discussion-1 # Drop specific discussion
/compact --summarize=feature-x # Summarize specific topic
1. /memory-save all # Save current state to memory
2. /mobile-checkpoint save pre-compact # Optional checkpoint
3. /compact --strategy=module --focus=feature:auth
1. /memory-summary # Verify memory preserved
2. /instinct-status # Verify instincts preserved
3. Continue work...
# Pre-compact hook automatically saves checkpoint
# Restore to recover if compaction removes needed context
# Memory survives compaction
# Query memory to recover details:
/memory-query "What was the auth flow architecture?"
# Instincts survive compaction
# High-confidence instincts always retained
# Low-confidence may be summarized
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
Context: Working on auth feature, context contains old home feature discussions
Action: /compact --module=feature:auth
Result: Retains auth files, summarizes home feature
Context: Many files, focus on fixing LoginTest
Action: /compact --test=LoginTest
Result: Retains LoginTest, related auth files, summarizes rest
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.
data-ai
SQLDelight patterns for Kotlin Multiplatform - .sq file definitions, platform drivers, type adapters, migrations, and shared database access.
data-ai
Room database patterns for Android - entity definitions, DAO interfaces, Database class, migrations, TypeConverters, and Flow integration.
tools
Push notification patterns - FCM setup for Android, APNs for iOS, notification channels, payload handling, foreground/background behavior, and rich notifications.
content-media
Pagination patterns for mobile - Paging 3 for Android (PagingSource, RemoteMediator, LazyPagingItems), cursor-based and offset-based strategies.