Works with the AI tools you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIGitHub CopilotGitHub CopilotGemini CLIGemini CLI+20 more

    Chainlink Functions

    1

    Chainlink Functions - A Premium AI Agent Skill

    $7.99

    Secure checkout via Stripe

    30-day refund guarantee

    Converts to your local currency at checkout

    0 installsSecurity scanned
    Chainlink Functions

    Chainlink Functions

    Example session with this skill installed

    Initialize a chainlink functions config and run a workflow named my-chainlink-functions-workflow.

    • Read your context and instructions
    • Compiled the chainlink functions
    • Config initialized in config/config.yaml.
    • Running chainlink-functions workflow: my-chainlink-functions-workflow...
    • Success.
    • Report: reports/chainlink-functions-report.md

    Connects securely to your tools. The creator never sees your data.

    What you get

    Parametric Insurance — Fetch weather API data as trigger conditions for automatic payout smart contracts. JavaScript computes threshold logic offchain, returns boolean payout signal.Dynamic NFTs — Update NFT metadata based on real-world sports scores or gaming stats. Functions fetches API data, transforms it, and returns the URI or trait data.DeFi Price Oracles — Aggregate prices from multiple CEX APIs (Binance, Coinbase, Kraken) with median calculation in the DON. No reliance on a single price source.Automated KYC/Compliance — Check offchain identity APIs inside a Functions request before allowing token transfers or contract interactions. Secrets manage API keys securely.Prediction Markets — Fetch event outcome data from trusted APIs and settle bets automatically. Functions validates and returns the resolved outcome onchain.Cross-Chain Data Relay — Use Functions on one chain to fetch state from a bridge API and trigger actions on the destination chain. Works with CCIP for end-to-end cross-chain flows.

    About this skill

    Chainlink Functions

    # Chainlink Functions Builder

    Smart contracts are inherently isolated from the outside world. They cannot natively access APIs, execute HTTP requests, or perform complex offchain computation. Traditional oracle solutions require running your own node infrastructure or relying on centralized API proxies that introduce trust assumptions. Chainlink Functions solves this by giving your smart contract a direct, trust-minimized pipeline to any external API or custom computation. Instead of managing oracle infrastructure, you write JavaScript source code that runs on a Decentralized Oracle Network (DON) — every node independently executes your code, and the DON aggregates results via consensus before returning them onchain. The challenge: Functions has complex setup (subscriptions, DON IDs, gas limits, source code restrictions, secrets management), sunset on June 30 2026 with migration to CRE, and developers need tooling to scaffold, test, deploy, and manage the lifecycle efficiently. This skill provides that tooling.

    What It Does

    • Scaffolds a complete Chainlink Functions consumer contract with all required imports and boilerplate
    • Generates JavaScript source code templates for API GET/POST, computation, multi-source aggregation, and ABI decoding
    • Manages Functions subscriptions: create, fund, add consumers, check balance, cancel
    • Simulates source code execution locally before onchain deployment
    • Handles DON-hosted and user-hosted (gist) secrets with encrypted threshold signing
    • Generates migration-ready code for Chainlink Runtime Environment (CRE)

    Frameworks / Standards Covered

    | Framework / Standard | Description | |---|---| | Chainlink Functions v1.0.0 | Original Functions protocol (sunset June 30 2026) | | Chainlink Runtime Environment (CRE) | Successor to Functions, enhanced capabilities | | ERC-677 | LINK token transfer standard | | Decentralized Oracle Network (DON) | Multi-node consensus architecture | | Threshold Secret Management (TSM) | Encrypted secrets with multi-party decryption | | CLF-to-CRE Migration Guide | Full concept mapping and code migration | | Solidity ^0.8.19 | Functions consumer contract requirements | | FunctionsRequest library | Request encoding/decoding utilities |

    Feature Breakdown

    ### 1. Smart Contract Scaffolding Generates a complete Functions consumer contract with: - FunctionsClient inheritance with correct constructor pattern - FunctionsRequest library integration with `using` declarations - Request encoding: setRequest, setSource, setSecrets, setArgs, setCallbackGasLimit - Response handling: fulfillRequest callback with request ID validation - Error handling: custom UnexpectedRequestID error, Response event logging - Owner-based access control via ConfirmedOwner base contract (OpenZeppelin compatible) ### 2. JavaScript Source Code Templates Pre-built JavaScript templates for the DON execution environment: - API GET request — fetches data with `Functions.makeHttpRequest()`, handles errors, returns typed responses - API POST request — sends authenticated POST with body payloads - Pure computation — on-chain math, aggregation, filtering without API dependencies - Multi-source aggregation — calls 3+ APIs and combines results (median, average, min/max) - ABI encoding/decoding — encodes multiple return values for onchain deserialization - String/number/bytes encoding — uses `Functions.encodeString()`, `Functions.encodeUint256()`, `Functions.encodeBytes()` ### 3. Subscription Manager Full lifecycle management: - Create subscription with configurable initial LINK funding - Add/remove consumer contract addresses - Check subscription balance and utilization - Cancel subscription with LINK withdrawal - Estimate request costs based on source code size, gas limits, and secrets usage - List all subscriptions for a router contract ### 4. Secrets Management Two supported approaches: - DON-hosted secrets (recommended): Encrypt secrets with DON public key, include in request. All nodes decrypt via threshold signing before execution. - User-hosted (gist) secrets: Store encrypted secrets as a GitHub gist, reference by URL. Useful for development but less secure than DON-hosted. Template includes both approaches with encryption helpers. ### 5. Local Simulation Offchain simulation workflow: - Run source code in the Functions Playground before onchain deployment - CLI tool validates JavaScript syntax and checks for disallowed patterns - Dry-run mode submits source code to DON without committing to chain - Gas estimation based on source code complexity and callback gas limit ### 6. CRE Migration Generator Critical sunset migration tooling: - Maps Functions concepts to CRE equivalents (Subscription -> Domain, DON ID -> Workflow ID) - Generates CRE-compatible Solidity contracts using the FunctionsConsumer pattern - Converts JavaScript source code to CRE TypeScript format - Provides step-by-step migration checklist with deadlines - Tests migrated contracts against CRE testnet before mainnet cutover

    Usage

    ### Quick Start ```bash # 1. Scaffold a new Functions project python3 scripts/functions_cli.py scaffold --name MyConsumer --network sepolia # 2. Create a subscription python3 scripts/functions_cli.py sub create --amount 5 --link-token 0x779877A7b0D9E8603169DDbD7836e478b4624789 # 3. Deploy consumer contract python3 scripts/functions_cli.py deploy --contract MyConsumer.sol --sub-id 123 # 4. Send a Functions request python3 scripts/functions_cli.py request --sub-id 123 --contract 0x... --source templates/api-get.js --args '[42]' # 5. Simulate source code locally python3 scripts/functions_cli.py simulate --source templates/api-get.js --args '[1]' # 6. Check subscription balance python3 scripts/functions_cli.py sub status --sub-id 123 # 7. Generate CRE migration python3 scripts/functions_cli.py migrate --sub-id 123 --contract 0x... ``` ### Configuration Create `config/functions-config.yaml`: ```yaml network: sepolia router_address: "0xb83E47C2bC239B3bf370bc41e1459A34b41238D0" don_id: "0x66756e2d657468657265756d2d7365706f6c69612d3100000000000000000000" link_token: "0x779877A7b0D9E8603169DDbD7836e478b4624789" subscription: gas_limit: 300000 gas_price: "auto" secrets: mode: don_hosted # don_hosted | user_hosted_gist encryption_key: "" # path to DON public key migration: target_cre_domain: "my-domain" cre_endpoint: "https://cre.chain.link" ```

    Output Format

    ### Functions Request Receipt ``` === FUNCTIONS REQUEST [request-id] === Subscription: 123 Consumer: 0xabc...def Source Code: 847 bytes Secrets: DON-hosted (2 entries) Args: [42] Callback Gas: 300000 Status: PENDING (tx: 0x123...) --- Response: 0x000000000000000000000000000000000000000000000000000000000000002a Decoded: 42 Explorer: https://sepolia.etherscan.io/tx/0x123... ``` ### Subscription Status ``` === SUBSCRIPTION 123 === Admin: 0xabc...def Balance: 4.25 LINK Consumers: 2 - 0xabc...def (active) - 0xdef...abc (active) Total Requests: 147 Last Fulfilled: 2026-06-01 14:32 UTC Status: ACTIVE --- CRE Migration: PENDING (deadline: June 30 2026) ```

    Why This Beats Prompting It Yourself

    AspectAd-Hoc PromptingThis Skill Prompting ChatGPT/Claude Using This Skill --- --- --- Router addresses Must look up every time Pre-configured for all 15 networks Source code restrictions May suggest disallowed patterns Validates against DON constraints Secret encryption No tooling for threshold encryption Built-in DON-hosted secret manager Migration urgency May not mention sunset deadline Active CRE migration tracking Subscription management No lifecycle understanding Full CRUD with cost estimator Network-specific booleans Easy to get wrong Correct by default per network Error recovery Generic suggestions Specific Functions error codes Multiple return values Likely to miss ABI encoding Pre-built ABI encode/decode templates

    Use Cases

    • Parametric Insurance — Fetch weather API data as trigger conditions for automatic payout smart contracts. JavaScript computes threshold logic offchain, returns boolean payout signal.
    • Dynamic NFTs — Update NFT metadata based on real-world sports scores or gaming stats. Functions fetches API data, transforms it, and returns the URI or trait data.
    • DeFi Price Oracles — Aggregate prices from multiple CEX APIs (Binance, Coinbase, Kraken) with median calculation in the DON. No reliance on a single price source.
    • Automated KYC/Compliance — Check offchain identity APIs inside a Functions request before allowing token transfers or contract interactions. Secrets manage API keys securely.
    • Prediction Markets — Fetch event outcome data from trusted APIs and settle bets automatically. Functions validates and returns the resolved outcome onchain.

    How to install

    Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.

    ~30 seconds
    1. 1

      Download the ZIP

      Free skills download straight away. Paid skills unlock right after purchase.

    2. 2

      Unzip into your skills folder

      Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.

    3. 3

      Ask your agent to use it

      Restart the agent if it was already running. It picks the skill up automatically - no config needed.

    Skills folder by agent

    Click the path to copy it. Create the folder if it does not exist yet.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean 2 months ago

    • Passed all security checks, Safe to install

    Listed2 months ago

    What's inside

    Frequently Asked Questions