# save-session

> A Claude Code skill that runs an end-of-session routine — reviewing what was learned and persisting it to the right .claude file (CLAUDE.md, a skill, an agent, or a hook) instead of losing it when the context window closes.

- **Difficulty:** Intermediate
- **Tags:** Claude Code, CLAUDE.md, Skills, Configuration
- **Published:** Jul 3, 2026
- **Source:** https://prostdev.com/skill/save-session

---
> [!IMPORTANT]
> **Pairs with [`claude-folder-standards`](/skill/claude-folder-standards).** `save-session` decides
> *what* to keep; `claude-folder-standards` decides *where* it goes and *how much*. Install both — the
> save routine restates that skill's rules (line caps, the decision table, token awareness) so the
> "commit what we learned" step can't quietly undo your config hygiene.

## What it does

`save-session` is a Claude Code [skill](https://docs.claude.com/en/docs/claude-code/skills) that runs
at the *end* of a working session. It asks the agent to review everything that happened, decide what
is genuinely worth keeping, and persist it to the correct `.claude` file — `CLAUDE.md` for
universal rules, a skill for specialized workflows, an agent for a reusable assistant, a hook for
must-always-run automation.

The point is **beating context amnesia**. A session often surfaces a non-obvious command, a gotcha,
or a convention — knowledge that evaporates when the window closes unless something writes it down.
This skill makes that write-down a deliberate, structured step, so the *next* session starts smarter
instead of relearning the same lesson.

## When to use it

Invoke it when you're wrapping up:

- After a session where you discovered a convention, a gotcha, or a non-obvious workflow.
- Before ending a long working session, as a "commit what we learned" ritual.
- Whenever you catch yourself thinking "I'll want to remember this next time."

It pairs naturally with a standards skill: `save-session` decides *what* to keep, and
[`claude-folder-standards`](/skill/claude-folder-standards) decides *where* and *how much* — so the
config grows without bloating.

## How it works

The skill is just a Markdown file — a short frontmatter block (its `name` and a `description` that
tells the agent *when* to invoke it) followed by plain-English instructions. There's no code to run;
Claude reviews the session and writes to the appropriate files using its normal tools.

A few ideas in here that generalize to any "persist knowledge" skill:

- **Route by longevity, not by topic.** A decision table sends universal rules to `CLAUDE.md`,
  specialized knowledge to a skill, and deterministic automation to a hook — so each learning lands
  where it'll actually be useful.
- **Make "nothing useful" a valid outcome.** The skill explicitly allows the agent to do nothing and
  say so — which stops it from inventing filler just to feel productive.
- **Carry the cost constraints forward.** It restates the line cap and the token-per-turn framing so
  the save step can't quietly undo the config hygiene.

## The skill definition

Here's the actual `SKILL.md`, verbatim — copy it, adapt the file paths and the line cap to your own
project, and drop it in your project's skills directory.

````markdown title="SKILL.md"
---
name: save-session
description: End-of-session routine. Saves learnings to .claude files following folder standards.
---

# End-of-Session Save

Review everything from this session and persist what's useful for future sessions.

## What to Save

- Conventions or patterns discovered during this session
- Commands, workflows, or setup steps that were non-obvious
- Gotchas or mistakes encountered (and how to avoid them)
- Reusable domain knowledge or specialized workflows

## Where to Save (follow these rules strictly)

| Content type | Destination |
|---|---|
| Universal, prevents-mistakes-every-session rules | CLAUDE.md (append or update) |
| Specialized workflow or domain knowledge | A new or existing skill in `.claude/skills/` |
| Reusable isolated assistant with scoped tools | `.claude/agents/` |
| Deterministic automation (must always run) | `.claude/hooks/` + settings.json |
| Nothing useful learned | Do nothing. Say so. |

## Constraints (from claude-folder-standards)

- CLAUDE.md must stay under 200 lines total. Count before and after.
- Only add what Claude would get WRONG without. No obvious/inferrable content.
- No duplicating README, package.json, tsconfig, or other existing files.
- No self-evident advice. No "just in case" entries.
- Prefer skills over bloating CLAUDE.md. If it's specialized, make it a skill.
- Skills: 50-80 lines ideal, 120 max. Kebab-case folder name. Include frontmatter.
- Use terse imperative bullets, not prose paragraphs.
- Every line costs ~2-4 tokens per turn — treat CLAUDE.md like expensive real estate.

## Do NOT

- Write to MEMORY.md
- Add content that's already captured elsewhere in .claude files
- Add content with no clear future value
- Exceed the 200-line CLAUDE.md cap
````