Coding
Context and usage limit
- Limit parallel work: Cache resets after an hour. If I have 5 tasks ongoing and I hit my session limit, continuing the tasks in a new session (often more than an hour later) will consume a lot of tokens immediately because the cache is gone.
- One session per task: Use
/clearor start a new session to reset the context window and remove irrelevant context - Use subagents: Subagents have isolated throwaway context and won't accumulate in the main conversation. For example, use subagents to do a security review of an implementation or do large refactors. Every tool call re-sends the whole conversations, and a task can have 100s of tool calls. Unnecessary context will add up quickly.
- Model switching: Avoid model switching mid-session because the full transcript will be sent again as context. (Unfortunately, if I hit the 5-hour usage limit, continuing the conversation after the limit resets will also send the full transcript because the GitHub MCP was disconnected and reconnected, which busts the cache.)
- Split big files into smaller ones: There might be information unnecessary to the current task, and reading all that in the big file will waste context space.
- Claude.md: I had Claude Code update Claude.md, a decision log, and a change log. It was helpful initially but the files got bigger and bigger, took up a lot of tokens, and ran down the 5-hour session usage limit quickly. I’m experimenting with summarizing the Claude.md file and removing unnecessary details in the Claude.md file that are already in the other two files. My project is a monorepo with folders like app, backend, and docs so that Claude can work across them in each session. I have also split it into a main Claude.md file and individual ones for each folder. I’ll have to see or sense if this affects the performance.
/doctor in Claude Code
- I learned about this command when an auto-update failed. It helped me check my setup, such as plugins and permission mode, which was helpful.
- It also helped me clean up my CLAUDE.md by cutting away standard npm script bullets and moved workflows into separate skills.
Best practices:
- From the Claude Code team (July 2026)
- Adding examples to a system prompt is no longer best practice for models like Fable 5 or even Opus 4.8. The Claude Code system prompt recently reduced in size by 80%.
- Likewise, lists of “don’t do X and don’t do Y“ can reduce the quality of results from the latest models.