Skip to content

Commit fc1d506

Browse files
committed
feat: add near jsonrpc skill
1 parent 3ee40e3 commit fc1d506

File tree

5 files changed

+199
-1
lines changed

5 files changed

+199
-1
lines changed

docs/skills.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ This repository ships one canonical skill for UXC (Universal X-Protocol CLI) and
4545
- Wrapper for Helius Wallet API wallet intelligence reads via UXC + curated OpenAPI schema and API-key auth.
4646
- `skills/blocknative-openapi-skill`
4747
- Wrapper for Blocknative gas price and fee intelligence reads via UXC + curated OpenAPI schema and API-key auth.
48+
- `skills/near-jsonrpc-skill`
49+
- Wrapper for NEAR JSON-RPC reads via UXC + provider-aware public RPC default and deprecated-endpoint guardrails.
4850
- `skills/alchemy-openapi-skill`
4951
- Wrapper for Alchemy Prices API read workflows via UXC + curated OpenAPI schema and path-templated API-key auth.
5052
- `skills/chainbase-openapi-skill`
@@ -89,7 +91,7 @@ python ~/.codex/skills/.system/skill-installer/scripts/install-skill-from-github
8991
--path skills/deepwiki-mcp-skill
9092
```
9193

92-
Replace `skills/deepwiki-mcp-skill` with `skills/context7-mcp-skill`, `skills/okx-mcp-skill`, `skills/dune-mcp-skill`, `skills/thegraph-mcp-skill`, `skills/thegraph-token-mcp-skill`, `skills/etherscan-mcp-skill`, `skills/notion-mcp-skill`, `skills/discord-openapi-skill`, `skills/slack-openapi-skill`, `skills/matrix-openapi-skill`, `skills/line-openapi-skill`, `skills/feishu-openapi-skill`, `skills/whatsapp-openapi-skill`, `skills/dingtalk-openapi-skill`, `skills/coingecko-openapi-skill`, `skills/defillama-openapi-skill`, `skills/blockscout-openapi-skill`, `skills/chainbase-openapi-skill`, `skills/moralis-openapi-skill`, `skills/alchemy-openapi-skill`, `skills/coinapi-openapi-skill`, `skills/dexscreener-openapi-skill`, `skills/helius-openapi-skill`, `skills/blocknative-openapi-skill`, `skills/binance-web3-openapi-skill`, or `skills/binance-spot-openapi-skill` as needed.
94+
Replace `skills/deepwiki-mcp-skill` with `skills/context7-mcp-skill`, `skills/okx-mcp-skill`, `skills/dune-mcp-skill`, `skills/thegraph-mcp-skill`, `skills/thegraph-token-mcp-skill`, `skills/etherscan-mcp-skill`, `skills/notion-mcp-skill`, `skills/discord-openapi-skill`, `skills/slack-openapi-skill`, `skills/matrix-openapi-skill`, `skills/line-openapi-skill`, `skills/feishu-openapi-skill`, `skills/whatsapp-openapi-skill`, `skills/dingtalk-openapi-skill`, `skills/coingecko-openapi-skill`, `skills/defillama-openapi-skill`, `skills/blockscout-openapi-skill`, `skills/chainbase-openapi-skill`, `skills/moralis-openapi-skill`, `skills/alchemy-openapi-skill`, `skills/coinapi-openapi-skill`, `skills/dexscreener-openapi-skill`, `skills/helius-openapi-skill`, `skills/blocknative-openapi-skill`, `skills/near-jsonrpc-skill`, `skills/binance-web3-openapi-skill`, or `skills/binance-spot-openapi-skill` as needed.
9395

9496
After installation, restart Codex to load new skills.
9597

@@ -208,6 +210,12 @@ bash skills/helius-openapi-skill/scripts/validate.sh
208210
bash skills/blocknative-openapi-skill/scripts/validate.sh
209211
```
210212

213+
- Validate NEAR wrapper docs when touched:
214+
215+
```bash
216+
bash skills/near-jsonrpc-skill/scripts/validate.sh
217+
```
218+
211219
- Validate Alchemy wrapper docs when touched:
212220

