01-global-optimization/skills/context/SKILL.md
Manage Serena memories and session context — load, save, refresh, inspect, and clear project knowledge
npx skillsauth add escapeboy/ai-prompts contextInstall 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.
Manages the Serena memory system that stores architectural knowledge, conventions, and project context. Loading memories at the start of a session saves 60-70% of tokens by eliminating repeated file reads.
/context [action] [name]
/context load # Load all relevant memories for current project
/context list # Show all available memories
/context save architecture # Create or update the architecture memory
/context refresh codebase-conventions # Regenerate a stale memory
/context inspect # Show what's currently loaded + cache status
/context clear # Unload all memories from context
load — Load all relevant memoriesLoads memories relevant to the current project. Run this at the start of every session before any code work.
Process:
mcp__serena__list_memories()architecture.mdcodebase-conventions.mdmodule-structure.md — if working on a specific moduletesting-strategy.md — if tests are involveddocker-workflow.md — if Docker config detecteddeployment-config.md — if deployment work plannedToken savings: 60-70% vs reading individual files each time
/context load
list — Show available memoriesLists all Serena memories for the current project with metadata.
/context list
Output format:
Project memories (.serena/memories/):
Core (always loaded):
✅ architecture.md — last updated 2026-03-10
✅ codebase-conventions.md — last updated 2026-03-08
Conditional:
📋 module-structure.md — last updated 2026-02-20
📋 testing-strategy.md — last updated 2026-01-15
📋 docker-workflow.md — last updated 2026-01-10
Project-specific:
📋 api-design.md — last updated 2026-03-01
📋 database-schema.md — last updated 2026-02-28
Status: 2/8 memories loaded | Cache: WARM
save [name] — Create or update a memoryCreates a new Serena memory capturing current knowledge about the project.
Usage:
/context save [memory-name]
Parameters:
[memory-name] — Name for the memory file (without .md), e.g. architecture, api-design, deployment-configProcess:
.serena/memories/[name].mdExamples:
/context save architecture # Document project structure
/context save api-design # Document API conventions
/context save deployment-config # Document deploy workflow
/context save testing-strategy # Document test patterns
Recommended memory structure (Claude writes this automatically):
# [Topic]
## Overview
[High-level summary]
## Key Patterns
[Most important conventions or structures]
## File Locations
[Where to find relevant code]
## Constraints
[Rules, limitations, things to avoid]
## Last Updated
[Date]
refresh [name] — Regenerate a stale memoryRe-reads the codebase and overwrites an existing memory with current state. Use when the project has changed significantly.
/context refresh architecture
/context refresh codebase-conventions
Process:
When to use:
inspect — Show loaded context and cache statusShows a summary of what's currently in context and the prompt cache status.
/context inspect
Output format:
## Context Inspection
### Loaded Memories
- architecture.md (2.1K tokens) — CACHED ✅
- codebase-conventions.md (1.8K tokens) — CACHED ✅
- testing-strategy.md (1.2K tokens) — WARM 🟡
Total memory tokens: 5.1K
Cache hit rate: 87%
Estimated savings vs no-cache: 4.6K tokens (90%)
### Project Context
Project: my-rails-app
Framework: Rails 8.0
Serena: Connected ✅
Constitution: .claude/settings/constitution.json ✅
### Recommendation
Context is optimal. Run /optimize to start work.
clear — Unload all memories from contextClears loaded memories from the current context. Useful when switching between projects or when context is stale.
/context clear
This does not delete the memory files — it only unloads them from the current conversation. Run /context load to reload.
create [name] — Interactive memory creationWalks through creating a memory interactively, asking what to document.
/context create
/context create docker-workflow
Claude will ask:
When creating new memories, Claude uses these templates:
architecture.mdDocuments overall project structure, layers, key components, and data flow.
codebase-conventions.mdDocuments naming conventions, file structure rules, preferred patterns, and anti-patterns.
module-structure.mdDocuments a specific module: its purpose, public API, internal structure, and dependencies.
testing-strategy.mdDocuments test frameworks, fixtures, factory patterns, and what/where to test.
api-design.mdDocuments API endpoint conventions, authentication patterns, response formats, and versioning.
deployment-config.mdDocuments deployment environments, commands, CI/CD pipeline, and rollback procedures.
| Without memories | With memories | |-----------------|---------------| | Read files per session | Load cached memories | | ~15-25K tokens/session for context | ~1.5-2.5K tokens/session | | 100% cost each time | 10% cost after first load (cached) | | Savings: 60-70% per session | |
/context list
# → No memories found for this project
Fix: Initialize with /init-project memories or create manually:
/context save architecture
/context save codebase-conventions
Context management requires the Serena MCP server. Check MCP availability with /help. Without Serena, use /optimize which has fallback strategies.
/context refresh [memory-name]
Memories older than 2 weeks should be refreshed after significant codebase changes.
/optimize — Uses loaded context for token-efficient work/init-project — Creates initial memory set for a new project/cache-inspector — Monitor cache performancetools
Add a Laravel MCP server to any project — full domain coverage with dual transport (HTTP + stdio)
tools
Add an AI assistant chat panel to any Laravel project — with tool calling, streaming, and MCP support
development
Search the web for latest Claude API changes, compare findings to existing documentation, and apply targeted updates to keep prompts and configs current. Use when docs are outdated, after a Claude API update, to refresh system prompts, or to validate documentation accuracy.
development
Reduce token usage by selecting a planning strategy, loading Serena memories, enforcing symbol-first exploration, and reporting savings. Use when starting a non-trivial task, asking to reduce token costs, requesting efficient execution, or wanting optimized Claude Code workflows.