08/06/2026
‼️You're Probably Wasting Claude Code Tokens Without even Realizing it...
Claude Code පාවිච්චි කරද්දී ඔයත් නොදැනුවත්වම Tokens නාස්ති කරනවාද?
"Prompt එක short කරාම සල්ලි ඉතුරු වෙනවා" කියලා ඔයා තවමත් හිතන් ඉන්නවද ?! 😱
ඔයා ලියන හැම "Fix this bug" prompt එකකින්ම ඔයාගේ Tokens වැඩි ප්රමාණයක් නොදැනුවත්වම ඉවර වෙනවා. මොකද Claude ඔයාගේ අන්තිම message එක විතරක් නෙවෙයි කියවන්නේ , ඒක කාලයත් එක්ක ගොඩනැගෙන සම්පූර්ණ Working Context එකක් carry කරනවා සහ analyze කරනවා.
ඒ කියන්නේ මේ හැමදේම context එකට එකතු වෙනවා:
🔒Session එකේ කලින් කරපු messages
🔒Claude open කරපු හෝ edit කරපු files
🔒Terminal output සහ logs
🔒Test results සහ errors
🔒Tool outputs
🔒කලින් කරපු වැරදීම් සහ attempts
ඉතින් ඔයා "fix this bug" වගේ පොඩි request එකක් දැම්මත්, ලොකු Hidden Cost එකක් යන්න පුළුවන්. මොකද Claude action එකක් ගන්න කලින් මුළු situation එකම reconstruct කරන්න උත්සාහ කරන නිසා.
🧠 The Real Insight
👉 Token usage එක තීරණය වෙන්නේ ඔයාගේ prompt length එක මත විතරක් නෙවෙයි.
👉 ප්රධානම දේ තමයි ඔයා කොච්චර irrelevant context ප්රමාණයක් carry කරනවද කියන එකයි.
සරලවම කිව්වොත්:
Messy context = tokens වැඩියෙන් යනවා + Claude ට දේවල් figure out කරන්න අමාරු වෙනවා.
Clean context = faster + cheaper + more accurate results.
⚡ Claude Code එක බබා වගේ Clean එකට, පට්ටම ලාබෙට පාවිච්චි කරන්න රහස් 7ක්.
1️⃣ Be specific with scope
Prompt එක කෙටි කරනවාට වඩා scope එක සීමා කරන එක වටිනවා.
❌ වැරදි ක්රමය: "Fix the login issue"
✔️ නිවැරදි ක්රමය: "Fix the login validation issue in AuthController.php. Do not modify middleware or routes. Validate using existing auth test cases."
Why this works:
Claude ට අනවශ්ය files scan කරන්න ඕන වෙන්නේ නැහැ. Exploration එක අඩු වෙන නිසා accuracy එක වැඩි වෙලා token usage එක අඩු වෙනවා.
2️⃣ Project එක පටන් ගනිද්දීම /init run කරන්න 🚀
ලොකු project එකක වැඩ පටන් ගන්නකොටම මේ command එක run කරන්න:
/init
මේකෙන් structured CLAUDE.md file එකක් generate වෙනවා. ඒකෙන් Claude ට ඔයාගේ project structure එක, coding standards, common commands (test, build, lint) සහ workflows ගැන ලොකු අවබෝධයක් ලැබෙනවා.
Why it matters:
මේක නැත්නම් හැම session එකකදීම Claude ට ඔයාගේ project එක ගැන අලුතෙන් "re-learn" කරන්න වෙනවා. මේ file එක තිබ්බොත් context එක stable වෙනවා.
3️⃣ Heavy work වලට /agents පාවිච්චි කරන්න (Very Powerful)*
මේ command එක run කරලා වැඩේට විතරක් specialized වුණු subagents ලා හදාගන්න:
/agents
🧑💻 code-reviewer → code quality එක විතරක් review කරන්න.
🐞 debugger → errors සහ logs ගැන විතරක් focus කරන්න.
🧪 test-runner → test failures handle කරන්න.
📊 analyzer → logs හෝ data process කරන්න.
Why this reduces tokens:
හැම agent කෙනෙක්ම වැඩ කරන්නේ තමන්ගේම isolated context එකක. එයාලාගේ heavy outputs එයාලා ඇතුළෙන්ම handle කරලා ප්රධාන chat එකට දෙන්නේ clean summary එකක් විතරයි. එතකොට ඔයාගේ main chat එක logs සහ noise වලින් flood වෙන්නේ නැහැ.
4️⃣ CLAUDE.md එක clean එකට තියාගන්න
CLAUDE.md කියන්නේ project rules තියෙන තැනක්, diary එකක් නෙවෙයි.
ඇතුළත් කරන්න: Setup commands, coding standards, architecture rules, conventions.
අයින් කරන්න: Debugging history, random notes, past issues සහ experiments.
Why:
CLAUDE.md එක bloated (පිරිලා) තිබ්බොත්, ඒක හැම session එකකදීම permanent context overhead එකක් (අමතර බරක්) වෙනවා.
5️⃣ ලොකු logs blindly පේස්ට් කරන්න එපා
දහස් ගණන් line තියෙන logs එකපාර dump කරන්න එපා.
❌ වැරදි ක්රමය: Full CI/CD output එකම දාන එක.
✔️ නිවැරදි ක්රමය: Error message එක, stack trace එක සහ relevant file section එක විතරක් දෙන එක.
Why:
Claude වැඩ කරන්නේ signals එක්ක, noise එක්ක නෙවෙයි. Input එක අඩු වෙනකොට අනවශ්ය දේවල් parse කරන්න යන tokens ඉතිරි වෙනවා.
6️⃣ Long sessions reset හෝ compact කරන්න
Session එක ගොඩක් දිග වුණාම මේ commands පාවිච්චි කරන්න:
/compact → දිග context එක intelligent විදිහට compress කරනවා.
/clear → දේවල් messy වුණාම fresh session එකක් පටන් ගන්නවා.
Why:
දිග session වල "context debt" එකතු වෙනවා. පරණ irrelevant තොරතුරු නිසා නිහඬවම ඔයාගේ tokens කැපිලා යනවා.
7️⃣ One session = One goal ප්රතිපත්තිය තියාගන්න
එකම session එක අස්සේ මේ හැමදේම එකපාර කරන්න යන්න එපා:
Bug fixing + Feature development + Refactoring + Research
Why:
Intent එක mixed වුණාම Claude ට unrelated context carry කරන්න වෙනවා. ඒකෙන් tokens නාස්ති වෙනවා වගේම Claude confuse වෙන්නත් පුළුවන්.
🔥 The Big Mental Shift
Claude Code expensive වෙන්නේ ඔයා ඒක වැඩියෙන් පාවිච්චි කරන නිසාම නෙවෙයි... කාලයත් එක්ක ඒක ඇතුළේ අනවශ්ය context එකතු වෙන නිසයි.
ඉතින් නියම optimization එක:
❌ "Write shorter prompts" නෙවෙයි.
✔️ "Maintain cleaner, smaller, more relevant context" කියන එකයි.
🎯 Final Takeaway:
Better context design always beats shorter prompts.
Context එක හරියට manage කරොත් token usage එක අඩු වෙනවා, responses fast වෙනවා, accuracy එක වැඩි වෙනවා වගේම workflow එක predictable වෙනවා!
Follow for more.....