Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Chainlink Functions

    1

    Chainlink Functions - A Premium AI Agent Skill

    $7.99

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security 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.

    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.

    1. Manual review still recommended for production.
    2. Large workloads may need tuning.
    3. Very long sessions may lose state.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 4 months ago

    Permissions

    Terminal / Shell
    Listed4 months ago

    What's inside

    Frequently Asked Questions

    The Chainlink Functions skill is a premium AI agent skill that provides a complete solution for chainlink functions workflows.

    Install the skill, run the init command, and refer to the Quick Start section.

    Claude Code, Cursor, GitHub Copilot, and SKILL.md-compatible agents.

    The skill addresses: Source Code Size Limit — Functions source code is limited to approximately 56KB after serialization. Large imports or verbose logic will be rejected. Use the `simulate` command to check size before submitting. (mitigation: Follow recommended guidelines.); Callback Gas Too Low — If `gasLimit` is set too low, the callback transaction runs out of gas and the request fails silently. Always set at least 300,000 gas for simple returns, more for complex ABI decoding. (mitigation: Follow recommended guidelines.); Library Restrictions — The DON JavaScript environment only supports a limited set of standard libraries. `fs`, `net`, `child_process`, and other Node.js core modules are unavailable. Test all imports locally first. (mitigation: Follow recommended guidelines.).

    Standardized templates, repeatable CLI commands, comprehensive checks, and full reports vs. inconsistent ad-hoc results.

    Yes. The CLI can be invoked from any CI/CD runner, and configs can be version-controlled.

    One-time purchase. No recurring fees.

    New in APIs & Backend