213221
```bash

skills/near-jsonrpc-skill/SKILL.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
---
2+
name: near-jsonrpc-skill
3+
description: Operate NEAR JSON-RPC reads through UXC with a public provider default, provider-override guidance, and read-only guardrails.
4+
---
5+
6+
# NEAR JSON-RPC Skill
7+
8+
Use this skill to run NEAR JSON-RPC operations through `uxc` + JSON-RPC.
9+
10+
Reuse the `uxc` skill for shared execution and error-handling guidance.
11+
12+
## Prerequisites
13+
14+
- `uxc` is installed and available in `PATH`.
15+
- Network access to a working NEAR RPC provider.
16+
- This skill defaults to `https://free.rpc.fastnear.com`, which is listed on the official NEAR RPC providers page.
17+
18+
## Scope
19+
20+
This skill covers a safe read-first NEAR RPC surface:
21+
22+
- chain status
23+
- account state query
24+
- finalized block lookup
25+
- chunk lookup by chunk hash
26+
- gas price lookup
27+
- validator set lookup
28+
29+
This skill does **not** cover:
30+
31+
- transaction submission methods
32+
- signing or wallet flows
33+
- archival assumptions for very old blocks or chunks
34+
- deprecated `near.org` or `pagoda.co` public RPC endpoints
35+
36+
## Endpoint And Provider Choice
37+
38+
This skill uses the public FastNear mainnet RPC by default:
39+
40+
- `https://free.rpc.fastnear.com`
41+
42+
The official NEAR docs now treat `near.org` and `pagoda.co` RPC endpoints as deprecated. Do not use those old hosts as the default for new automation.
43+
44+
If the user already has a preferred provider from the official NEAR providers page, relink the same command to that provider instead of reusing the deprecated endpoints.
45+
46+
## Authentication
47+
48+
The default FastNear public RPC used by this skill does not require authentication.
49+
50+
If the user switches to a private NEAR provider, verify its auth model before reusing this skill unchanged.
51+
52+
## Core Workflow
53+
54+
1. Use the fixed link command by default:
55+
- `command -v near-jsonrpc-cli`
56+
- If missing, create it:
57+
`uxc link near-jsonrpc-cli https://free.rpc.fastnear.com`
58+
- `near-jsonrpc-cli -h`
59+
60+
2. Inspect host help first, then run known read methods:
61+
- `near-jsonrpc-cli -h`
62+
- `near-jsonrpc-cli status`
63+
- `near-jsonrpc-cli gas_price '[null]'`
64+
65+
3. Prefer narrow validation before deeper queries:
66+
- `near-jsonrpc-cli status`
67+
- `near-jsonrpc-cli block '{"finality":"final"}'`
68+
- `near-jsonrpc-cli query '{"request_type":"view_account","finality":"final","account_id":"near"}'`
69+
70+
4. Execute with positional JSON for structured params:
71+
- `near-jsonrpc-cli gas_price '[null]'`
72+
- `near-jsonrpc-cli validators '[null]'`
73+
- `near-jsonrpc-cli chunk '{"chunk_id":"75cewvnKFLrJshoUft1tiUC9GriuxWTc4bWezjy2MoPR"}'`
74+
75+
## Recommended Read Operations
76+
77+
- `status`
78+
- `query`
79+
- `block`
80+
- `chunk`
81+
- `gas_price`
82+
- `validators`
83+
84+
## Guardrails
85+
86+
- Keep automation on the JSON output envelope; do not use `--text`.
87+
- Parse stable fields first: `ok`, `kind`, `protocol`, `data`, `error`.
88+
- Stay on the read-only method surface by default.
89+
- Do not use this skill for transaction submission, signing, or wallet-authenticated flows.
90+
- The official NEAR docs mark the old `near.org` and `pagoda.co` public RPC endpoints as deprecated. Prefer providers from the official RPC providers page instead.
91+
- Public providers can differ in archival retention and rate limits. If `chunk` or older `block` lookups fail with unknown or garbage-collected errors, switch to a provider that explicitly supports the needed history.
92+
- `near-jsonrpc-cli <operation> ...` is equivalent to `uxc https://free.rpc.fastnear.com <operation> ...`.
93+
94+
## References
95+
96+
- Usage patterns: `references/usage-patterns.md`
97+
- NEAR RPC introduction: https://docs.near.org/api/rpc/introduction
98+
- NEAR RPC providers: https://docs.near.org/api/rpc/providers
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
interface:
2+
display_name: "NEAR JSON-RPC"
3+
short_description: "Operate NEAR mainnet JSON-RPC reads via UXC with a provider-aware public RPC default"
4+
default_prompt: "Use $near-jsonrpc-skill to discover and execute NEAR JSON-RPC read-only operations through UXC with a provider-aware public RPC default and deprecated-endpoint guardrails."
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# NEAR JSON-RPC Skill - Usage Patterns
2+
3+
## Link Setup
4+
5+
```bash
6+
command -v near-jsonrpc-cli
7+
uxc link near-jsonrpc-cli https://free.rpc.fastnear.com
8+
near-jsonrpc-cli -h
9+
```
10+
11+
## Read Examples
12+
13+
```bash
14+
# Read node and chain status
15+
near-jsonrpc-cli status
16+
17+
# Read the latest finalized block
18+
near-jsonrpc-cli block '{"finality":"final"}'
19+
20+
# Read an account state
21+
near-jsonrpc-cli query '{"request_type":"view_account","finality":"final","account_id":"near"}'
22+
23+
# Read gas price for the latest block context
24+
near-jsonrpc-cli gas_price '[null]'
25+
26+
# Read validator sets
27+
near-jsonrpc-cli validators '[null]'
28+
29+
# Read a chunk by chunk hash
30+
near-jsonrpc-cli chunk '{"chunk_id":"75cewvnKFLrJshoUft1tiUC9GriuxWTc4bWezjy2MoPR"}'
31+
```
32+
33+
## Provider Override
34+
35+
```bash
36+
# Relink the same command to another provider from the official NEAR RPC providers page
37+
uxc link near-jsonrpc-cli https://<near-rpc-provider-host>
38+
```
39+
40+
Do not relink to deprecated `near.org` or `pagoda.co` public RPC hosts.
41+
42+
## Fallback Equivalence
43+
44+
- `near-jsonrpc-cli <operation> ...` is equivalent to
45+
`uxc https://free.rpc.fastnear.com <operation> ...`.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
5+
SKILL_DIR="${ROOT_DIR}/skills/near-jsonrpc-skill"
6+
SKILL_FILE="${SKILL_DIR}/SKILL.md"
7+
OPENAI_FILE="${SKILL_DIR}/agents/openai.yaml"
8+
USAGE_FILE="${SKILL_DIR}/references/usage-patterns.md"
9+
10+
fail() {
11+
printf '[validate] error: %s\n' "$*" >&2
12+
exit 1
13+
}
14+
15+
need_cmd() {
16+
command -v "$1" >/dev/null 2>&1 || fail "required command not found: $1"
17+
}
18+
19+
need_cmd rg
20+
21+
for file in "${SKILL_FILE}" "${OPENAI_FILE}" "${USAGE_FILE}"; do
22+
[[ -f "${file}" ]] || fail "missing required file: ${file}"
23+
done
24+
25+
rg -q '^name:\s*near-jsonrpc-skill\s*$' "${SKILL_FILE}" || fail 'invalid skill name'
26+
rg -q '^description:\s*.+' "${SKILL_FILE}" || fail 'missing description'
27+
rg -q 'command -v near-jsonrpc-cli' "${SKILL_FILE}" || fail 'missing link-first command check'
28+
rg -q 'uxc link near-jsonrpc-cli https://free.rpc.fastnear.com' "${SKILL_FILE}" "${USAGE_FILE}" || fail 'missing fixed link create command'
29+
rg -q 'near.org' "${SKILL_FILE}" || fail 'missing deprecated endpoint warning'
30+
rg -q 'status' "${SKILL_FILE}" || fail 'missing status method guidance'
31+
rg -q 'gas_price' "${SKILL_FILE}" || fail 'missing gas_price method guidance'
32+
rg -q 'validators' "${SKILL_FILE}" || fail 'missing validators method guidance'
33+
rg -q 'read-only' "${SKILL_FILE}" || fail 'missing read-only guardrail'
34+
35+
if rg -q -- "--args\\s+'\\{" "${SKILL_FILE}" "${USAGE_FILE}"; then
36+
fail 'found banned legacy JSON argument pattern'
37+
fi
38+
39+
rg -q '^\s*display_name:\s*"NEAR JSON-RPC"\s*$' "${OPENAI_FILE}" || fail 'missing display_name'
40+
rg -q '^\s*short_description:\s*".+"\s*$' "${OPENAI_FILE}" || fail 'missing short_description'
41+
rg -q '^\s*default_prompt:\s*".*\$near-jsonrpc-skill.*"\s*$' "${OPENAI_FILE}" || fail 'default_prompt must mention $near-jsonrpc-skill'
42+
43+
echo "skills/near-jsonrpc-skill validation passed"

0 commit comments

Comments
 (0)