lightweight-charts
できること
このスキルは、AIエージェントがLightweight Chartsライブラリを使ってチャートを作成・更新できるよう支援します。Webアプリで価格チャートや時系列チャートを作る開発者向けです。
使う場面
- ✓ローソク足、折れ線、ヒストグラムのチャートをWebページに追加したいとき。
- ✓ライブまたは過去の価格データを、既存のチャートに流し込みたいとき。
- ✓チャートにマーカー、ツールチップ、ペイン、色を追加したいとき。
スキルのリンク
https://github.com/tradingview/lightweight-charts/blob/master/.github/skills/lightweight-charts/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“Lightweight Chartsを使い、リアルタイムで価格が更新されるローソク足チャートを追加する方法を教えてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、あなたのプロジェクトがどのバージョンのライブラリを使っているかを確認し、型定義を読んでから、正しいオプション名を使ってコードを書きます。存在しないメソッドを推測することは避けます。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)を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) |
よくある質問
私のプロジェクトにライブラリがインストールされている必要がありますか?
インストールされていると最も良く働きます。正確なバージョンと型定義を読めるためです。必要に応じて公式ドキュメントを使うこともできます。
ReactやVueのラッパーでも使えますか?
はい。このスキルは、それらのフレームワーク向けのラッパーのオプションを扱っています。
エージェントが確認できない内容があった場合はどうなりますか?
確認できなかった点を明示するため、利用者は自分で確かめるべき事項がわかります。
詳細
作者による元の説明
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.
人気
- GitHubのスター
- 18k
- ランキング
- #10735
- ライセンス
- Apache-2.0
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
似ているスキル
angular-developer
280kエージェントがAngularのコードを作成し、プロジェクト構成についてアドバイスできるようにします。新しいプロジェクトの開始、コード部品の作成、パフォーマンスやアクセシビリティの改善に役立ちます。
frontend-a11y
280kエージェントが Web インターフェースを誰にとっても使いやすくするよう支援します。スクリーンリーダーやキーボード操作に対応し、サイトやアプリが適切に動作するようにします。
frontend-patterns
280kエージェントがフロントエンド開発の最新パターンを適用できるようにします。React と Next.js において、パフォーマンスの最適化、状態管理、ベストプラクティスの遵守を行います。