lightweight-charts
O que ela faz
Esta skill ajuda um agente de IA a trabalhar com a biblioteca Lightweight Charts para criar e atualizar gráficos. É para desenvolvedores que criam gráficos de preços ou gráficos temporais em apps web.
Quando usar
- ✓Quando você quer adicionar um gráfico de candles, de linha ou de histograma a uma página web.
- ✓Quando precisa transmitir dados de preço ao vivo ou históricos para um gráfico existente.
- ✓Quando quer adicionar marcadores, dicas de ferramenta, painéis ou cores a um gráfico.
Link da skill
https://github.com/tradingview/lightweight-charts/blob/master/.github/skills/lightweight-charts/SKILL.mdCopie e cole na sua IA (Claude, ChatGPT ou Cursor) pedindo para seguir as instruções.
Como usar
O jeito mais fácil: copie a mensagem e cole na sua IA. Ela lê a skill e segue as instruções.
Mensagem pronta para colar
Para Claude Code, Codex ou Cursor: rode na pasta do projeto e a skill fica instalada.
Baixe o SKILL.md e coloque na pasta de skills do seu agente.
Exemplo do que pedir para a IA
“Você pode me mostrar como adicionar um gráfico de candles com atualizações de preço ao vivo usando o Lightweight Charts?”
5 skills novas por semana. 1 minuto de leitura.
Como funciona
O agente verifica qual versão da biblioteca o seu projeto usa, lê as tipagens dela e escreve o código com os nomes de opção corretos. Ele evita inventar métodos que não existem.
Conteúdo técnico (SKILL.md original)
Texto original do autor, em inglês, direto do 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) |
Perguntas frequentes
O agente precisa que a biblioteca esteja instalada no meu projeto?
Ele funciona melhor quando a biblioteca está instalada, porque pode ler a versão exata e as tipagens. Também pode usar a documentação oficial quando necessário.
Ele ajuda com os wrappers de React ou Vue?
Sim. A skill cobre as opções de wrapper para esses frameworks.
O que acontece se o agente não conseguir confirmar um detalhe?
Ele diz o que não conseguiu verificar, para que você saiba o que conferir por conta própria.
Detalhes
Descrição original do autor
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.
Popularidade
- Estrelas no GitHub
- 18 mil
- Posição no ranking
- #10735
- Licença
- Apache-2.0
- Atualizada em
- 02/11/2026
Comentários
- …
Mais skills deste repositório
Skills parecidas
angular-developer
280 milAjuda seu agente a criar código Angular e a dar conselhos sobre a estrutura do projeto. É útil para iniciar novos projetos, criar partes do código ou melhorar a performance e acessibilidade.
frontend-a11y
280 milAjuda seu agente a tornar interfaces web acessíveis para todos. Ele garante que sites e apps funcionem bem com leitores de tela e navegação por teclado.
frontend-patterns
280 milFaz seu agente aplicar padrões modernos no desenvolvimento frontend. Ele otimiza performance, gerencia estado e segue boas práticas em React e Next.js.