/closing-the-loop-plugin:reflectfrom closing-the-loop-plugin
Capture hard-won knowledge back into project documentation at the end of an implementation effort. This skill activates after completing a task — when the agent has accumulated context through back-and-forth with the developer, false starts, clarifications, and discoveries that would otherwise vanish with the context window. Instead of letting that knowledgeevaporate, this skill distills it into the project's permanent knowledge base: CLAUDE.md directives, convention definitions, architecture notes, and maintenance backlog items. Trigger this skill at the end of any implementation phase, after a subagent completes execution, or whenever a significant body of work wraps up. Also trigger when the developer says things like "ok that's done", "ship it", "merge it", "wrap up", or asks to move on to the next task. The goal is compounding — every task should leave the project smarter than it found it.
Ships in closing-the-loop-plugin. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You just finished a piece of work. You have context that no one else has — insights built up through back-and-forth with the developer, false starts, clarifications, and discoveries. That knowledge exists only in this context window, and when it closes, it's gone.
Your job is not to summarize what you did. Your job is to pay it forward — distill what you learned back into the project's permanent knowledge base so that every future task benefits from the effort that went into this one.
Every implementation effort generates two kinds of value: the code changes themselves, and the understanding that informed those changes. The code gets committed. The understanding usually evaporates.
Over time, this loss compounds. Future agents (and developers) rediscover the same gotchas, repeat the same false starts, and make the same assumptions that were already tested and rejected. The project doesn't get smarter — it just gets bigger.
This skill breaks that cycle. Each task becomes a deposit into the project's institutional knowledge, making the next task faster, safer, and better informed.
Execute this skill at the natural end of an implementation effort:
This is not a handoff note for continuing the same task. If work is ongoing and another agent needs to pick it up, that's a different concern. This is about distilling generalizable knowledge back into the project — insights that are useful beyond the immediate task.
Look at everything in your context window and ask:
What did I learn during this work that the project doesn't already know?
Not what you did. Not a summary. What you learned — about the codebase, the domain, the APIs, the developer's intent, the conventions, the gotchas. Things that were hard to figure out, easy to get wrong, or surprising.
During implementation, you inevitably encounter (and either follow or establish) conventions — patterns for how things are done in this codebase. Some were explicit, some you inferred. Capture both:
Output: New entries in docs/conventions/ with corresponding
rows in the conventions.md index. These compound — over time, the conventions
directory becomes the project's style guide.
Implementation reveals things about a codebase that reading it cold does not:
Output: Notes in project documentation (architecture docs, READMEs, code comments) or CLAUDE.md directives that help future agents navigate correctly.
The developer often shares domain context during planning and implementation — business rules, user expectations, historical decisions, product constraints. This knowledge is crucial for making good engineering decisions but rarely makes it into code:
Output: Documentation additions — the kind of context a new team member would need. Can go into READMEs, architecture docs, or CLAUDE.md as appropriate.
The most valuable knowledge is often the most painful to acquire:
Output: Warnings in CLAUDE.md, code comments at the relevant locations, or documentation updates. The test: "Would this save someone 30+ minutes if they encountered the same situation?"
Implementation is when you see the codebase most clearly. You likely noticed things that need attention but were out of scope for the current task:
Output: New entries in docs/backlog/ with corresponding rows
in the backlog.md index. These feed the active review cycle described in the
companion close-the-loop skill.
Before writing anything, think through what you've accumulated. Ask yourself:
Don't rush this step. The entire value of this skill is in the quality of reflection, not the speed.
Sort your findings into the categories above. Then filter aggressively:
Include knowledge that is:
Exclude knowledge that is:
The goal is high signal. Five sharp insights beat twenty vague observations.
This is the critical difference from a braindump. You are not writing a single document that might or might not get read. You are placing knowledge where it will be found — in the locations where future agents and developers will naturally look when they need it.
CLAUDE.md — For directives that should influence all future code generation:
docs/conventions/{slug}.md — For conventions with enough nuance
to warrant examples, rationale, and edge case documentation. Add the index row
to docs/conventions.md with a short directive.
docs/backlog/{slug}.md — For maintenance observations. Add the
index row to docs/backlog.md.
Code comments — For gotchas that are specific to a location in the code. Place the warning where the next person will see it when they're working in that area.
Project docs (READMEs, architecture docs, API docs) — For domain knowledge, architectural understanding, and integration details that belong in the project's documentation.
After writing to permanent locations, give the developer a brief summary of what you captured and where:
Before we wrap up, I've captured some things from this session:
**Added to CLAUDE.md:**
- [directive summary]
**New conventions documented:**
- [convention] → docs/conventions/{slug}.md
**Backlog items captured:**
- [item] → docs/backlog/{slug}.md
**Updated docs:**
- [file] — [what was added]
Want to review any of these before we close out?
Keep it concise. The developer should be able to glance at this and either approve or ask to review specific items. This is the last step before context closes — respect their time.
Not a task summary. The commit log and PR describe what changed. You're capturing what was learned.
Not a handoff note. This isn't about enabling the next agent to continue this specific task. It's about making the project smarter for all future tasks.
Not a journal. Don't narrate your experience. Distill it. "I spent 2 hours debugging X" is a journal entry. "Module X silently swallows errors from Y — always check the return value" is project knowledge.
Not exhaustive. You don't need to capture everything. Capture what matters. The filter is: "Would a future agent or developer benefit from knowing this, and would they have trouble discovering it on their own?"
Write in the project's voice. Match the tone, style, and level of detail of existing documentation. If the project's READMEs are terse, be terse. If they're detailed, be detailed.
Be concrete. File paths, function names, line numbers, API endpoints. Vague knowledge is nearly as useless as no knowledge.
Attribute uncertainty. If you're not sure about something, say so. Mark it: "UNVERIFIED:", "ASSUMPTION:", "NEEDS CONFIRMATION:". Future agents can then validate rather than blindly trust.
Respect existing structure. If the project has established documentation patterns, follow them. Don't create new documentation locations when existing ones would work. Extend what's there.
Don't duplicate. Before writing anything, check if it's already captured. Read CLAUDE.md, existing conventions, relevant READMEs. Add to or refine existing entries rather than creating redundant ones.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub jeremygiberson/closing-the-loop-plugin --plugin closing-the-loop-pluginOther plugins' skills for the same job