DEV Community

Cover image for Building an Agent SKILL for SeraProtocol: The Ultimate Guide to On-chain FX Automation
Haruki Kondo
Haruki Kondo

Posted on

Building an Agent SKILL for SeraProtocol: The Ultimate Guide to On-chain FX Automation

Introduction

I have been sharing the charm of Sera Protocol through this series.

  1. [Next-Gen On-Chain FX] Why Sera Protocol Replaced AMM with CLOB: A Technical Deep Dive
  2. Hands-on with Sera Protocol's GraphQL API!
  3. Let's Build a Script to Retrieve Data from Sera Protocol!
  4. Hands-on with Sera Protocol Tutorial: Mastering On-Chain Trade Execution!
  5. Full-Throttle Sera Protocol: Building a Professional DeFi Dashboard with React
  6. Building an MCP Server for Sera Protocol: The Dawn of AI-Agent Driven On-Chain FX

For this 7th installment, I'll wrap up the series by summarizing my experience building an Agent SKILL for Sera Protocol!

I hope you enjoy reading this to the end!

About the SKILL

The skill I created can be found in the following GitHub repository!

GitHub logo mashharuki / SeraProtocol-Sample

Sera Protocol Sample Repo

SeraProtocol-Sample

Sera Protocol Sample Repo

Sample Query

Market

curl -s -X POST \
  -H "Content-Type: application/json" \
  -d '{"query": "{ market(id: \"0xd99802ee8f16d6ff929e27546de15d03fdcce4bd\") { id quoteToken { symbol decimals } baseToken { symbol decimals } quoteUnit makerFee takerFee minPrice tickSpace latestPrice } }"}' \
  https://api.goldsky.com/api/public/project_cmicv6kkbhyto01u3agb155hg/subgraphs/sera-pro/1.0.9/gn | jq
Enter fullscreen mode Exit fullscreen mode

list

curl -s -X POST \
  -H "Content-Type: application/json" \
  -d '{"query": "{ markets(first: 5) { id quoteToken { symbol } baseToken { symbol } latestPrice latestPriceIndex } }"}' \
  https://api.goldsky.com/api/public/project_cmicv6kkbhyto01u3agb155hg/subgraphs/sera-pro/1.0.9/gn | jq
Enter fullscreen mode Exit fullscreen mode

Order

curl -s -X POST \
  -H "Content-Type: application/json" \
  -d '{"query": "{ openOrders(first: 10, where: { user: \"0xda6e605db8c3221f4b3706c1da9c4e28195045f5\" }) { id market { id } priceIndex isBid rawAmount status } }"}' \
  https://api.goldsky.com/api/public/project_cmicv6kkbhyto01u3agb155hg/subgraphs/sera-pro/1.0.9/gn | jq
Enter fullscreen mode Exit fullscreen mode

Depths

curl -s -X POST \
  -H "Content-Type: application/json" \
  -d '{"query": "{ depths(first: 10, where: { market: \"0xd99802ee8f16d6ff929e27546de15d03fdcce4bd\", isBid:
Enter fullscreen mode Exit fullscreen mode

Contents of the Agent SKILL

This skill includes features to comprehensively support app development using Sera Protocol from four perspectives:

  • Development patterns using GraphQL
  • Development patterns using Smart Contracts
  • Integration with Frontend Applications
  • Developing MCP Servers

Implementation Method

I used Anthropic's skill-creator to implement the SKILL!
It has been recently updated, and the quality of the generated Agent SKILLs is becoming a hot topic!

GitHub logo anthropics / skills

Public repository for Agent Skills

Note: This repository contains Anthropic's implementation of skills for Claude. For information about the Agent Skills standard, see agentskills.io.

Skills

Skills are folders of instructions, scripts, and resources that Claude loads dynamically to improve performance on specialized tasks. Skills teach Claude how to complete specific tasks in a repeatable way, whether that's creating documents with your company's brand guidelines, analyzing data using your organization's specific workflows, or automating personal tasks.

For more information, check out:

About This Repository

This repository contains skills that demonstrate what's possible with Claude's skills system. These skills range from creative applications (art, music, design) to technical tasks (testing web apps, MCP server generation) to enterprise workflows (communications, branding, etc.).

Each skill is self-contained in its own folder with a SKILL.md file containing the…

When requesting the skill creation, I provided the content of my previous blog posts and the sample code I had implemented as context.

I will share the results of how that turned out!

The model used was Claude 4.6 Opus.

Three Evaluation Scenarios for the Created SKILL

The update to skill-creator included a feature to evaluate the created skills.

Specifically, it sets up three evaluation scenarios and measures how well the requirements are met when the skill is used versus when it is not!

For this project, the following scenarios were prepared.

Scenario 1

  • Prompt:
  Write a TypeScript script to get the order book information (5 bids/asks each) for the TWETH/TUSDC market from the SeraProtocol subgraph. Do not use viem, use fetch only.
Enter fullscreen mode Exit fullscreen mode
  • Expected Result:
  Fetch-based TypeScript code that uses GraphQL query to get bids/asks from the depths entity. Includes the correct subgraph URL, appropriate where/orderBy/orderDirection conditions, and rawAmount_gt:0 filter.
