Update CLAUDE.md After Every Session From Your Corrections

A SKILL.md that reviews the session you just finished, finds where you had to correct the agent, and proposes small diffs to AGENTS.md, CLAUDE.md, a skill or a hook so it does not happen again.

Skill prompt for Claude Code and Codex

Prompt

Installs to .agents/skills/update-claude-md-after-every-session-from-your-corrections/

mkdir -p .agents/skills/update-claude-md-after-every-session-from-your-corrections && curl -sL "https://prompts-gpt.com/prompts/update-claude-md-after-every-session-from-your-corrections/raw" -o .agents/skills/update-claude-md-after-every-session-from-your-corrections/SKILL.md
SKILL.md
Preview
---
name: update-claude-md-after-every-session-from-your-corrections
description: "A SKILL.md that reviews the session you just finished, finds where you had to correct the agent, and proposes small diffs to AGENTS.md, CLAUDE.md, a skill or a hook so it does not happen again."
---

# Update CLAUDE.md After Every Session From Your Corrections

A SKILL.md that reviews the session you just finished, finds where you had to correct the agent, and proposes small diffs to AGENTS.md, CLAUDE.md, a skill or a hook so it does not happen again.

## Prompt

```
---
name: session-retro
description: Reviews the current coding-agent session before it ends, finds the corrections, repeated failures and wasted steps, and proposes small diffs to AGENTS.md, CLAUDE.md, a skill or a hook so the same problem does not recur. Use when someone says "run a retro", "what should we learn from this session", "update the rules from today" or "wrap up the session".
---

# Session retro

## Steps

1. Collect evidence from this session only. List each moment where:
   - the user corrected you or undid your change;
   - a command failed more than once;
   - you searched for something the instruction files could have told you (a test command, a folder, a naming rule);
   - you asked the user something they had already answered in an earlier session.
   Quote the user's words or the error for each. If there are none, say so and stop.
2. Read the current AGENTS.md, CLAUDE.md, the skills folder and the hooks in settings before proposing anything. Skip any lesson they already cover, and note rules that were present but not followed.
3. Choose one home for each lesson:
   - Instruction file: a fact or rule needed in most sessions (commands, paths, conventions).
   - Skill: steps for one recurring task.
   - Hook: a rule that must hold every time and can be checked by a script.
   - Nothing: a one-off; say why.
4. Write each change as a unified diff of at most 6 lines. Make each rule checkable: name the command, file or pattern. Put it in the section where a reader would look.
5. Check the cost: give the new size of each instruction file and flag any growth over 10 percent. Prefer replacing a vague line to adding a new one.
6. Rank by how often the problem would recur. Keep at most 5 changes.

## Output

An evidence table (moment, quote, lesson, home), then the diffs in rank order, each with one line on what it prevents, then the lessons deliberately not saved. Apply nothing until the user approves each diff by number.

## Stop and ask

- A lesson contradicts an existing rule: show both and ask which wins.
- A change touches a file shared with other teams or repositories.
```

## Usage Notes

Save as .claude/skills/session-retro/SKILL.md, or .agents/skills/ for Codex, Cursor and Gemini CLI. Run it before you close a long session: "run a retro". To hand unfinished work to a new session instead, use the Session Handoff skill.

Example output

Example for: a 2-hour Claude Code session adding a CSV export to a Django app.

Evidence

#MomentQuote or errorLessonHome
1Ran tests with pytest"no, use make test, it sets the settings module"Test command is make testCLAUDE.md
2Edited a migration file by hand"never edit migrations, make a new one"Never edit applied migrationsHook
3Searched 4 folders for the CSV helpersrg "def to_csv" run in apps/, lib/, services/ and api/ before finding core/utils/csv.pyShared helpers live in core/utils/CLAUDE.md
4Asked which date format to use"ISO, like last time"Exports use ISO 8601 datesSkill: export-endpoint
5Typo in a variable nameNameError: name 'exprot_rows' is not definedOne-offNothing

Diffs

  1. Prevents the wrong test runner (would recur every session).
 ## Commands
-- Tests: see the Makefile
+- Tests: `make test` (sets DJANGO_SETTINGS_MODULE; plain pytest fails)
  1. Prevents edits to applied migrations, while still allowing new ones (new file .claude/hooks/no-migration-edits.sh plus one settings line).
+f=$(jq -r '.tool_input.file_path // ""')
+case "$f" in */migrations/0*) [ -e "$f" ] && { echo "Applied migration: create a new one instead" >&2; exit 2; };; esac
+exit 0
   "PreToolUse": [
+    { "matcher": "Edit|Write", "hooks": [{ "type": "command", "command": "bash \"$CLAUDE_PROJECT_DIR\"/.claude/hooks/no-migration-edits.sh" }] },

Test: editing the existing orders/migrations/0012_add_status.py is blocked; writing a new 0013_export_fields.py passes.

  1. Saves searching for helpers.
 ## Layout
+- Shared helpers (CSV, dates, money): core/utils/
  1. Keeps export formats consistent.
 3. Build the CSV with core/utils/csv.py.
+   Dates in ISO 8601 (YYYY-MM-DD), as in earlier exports.

Size: CLAUDE.md 2.1 KiB to 2.3 KiB (+9 percent).

Not saved: the variable-name typo (one-off).

Reply with the numbers to apply, for example "1, 3".

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Every proposed rule cites a quote or error from the session, so nothing is added on a hunch.
  • Choosing between instruction file, skill and hook keeps always-loaded files short and moves must-hold rules into code.
  • Diffs need approval by number, so the agent cannot quietly rewrite its own instructions.

Save as .claude/skills/session-retro/SKILL.md, or .agents/skills/ for Codex, Cursor and Gemini CLI. Run it before you close a long session: "run a retro". To hand unfinished work to a new session instead, use the Session Handoff skill.

Common edits

  • Lower the cap to 3 changes for short sessions, or raise it for a first retro on a new repository.
  • Have it append the evidence table to a docs/agent-retros.md log so you can spot lessons that keep coming back.

Reuse it: Use in a workflowAdapt in the builder

Agent OrchestrationClaude Code

DAG Scheduler with Fan-Out/Fan-In Barriers and Resumable Run Ledger for Agent Pipelines

Guides Claude Code to build or refactor a dependency-aware DAG scheduler for agent phases, with cycle validation, bounded parallelism, join policies, retries, and an append-only run ledger so interrupted runs resume without redoing finished nodes.

Agent Orchestration

Create Error Handling Contracts for AI Agents

This prompt transforms raw stack traces into structured error envelopes that provide agents with specific remediation steps and valid parameter constraints for self-correction.

Agent OrchestrationClaude

Map AI Agent State Payloads and Handover Contracts

Generate a strict Pydantic state schema for agent pipelines that defines delta updates, discard rules, and structured rejection envelopes for handoffs.

Agent OrchestrationClaude Code

Subagent Fan-Out Plan for a Large Codebase Migration

Plans a big migration so an orchestrating agent can split it into independent chunks for parallel subagents, each with a clear brief, a verification command and merge rules.

Agent OrchestrationClaude Code

Parallel Git Worktree Task Split with Interface Contracts and Merge Order

Turns a pasted feature spec into independent coding-agent tasks with file ownership, interface contracts, a merge order and a done command for each task.