跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
开发与测试

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.

smartcontractkit · 已有 AI 审核记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add smartcontractkit/chainlink-agent-skills --skill chainlink-vrf-skill

技能说明


name: chainlink-vrf-skill description: "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." license: MIT compatibility: Designed for AI agents that implement https://agentskills.io/specification, including Claude Code, Cursor Composer, and Codex-style workflows. allowed-tools: Read WebFetch Write Edit metadata: purpose: Chainlink VRF v2.5 developer assistance and reference version: "0.0.5"

Chainlink VRF Skill

Overview

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.

Progressive Disclosure

  1. Keep this file as the default guide.
  2. Read references/subscription.md only when the user wants to build a subscription-based consumer, manage a subscription, use 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.
  3. Read references/direct-funding.md only when the user wants direct funding (no subscription), uses VRFV2PlusWrapperConsumerBase, or asks about a one-off randomness request.
  4. Read references/migration-from-v2.md when you detect V1 or V2 patterns in user-supplied code (VRFConsumerBaseV2, VRFConsumerBase, positional requestRandomWords, uint64 subscription IDs, VRFV2WrapperConsumerBase, or memory randomWords in a subscription consumer) or when the user asks how to migrate.
  5. Read references/billing.md only when the user asks about costs, LINK vs native payment, subscription funding, or premium percentages.
  6. Read references/supported-networks.md only when the user needs coordinator addresses, wrapper addresses, LINK token addresses, or key hashes for a specific network.
  7. Read references/security-and-best-practices.md only when the agent is developing consumer contracts with this skill and when the user asks about security, bias resistance, gas limit sizing, request cancellation, or production readiness.
  8. Read references/official-sources.md only when the answer depends on live data the reference files do not contain.
  9. Do not load reference files speculatively.

Routing

  1. Subscription (default): Use for recurring randomness, games, lotteries, any contract that requests randomness more than once. Route to 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 unless the user asks for a different framework. Follow the template README's "Adapt This Template" section: hold its invariant list exactly, and replace the illustrative request bookkeeping, contract name, and placeholder parameter values when the user's use case differs from the template's.
  2. Direct funding: Use for one-off requests or when the user explicitly does not want a subscription. Route to direct-funding.md.
  3. Migration: Detect legacy patterns (see Progressive Disclosure rule 4). Refuse to generate V2 code; load migration-from-v2.md and offer a v2.5 upgrade.
  4. Network lookup: When an address or key hash is needed, load supported-networks.md. Never invent coordinator or wrapper addresses.
  5. Ask one focused question if the method (subscription vs direct) or target network is unclear and the answer would materially change the code.
  6. Proceed without asking for read-only work: explanations, code generation, debugging.

Legacy Pattern Guard

VRF V1 and V2 code will not compile against current v2.5 coordinators. Detect and refuse these patterns:

V2 PatternWhy it breaks in v2.5
VRFConsumerBaseV2 baseReplaced by VRFConsumerBaseV2Plus
VRFConsumerBase baseV1 — entirely incompatible
Positional requestRandomWords(keyHash, subId, ...)Must use VRFV2PlusClient.RandomWordsRequest struct
uint64 s_subscriptionIdSub IDs are now uint256
VRFV2WrapperConsumerBase(linkAddress, wrapperAddress)No LINK address in v2.5 wrapper constructor
阅读完整来源 ↗