lightweight-charts
What it does
This skill helps an AI agent work with the Lightweight Charts library to create and update charts. It is for developers who build price charts or time-based charts in web apps.
When to use it
- βWhen you want to add a candlestick, line or histogram chart to a web page.
- βWhen you need to stream live or historical price data into an existing chart.
- βWhen you want to add markers, tooltips, panes or colors to a chart.
Skill link
https://github.com/tradingview/lightweight-charts/blob/master/.github/skills/lightweight-charts/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βCan you show me how to add a candlestick chart with live price updates using Lightweight Charts?β
5 new skills a week. 1 minute to read.
How it works
The agent checks which version of the library your project uses, reads its typings and then writes code with the right option names. It avoids guessing methods that do not exist.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Lightweight Charts skill
Works the same whether the project is a downstream npm consumer app or an upstream lightweight-charts source checkout. Detect which one you are in (below) and resolve every API name from whatever typings are locally available.
Source lookup order
Do not assume you are inside the upstream source repository.
- In a consumer app, inspect the installed package first:
node_modules/lightweight-charts/package.jsonfor the actual version.node_modules/lightweight-charts/dist/typings.d.tsfor the API surface.
- In the upstream repo, inspect
dist/typings.d.tsfirst, thensrc/if generated output is unavailable. - Use official docs/examples as supporting evidence, but local typings win when they disagree.
Verify before answering (copy-paste):
node -p "require('./node_modules/lightweight-charts/package.json').version"
rg -n "createSeriesMarkers|addSeries|IPrimitivePaneRenderer|createImageWatermark|createOptionsChart" node_modules/lightweight-charts/dist/typings.d.ts
# upstream checkout instead of a consumer app:
rg -n "createSeriesMarkers|IPrimitivePaneRenderer|createImageWatermark|createOptionsChart" dist/typings.d.ts src
If the relevant file is unavailable, say what could not be verified. Do not invent option names, methods, exports, or wrapper behavior.
If the user's code imports from lightweight_charts import ... (underscore), uses pandas/asyncio, or talks about a Python window wrapper, they are probably using the third-party Python wrapper rather than the TypeScript package. Say that clearly before giving core lightweight-charts v5 JavaScript advice.
Mental model
Eight layers, in dependency order. Most bugs come from confusing one for another:
- Chart β
createChart(container, options)returns anIChartApi. One chart per container element. - Series β added via
chart.addSeries(SeriesType, options, paneIndex?). Each call returns anISeriesApi. v5 requires importing the series type explicitly. - Scales β
chart.timeScale()(ITimeScaleApi),chart.priceScale(id)(IPriceScaleApi). Govern range, ticks, autoscale, visibility. - Data model β arrays of
{ time, β¦ }points.Time = UTCTimestamp | BusinessDay | string.UTCTimestampis seconds, not milliseconds. Times must be unique and ascending per series. - Interaction β
chart.subscribeCrosshairMove,chart.subscribeClick,timeScale.subscribeVisibleLogicalRangeChange, etc. - Layout β
chart.panes(),chart.addPane(). Adding a series with an out-of-rangepaneIndexauto-creates the pane. - Extension β pane primitives, series primitives, custom series, watermarks, custom renderers (canvas via
fancy-canvas). - Wrappers β React/Vue/Web Components/iOS/Android. Lifecycle is the wrapper's responsibility; the core library is framework-agnostic.
v5 essentials
The conventions that catch people copying older snippets:
import { createChart, CandlestickSeries, LineSeries } from 'lightweight-charts';
const chart = createChart(container, { /* ChartOptions */ });
const candles = chart.addSeries(CandlestickSeries, { /* options */ });
candles.setData([
{ time: 1700000000, open: 1, high: 2, low: 0.5, close: 1.5 },
]);
Key v5 changes versus older snippets:
chart.addSeries(SeriesType, options, paneIndex?)replacesaddLineSeries/addCandlestickSeries/ β¦createSeriesMarkers(series, markers)replacesseries.setMarkers(...). The returned primitive owns.setMarkers(...)/.markers().createTextWatermark(pane, options)andcreateImageWatermark(pane, imageUrl, options)replace thewatermarkchart option.- Series types are tree-shaken β importing them is required for ESM.
If a snippet calls addLineSeries or series.setMarkers, it's v4 or older. Confirm the user's version before forwarding it.
When the task targets v5, show the v5 API directly β do not hedge by mixing in v4 syntax.
Triage (problem β API β avoid)
| User asks about | First check | Answer with | Avoid |
|---|---|---|---|
| v5 series creation | package version + typings | chart.addSeries(SeriesType, options) |
addLineSeries / addCandlestickSeries |
| markers | createSeriesMarkers export |
marker primitive + required color |
series.setMarkers |
| timezone | formatter need vs data semantics | Intl.DateTimeFormat in formatters |
fake timeScale.timezone |
| realtime updates | last-bar vs full replace | series.update(point) |
FAQ
Does the agent need the library installed in my project?
It works best when the library is installed, because it can read the exact version and typings. It can also use official documentation when needed.
Can it help with React or Vue wrappers?
Yes. The skill covers the wrapper options for those frameworks.
What if the agent cannot confirm a detail?
It says what it could not check, so you know what to verify yourself.
Details
Original description by the author
Use when working with TradingView's lightweight-charts β creating charts, adding series (Line/Area/Bar/Candlestick/Histogram), configuring time and price scales, streaming realtime or historical data, panes, markers, per-bar/per-point colors, tooltips, coordinate conversion, custom plugins or primitives, non-financial horizontal scales, SSR/browser loading, or React/Vue/Web Components wrappers. Covers v5 API conventions and the common time, scale, marker, plugin, and wrapper foot-guns.
Popularity
- GitHub stars
- 18k
- Ranking position
- #10735
- License
- Apache-2.0
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
Similar skills
angular-developer
280kHelps your agent create Angular code and give project structure advice. Useful for starting new projects, creating code parts, or improving performance and accessibility.
frontend-a11y
280kHelps your agent make web interfaces accessible to everyone. It ensures websites and apps work well with screen readers and keyboard navigation.
frontend-patterns
280kHas your agent apply modern patterns in frontend development. It optimizes performance, manages state, and follows best practices in React and Next.js.