self-reflection

self-reflection is a skill for Claude Code, Codex from rolandbrecht/agent-skills. It costs 85 tokens per session (977 once invoked), scanned A, original, MIT.

A self-review procedure for complex coding tasks, debugging sessions, and unfamiliar projects. It records important lessons or project-specific rules for future agents.

In plain words
What is it for?
It helps capture framework configuration lessons, unusual project conventions, debugging discoveries, and reusable instructions in project guidance files.
Why use it?
It prevents hard-won troubleshooting knowledge from disappearing when a task or conversation ends. Documenting recurring quirks can reduce repeated mistakes.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/rolandbrecht/agent-skills/self-reflection
Any agent
npx skills add rolandbrecht/agent-skills --skill self-reflection
Clone the repo
git clone --depth 1 https://github.com/rolandbrecht/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for self-reflection

README.md
[![agentmods](https://agentmods.dev/badge/skills/rolandbrecht/agent-skills/self-reflection.svg)](https://agentmods.dev/skills/rolandbrecht/agent-skills/self-reflection)
Your own site
<a href="https://agentmods.dev/skills/rolandbrecht/agent-skills/self-reflection"><img src="https://agentmods.dev/badge/skills/rolandbrecht/agent-skills/self-reflection.svg" alt="Measured on agentmods" height="20"></a>
Per session 85 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 977 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00085 $0.00977
Opus 5 $0.00043 $0.00489
Sonnet 5 $0.00017 $0.00195
Haiku 4.5 $0.00009 $0.00098

Measured 5d ago against content hash f05d5b37fc90, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

self-reflection scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

self-reflection/SKILL.md · 78 lines

How it starts

The opening of the file, as written. The whole thing — 78 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Self-Reflection (Continuous Improvement Protocol)

Overview

AI coding agents are naturally "stateless." You might spend 2 hours debugging a complex Webpack configuration, a subtle race condition, or a confusing project directory layout, eventually fix it, and then completely "forget" the lesson when a new conversation starts.

The core goal of this skill is to turn you from a "temporary worker" into a "systematic documenter."

Core Principle: Hard-won knowledge must be persisted. If a task was difficult because of an undocumented project quirk or architectural gotcha, you MUST write a rule so the next agent (or yourself in the future) doesn't repeat your mistakes.

When to Use

You must trigger this protocol automatically before declaring a task "done" and notifying the user in the following scenarios:

  • After successfully fixing a complex or confusing bug (especially if it took multiple attempts, required new context, or reading multiple files).
  • After struggling with a framework configuration.
  • After discovering a codebase-specific convention ("In this project, we always use X instead of Y").
  • After creating a complex workflow or tool sequence that could be reused.

The Protocol: How to Reflect

Before concluding your task, pause and answer these three questions internally:

  1. "Did I struggle with anything because I didn't know a project convention?"
  2. "Did I encounter an architectural 'gotcha' that another agent will likely trip over tomorrow?"
  3. "Did I write a custom CLI tool, ast-grep pattern, or bash script to solve this that I could reuse?"

If the answer to any of the above is "Yes", you MUST NOT just mention it to the user in chat. You must persist it to the codebase.


Action: Codifying the Lesson

Based on your internal reflection, choose the appropriate output format below and write the rule. Try to generalize the lesson.

1. Project-Specific Rules (AI Instruction Files)

Use this when you learned a specific convention for the current repository.

Read the full file on GitHub · 78 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 78 lines · 85 tokens per session scan A f05d5b37fc90

Subscribe to this mod's changes

self-reflection is a skill published in the GitHub repository rolandbrecht/agent-skills (4 stars, last pushed 23d ago), licensed MIT. It adds 85 tokens to every session and 977 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.