Enter fullscreen mode Exit fullscreen mode

Scenario 2

  • Prompt:
  Tell me the full procedure for placing a limitBid on Sera Protocol. From token approve to tx submission and waiting for confirmation. Please provide a specific code example using viem. priceIndex=12000, rawAmount=500.
Enter fullscreen mode Exit fullscreen mode
  • Expected Result:
  A complete flow of 1) ERC20 approve → 2) simulateContract → 3) writeContract → 4) waitForTransactionReceipt. Viem code including the correct ROUTER_ADDRESS, LimitOrderParams struct, deadline setting, and postOnly=true safety setting.
Enter fullscreen mode Exit fullscreen mode

Scenario 3

  • Prompt:
  I want to add a new tool `sera_get_chart_data` to the SeraProtocol MCP server. It's a read-only tool that returns OHLCV (candlestick) data. Which files should I change and how?
Enter fullscreen mode Exit fullscreen mode
  • Expected Result:
  1) Add Zod schema to schemas/index.ts 2) Add chartLogs GraphQL query function to services/subgraph.ts 3) Register tool in tools/read-tools.ts. Implementation policy following existing code structure and patterns, including intervalType (1m, 5m, 15m, 1h, 4h, 1d, 1w) parameters.
Enter fullscreen mode Exit fullscreen mode

Results of the Three Evaluation Scenarios

The results were as follows!

First, the overall summary:

Item With SKILL Without SKILL Difference (Based on "With")
Average Pass Rate 1.00 (±0.00) 0.83 (±0.14) +17%
Average Execution Time 88.07s (±31.2) 69.47s (±22.4) +27%
Average Token Count 31,483 (±7,460) 23,423 (±5,020) +34%

Next, the comparison by scenario:

Scenario With SKILL
(Pass / Time / Tokens)
Without SKILL
(Pass / Time / Tokens)
Comments
graphql-orderbook 8/8 (100%)
66.4s
21,513
8/8 (100%)
51.1s
18,033
Both achieved requirements
limit-bid-flow 9/9 (100%)
131.7s
39,321
8/9 (89%)
101.0s
30,163
Accuracy dropped without SKILL
mcp-chart-tool 7/7 (100%)
66.1s
33,614
5/7 (71%)
57.3s
22,072
Largest difference

The analysis points are summarized below:

  • "With SKILL" achieved 100% in all 3 scenarios (24/24 assertions).
  • "Without SKILL" lost points in Scenarios 2 and 3 (missing market info acquisition, incorrect approve expression, lack of polling, lack of postOnly safety measure, confusing candles/chartLogs, missing 1w interval).
  • Scenario 1 had low discriminative power, as both achieved perfect scores.
  • While "With SKILL" increased token consumption, it improved the accuracy and comprehensiveness of implementations based on domain-specific knowledge.

The accuracy is quite impressive!

Comparison of Actually Generated Code

Next, let's look at the code actually generated for each scenario.

Scenario ①

In this scenario, we tried implementing a simple script that gets SeraProtocol data using only GraphQL without viem. Both patterns seem to meet the requirements!

  • With SKILL

https://github.com/mashharuki/SeraProtocol-Sample/tree/main/sera-protocol-workspace/iteration-1/eval-1-graphql-orderbook/with_skill

  • Without SKILL

https://github.com/mashharuki/SeraProtocol-Sample/tree/main/sera-protocol-workspace/iteration-1/eval-1-graphql-orderbook/without_skill

Scenario ②

Next is the result for the scenario including write-type processing using viem. You can see that the accuracy drops in the pattern where the SKILL is not used.

In the "With SKILL" case, the logic to simulate transaction processing is implemented very carefully.

  • With SKILL

https://github.com/mashharuki/SeraProtocol-Sample/tree/main/sera-protocol-workspace/iteration-1/eval-2-limit-bid-flow/with_skill

  • Without SKILL

https://github.com/mashharuki/SeraProtocol-Sample/tree/main/sera-protocol-workspace/iteration-1/eval-2-limit-bid-flow/without_skill

Scenario ③

Finally, for the most difficult MCP server implementation, the results were even more clearly divided between "With SKILL" and "Without SKILL."

When the SKILL was present, it output not only build and test commands but also how to verify operations using the MCP Inspector.

  • With SKILL

https://github.com/mashharuki/SeraProtocol-Sample/tree/main/sera-protocol-workspace/iteration-1/eval-3-mcp-chart-tool/with_skill

  • Without SKILL

https://github.com/mashharuki/SeraProtocol-Sample/tree/main/sera-protocol-workspace/iteration-1/eval-3-mcp-chart-tool/without_skill

Summary

I tried turning everything I've researched and all the sample code I've built into a SKILL!

It was confirmed that the more complex the implementation method, the more the SKILL demonstrates its power.

Sera Protocol currently only supports testnets, so why not master development on Sera Protocol using SKILLs before the mainnet launch?

Thank you for reading this far!

Top comments (0)