smartcontractkit/chainlink-vrf-skill
Help developers integrate Chainlink VRF into smart contracts. Use for consumer contract generation with VRFConsumerBaseV2Plus, subscription setup and funding (LINK or native), keyHash and gas lane selection, coordinator address lookup and debugging VRF integrations. Trigger on any mention of VRF, verifiable randomness, on-chain random number generation, requestRandomWords, fulfillRandomWords, VRF subscription, VRF coordinator, keyHash, or provably fair randomness in a smart contract, even if the user does not say 'VRF' explicitly.
npx skills add https://github.com/smartcontractkit/chainlink-agent-skills --skill chainlink-vrf-skill
Route VRF requests to the simplest valid path while keeping side effects and credential exposure out of the agent runtime. Generate working VRF v2.5 code on first attempt when possible. Detect legacy V1/V2 patterns and refuse to emit them — offer migration guidance instead.
VRFConsumerBaseV2Plus, call requestRandomWords, or handle the fulfillRandomWords callback.2a. Read templates/starter-kit/README.md and the files in templates/starter-kit when the user asks for a working example project, Foundry starter kit, runnable VRF example, or says something like "give me a working VRF project I can build and test." Use this starter-kit template instead of inventing project scaffolding.
VRFV2PlusWrapperConsumerBase, or asks about a one-off randomness request.VRFConsumerBaseV2, VRFConsumerBase, positional requestRandomWords, uint64 subscription IDs, VRFV2WrapperConsumerBase, or memory randomWords in a subscription consumer) or when the user asks how to migrate.subscription.md.1a. Starter kit / runnable project: For project-level example requests, especially Foundry starter requests, use templates/starter-kit. Return a concise file tree, the relevant template files, install/test commands, and the Sepolia VRF v2.5 coordinator + key hash configuration unless the user asks for another chain. Preserve the template's Foundry layout and VRFConsumerV2Plus (v2.5) contract unless the user asks for a different framework.
direct-funding.md.migration-from-v2.md and offer a v2.5 upgrade.supported-networks.md. Never invent coordinator or wrapper addresses.VRF V1 and V2 code will not compile against current v2.5 coordinators. Detect and refuse these patterns:
| V2 Pattern | Why it breaks in v2.5 |
| ------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| VRFConsumerBaseV2 base | Replaced by VRFConsumerBaseV2Plus |
| VRFConsumerBase base | V1 — entirely incompatible |
| Positional requestRandomWords(keyHash, subId, ...) | Must use VRFV2PlusClient.RandomWordsRequest struct |
| uint64 s_subscriptionId | Sub IDs are now uint256 |
| VRFV2WrapperConsumerBase(linkAddress, wrapperAddress) | No LINK address in v2.5 wrapper constructor |
| uint256[] memory randomWords in subscription fulfill | VRFConsumerBaseV2Plus uses calldata; direct-funding wrapper consumers still use memory |
| COORDINATOR as a typed state variable | Use s_vrfCoordinator from the base class |
When any of these are detected in user code: (1) name the incompatibility explicitly, (2) load migration-from-v2.md, (3) produce v2.5 code only.
This skill is non-custodial. The agent never executes, signs, broadcasts, deploys consumer contracts, creates/funds/cancels subscriptions, or calls requestRandomWords. It only generates code, command templates, or unsigned transaction data for the user to run in their own wallet-controlled environment.
requestRandomWords.These are non-negotiable in generated code.
supported-networks.md or direct the user to the official addresses page.VRFConsumerBaseV2Plus for subscription consumers and VRFV2PlusWrapperConsumerBase for direct-funding consumers (never V1/V2 base contracts).VRFV2PlusClient.RandomWordsRequest struct with extraArgs (never positional args).uint256 for subscription IDs (never uint64).calldata for VRFConsumerBaseV2Plus, memory for VRFV2PlusWrapperConsumerBase.block.prevrandao, block.difficulty, or blockhash as a randomness fallback.If the user asks the agent to perform any of the following, refuse the execution step and offer a non-custodial alternative such as a command template, unsigned transaction data, tests, or contract/code generation:
requestRandomWordsDo not treat user approval as permission to cross this boundary. Approval can authorize preparing artifacts, not executing write actions.
This skill references official VRF documentation URLs throughout its reference files.
@upstash/context7-mcp) is a useful fallback for fetching current Chainlink documentation. If no documentation-fetching tool is available, do not silently improvise, instead tell the user that live documentation could not be verified and provide the specific URL so the user can check it directly.Take smartcontractkit/chainlink-vrf-skill from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.