pine-optimizer — Claude Code skill for faster Pine Script
A skill that rewrites Pine Script on TradingView: faster calculations, cleaner indicator settings, simpler code.
npx skills add TradersPost/pinescript-agents --skill pine-optimizer -a claude-codeWhat pine-optimizer does
The skill reads your Pine Script and rewrites it around newer language features. The core of it is UDT-first organisation: one array of a custom type instead of six parallel arrays that have to stay in sync. That kills the sync bugs and the bar_index clamping code along with them.
On the UI side it shows how the active parameter on input.* hides settings that do not apply to the current choice, and how to tuck a whole advanced block behind one checkbox. For drawing, built-in line styles replace hand-rolled visuals.
It works with Read, Edit, Grep, Glob, so it finds and edits files on its own. The skill recommends xloc.bar_time for lines because that mode has no historical buffer limit, which makes coordinate clamping unnecessary. If traditional for loops stay in the script, cache the boundary with array.size() before the loop — the array can change mid-iteration otherwise.
What it helps with
- drop parallel arrays and keep related data in one type
- hide indicator inputs that do not apply to the selected mode
- remove
bar_indexclamping when drawing lines over history - fold repeated drawing blocks into a single type method
- swap manual line styling for built-in
plot.linestyle_*
Example prompts for the agent
- Rewrite this indicator with UDTs: no parallel arrays, drawing moved into a type method.
- Hide the length inputs with
activeso they only show for the Custom mode. - Check the
forloops and cache the array bounds before iterating.
How to install pine-optimizer
1Skills CLI (Vercel)
npx skills add TradersPost/pinescript-agents --skill pine-optimizer -a claude-code2Manually: put the files in place
~/.claude/skills/pine-optimizer/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/pine-optimizer/
1Skills CLI (Vercel)
npx skills add TradersPost/pinescript-agents --skill pine-optimizer -a codex2Manually: put the files in place
.agents/skills/pine-optimizer/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add TradersPost/pinescript-agents --skill pine-optimizer -a cursor2Manually: put the files in place
.cursor/skills/pine-optimizer/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install TradersPost/pinescript-agents pine-optimizer2Manually: put the files in place
.github/skills/pine-optimizer/SKILL.md1Skills CLI (Vercel)
npx skills add TradersPost/pinescript-agents --skill pine-optimizer -a gemini-cli2Platform CLI
gemini skills install https://github.com/TradersPost/pinescript-agents --path skills/pine-optimizerManually: put the files in place
.devin/skills/pine-optimizer/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add TradersPost/pinescript-agents --skill pine-optimizer -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about pine-optimizer
How do I install pine-optimizer in Claude?
Run npx skills add TradersPost/pinescript-agents --skill pine-optimizer -a claude-code. The skill lands in ~/.claude/skills/pine-optimizer/SKILL.md.
What does pine-optimizer do?
It optimizes Pine Script: speeds up calculations, tidies indicator inputs and moves the code to a UDT architecture.
Which tools can the skill use?
Read, Edit, Grep and Glob — it reads project files, locates the relevant code and edits it.