chainlink-data-feeds — Claude Code skill: setup & oracle checks
Helps safely read Chainlink AggregatorV3 price feeds on Hedera testnet (296) and mainnet (295), validate round staleness, and normalize decimals.
npx skills add hedera-dev/hedera-skills --skill chainlink-data-feeds -a claude-codeWhat chainlink-data-feeds does
This skill guides the AI assistant when integrating Chainlink price oracles on the Hedera network. It enforces a strict verification pattern when calling latestRoundData() on AggregatorV3Interface. The assistant rejects uncompleted rounds when answeredInRound < roundId, zero updatedAt timestamps, or non-positive answers.
Freshness checks are mandatory. The code must verify that block.timestamp - updatedAt does not exceed maxStaleness. Because feed values typically use 8 decimals, the skill requires explicit normalization to the consumer scale (often 18 decimals) with downward rounding.
Copying Ethereum aggregator addresses will break contract execution. Hedera requires dedicated feed addresses for testnet (chain ID 296) or mainnet (chain ID 295). Note that this skill only covers price feeds and explicitly excludes Chainlink CCIP tokens.
What it helps with
- read AggregatorV3Interface price feeds on Hedera
- validate incomplete and stale Chainlink feed rounds
- normalize oracle decimals from 8 to 18
- select valid feed addresses for chain IDs 295 and 296
Example prompts for the agent
- Write a Solidity function to fetch the HBAR/USD price on Hedera testnet using AggregatorV3Interface
- Audit my oracle reader contract for Chainlink round completeness and staleness checks
- Implement decimal normalization from an 8-decimal Chainlink feed to 18 decimals
How to install chainlink-data-feeds
1Skills CLI (Vercel)
npx skills add hedera-dev/hedera-skills --skill chainlink-data-feeds -a claude-code2Manually: put the files in place
~/.claude/skills/chainlink-data-feeds/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/chainlink-data-feeds/
1Skills CLI (Vercel)
npx skills add hedera-dev/hedera-skills --skill chainlink-data-feeds -a codex2Manually: put the files in place
.agents/skills/chainlink-data-feeds/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add hedera-dev/hedera-skills --skill chainlink-data-feeds -a cursor2Manually: put the files in place
.cursor/skills/chainlink-data-feeds/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install hedera-dev/hedera-skills chainlink-data-feeds2Manually: put the files in place
.github/skills/chainlink-data-feeds/SKILL.md1Skills CLI (Vercel)
npx skills add hedera-dev/hedera-skills --skill chainlink-data-feeds -a gemini-cli2Platform CLI
gemini skills install https://github.com/hedera-dev/hedera-skills --path plugins/oracles/skills/chainlink-data-feedsManually: put the files in place
.devin/skills/chainlink-data-feeds/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add hedera-dev/hedera-skills --skill chainlink-data-feeds -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 chainlink-data-feeds
How to install chainlink-data-feeds in Claude Code?
Run npx skills add hedera-dev/hedera-skills --skill chainlink-data-feeds -a claude-code. This installs the skill file to ~/.claude/skills/chainlink-data-feeds/SKILL.md.
What validation rules does chainlink-data-feeds enforce?
The skill ensures contracts verify that answeredInRound >= roundId, updatedAt != 0, and answer > 0. It also enforces a staleness check by comparing block.timestamp - updatedAt against a maximum staleness threshold.
Does chainlink-data-feeds support Chainlink CCIP?
No, this skill only covers AggregatorV3 price feeds on Hedera testnet (296) and mainnet (295). It does not support cross-chain token transfers or Chainlink CCIP.
Source text
SKILL.md · Apache-2.0
---
name: chainlink-data-feeds
description: >
Chainlink Data Feeds on Hedera. Use when reading AggregatorV3 price feeds on Hedera
(testnet 296 / mainnet 295), calling latestRoundData, checking round completeness and
staleness, or normalizing feed decimals. Not for Chainlink CCIP (cross-chain tokens).
---
# Chainlink Data Feeds (Hedera)
**Push feed pattern:** a Chainlink aggregator is updated off-chain; on-chain readers call `latestRoundData()` and must reject incomplete, non-positive, or stale rounds.
```text
Chainlink DON → AggregatorV3Interface feed → consumer latestRoundData()
```
Consumers may wrap the feed behind a local interface; that is optional. Do not assume a project-specific adapter name.
## Quick Reference
| Piece | Role |
| ----- | ---- |
| `AggregatorV3Interface` | `latestRoundData()` + `decimals()` |
| Round completeness | `answeredInRound >= roundId` and `updatedAt != 0` |
| Price | `answer > 0` (feeds are typically signed `int256`) |
| Freshness | Compare `block.timestamp - updatedAt` to a max staleness |
| Scale | Normalize feed decimals to the consumer’s scale (often 18) |
| Pair identity | Prefer canonical uppercase symbols (`HBAR`, `USD`) if you hash pair keys |
**Hedera chain IDs:** testnet `296`, mainnet `295`.
See [references/hedera-feeds.md](references/hedera-feeds.md) for where to source Hedera feed addresses. See [references/examples.md](references/examples.md) for read and normalize sketches.
## Critical: Completeness Then Staleness
Never return a price from a missing or unfinished round. Revert when:
| Condition | Why |
| --------- | --- |
| `answeredInRound < roundId` | Aggregator has not finished this round |
| `updatedAt == 0` | No successful update |
| `answer <= 0` | Invalid / non-positive price |
| `block.timestamp - updatedAt > maxStaleness` | Stale for this consumer |
```solidity
(uint80 roundId, int256 answer,, uint256 updatedAt, uint80 answeredInRound) =
feed.latestRoundData();
if (answeredInRound < roundId || updatedAt == 0) revert IncompleteRound();
if (answer <= 0) revert InvalidPrice();
if (block.timestamp - updatedAt > maxStaleness) revert StalePrice(updatedAt, maxStaleness);
```
## Critical: Hedera Feeds, Not Ethereum Addresses
Do **not** copy Ethereum mainnet aggregator addresses onto Hedera. Look up Hedera-specific Data Feed addresses for chain `295` / `296` and re-check docs before mainnet.
Pair maps (if you use them) should be constructor-only unless the project explicitly supports post-deploy updates.
## Decimal Normalization
`feed.decimals()` is often 8. Convert to the scale your app uses before arithmetic:
```solidity
uint256 price = normalizeToScale(uint256(answer), feed.decimals(), /* target */ 18);
```
Keep conversion rounding explicit (usually round down). Do not mix raw aggregator units with 18-decimal amounts.
## Checklist
When implementing or reviewing Chainlink reads on Hedera:
- [ ] Feed address taken from Hedera Data Feeds docs (not Ethereum)
- [ ] `latestRoundData` completeness checks before using `answer`
- [ ] Non-positive prices revert
- [ ] Staleness bound is enforced
- [ ] Decimals normalized to the consumer scale
- [ ] Chain ID is `295` or `296` (or the project’s documented Hedera network)
## References
- [references/examples.md](references/examples.md) — `latestRoundData` and normalize sketches
- [references/hedera-feeds.md](references/hedera-feeds.md) — where to source Hedera aggregator addresses
- [Chainlink Data Feeds](https://docs.chain.link/data-feeds)
- [Hedera price feed addresses](https://docs.chain.link/data-feeds/price-feeds/addresses?network=hedera)
© hedera-dev · Apache-2.0 · hedera-dev/hedera-skills