# Agent skills

## Overview

The library repository ships an [Agent Skill] for AI coding assistants, such as Claude Code, Codex, Cursor, and GitHub Copilot.
A skill is a folder with instructions and scripts that the assistant loads when a task needs it.
The skill gives the assistant the library's own rules instead of guesses from training data.

## Datafeed skill

The `charting-library-datafeed` skill covers connecting market data to the library.
It explains the [Datafeed API] and the [UDF adapter], and covers [symbology], [trading sessions], resolutions, real-time updates and reconnects, quotes for Trading Platform, and the common issues listed in [Datafeed: common issues].
It also covers [saving and loading] and [customization precedence], which often come up next to datafeed work.

The skill tells the assistant to answer a datafeed question in one of three ways:

- Name the existing feature, featureset, or property that does what the user needs.
- State plainly that the library does not support the requested behavior, and give a workaround if one exists.
- Find the datafeed rule the implementation breaks, fix it, and prove the fix with the checker.

### Datafeed checker

The skill includes `scripts/check-datafeed.mjs`, a script that calls your datafeed the same way the library does and reports every violation it finds.
Each finding names the rule, the symptom you would see on the chart, and the documentation page that explains it.

The script requires Node.js 18 or later and has no dependencies. You can run it against a datafeed module or a UDF server:

```sh
# A datafeed module that exports the datafeed object, a factory function, or a class
node .agents/skills/charting-library-datafeed/scripts/check-datafeed.mjs --datafeed ./src/datafeed.js --symbol AAPL

# A server that implements the UDF protocol
node .agents/skills/charting-library-datafeed/scripts/check-datafeed.mjs --udf https://your-server.example.com --symbol AAPL
```

If your datafeed only runs in the browser, wrap it before you pass it to the [Widget Constructor].
The wrapper does not change the datafeed's behavior. It checks every request the library makes and logs violations to the console:

```js
import { createCheckedDatafeed } from './.agents/skills/charting-library-datafeed/scripts/datafeed-check/index.mjs';

new TradingView.widget({
    // ...
    datafeed: createCheckedDatafeed(datafeed),
});
```

Run the script with `--help` to see all options.

## Install the skill

The skill is located in the `.agents/skills/charting-library-datafeed` folder of the library repository [🔐 (restricted access)](https://charting-library-docs.xstaging.tv/latest/quick-start.md#1-get-access "Click to open the 'Getting Access' section.").
The commands on this page assume the skill is in `.agents/skills/` of your project; adjust the path if you install it elsewhere.

Install it into your project with the `skills` CLI. It uses your Git access to the repository:

```sh
npx skills add tradingview/charting_library --skill charting-library-datafeed
```

For Trading Platform, use `tradingview/trading_platform` instead.
You can also copy the folder by hand, for example to `.claude/skills/` for Claude Code or `.agents/skills/` for other agents.
Installing the library as an npm package does not include the skill.

The skill in the repository always matches the library version in that repository.
If you update the library, update the skill as well.

[Agent Skill]: https://agentskills.io
[customization precedence]: https://charting-library-docs.xstaging.tv/latest/customization/customization-precedence.md
[Datafeed API]: https://charting-library-docs.xstaging.tv/latest/connecting_data/datafeed-api.md
[Datafeed: common issues]: https://charting-library-docs.xstaging.tv/latest/connecting_data/Datafeed-Issues.md
[saving and loading]: https://charting-library-docs.xstaging.tv/latest/saving_loading.md
[symbology]: https://charting-library-docs.xstaging.tv/latest/connecting_data/Symbology.md
[trading sessions]: https://charting-library-docs.xstaging.tv/latest/connecting_data/time-and-sessions/Trading-Sessions.md
[UDF adapter]: https://charting-library-docs.xstaging.tv/latest/connecting_data/UDF.md
[Widget Constructor]: https://charting-library-docs.xstaging.tv/latest/configuration/Widget-Constructor.md

---

## Sitemap

- [All documentation pages](https://charting-library-docs.xstaging.tv/llms.txt)
- [Full page map with headings](https://charting-library-docs.xstaging.tv/docs_map.md)
