Check if expected directories exist: ls -la .claude/cache/
Check if expected files were created: ls -la .claude/cache/learnings/
Check logs for errors: tail .claude/cache/*.log
Run the failing command manually to see actual error
Only then edit code
DON'T
Assume "hook didn't run" without checking outputs
Edit code based on what you think should happen
Confuse global vs project paths (check both: .claude/ and ~/.claude/)
Source Sessions
a541f08a: Token limit error was invisible until manual run revealed it
6a9f2d7a: Looked in wrong cache path (~/.claude/ vs .claude/), assumed hook failure
a8bd5cea: Confirmed hook worked by finding output files in project cache
1c21e6c8: Verified Artifact Index indexing by checking DB file exists
1---2name: observe-before-editing3description: Observe Before Editing4---56# Observe Before Editing
78Before editing code to fix a bug, confirm what the system *actually produced*.
910## Pattern
1112Outputs don't lie. Code might. Check outputs first.
1314## DO
15161. Check if expected directories exist: `ls -la .claude/cache/`
172. Check if expected files were created: `ls -la .claude/cache/learnings/`
183. Check logs for errors: `tail .claude/cache/*.log`
194. Run the failing command manually to see actual error
205. Only then edit code
2122## DON'T
2324- Assume "hook didn't run" without checking outputs
25- Edit code based on what you *think* should happen
26- Confuse global vs project paths (check both: `.claude/` and `~/.claude/`)
2728## Source Sessions
2930- a541f08a: Token limit error was invisible until manual run revealed it
31- 6a9f2d7a: Looked in wrong cache path (`~/.claude/` vs `.claude/`), assumed hook failure
32- a8bd5cea: Confirmed hook worked by finding output files in project cache
33- 1c21e6c8: Verified Artifact Index indexing by checking DB file exists
Run npx skillmds add majiayu000/observe-before-editing in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Observe Before Editing It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Capability flags: reads secrets. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
majiayu000 (@majiayu000) published this skill. Their other Agent Skills are listed on their SkillMD profile.