agentleFS
bInference-LabbInference-Lab/bInference/.agents/skills/add-chain/SKILL.md

add-chain

Skill2 starsChanged 2 days agoMITView on GitHub

Adds an EVM chain, or new tokens and contracts on a chain, to the registry in @binference/chains, each address read on chain first. Use when a chain, a token or a venue's contract address joins the registry.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Write each address in its EIP-55 checksum form.

    line 27
  2. Very specific:

    Every token and contract carries a verification: its source URL, the day you read it and control: "read" ("not_read" while the proxy and …

    line 37

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Add a chain

A chain is data. The engine never names one: it reads the registry. Adding an EVM chain is a file in packages/chains, its venue addresses and fork tests; nothing in engine changes. A new chain family (not EVM) is a new package instead and needs its own ADR.

1. Decide first

v1 enables BSC only (decision 0023). A new chain that owners can turn on needs the maintainers' yes: write the ADR with write-adr before the code. Tokens and contracts on BSC need no ADR.

2. Read every address on chain

An address enters the registry only after you read it on the chain itself:

  • code is present at the address;
  • for a proxy, the implementation and admin slots, and the owner, are read;
  • one call ties it to its siblings (a router's factory, a pool's tokens, a token's decimals);
  • the source is the project's own public page, repo or API, never a forum post, a block explorer's label alone, or a local note.

Write each address in its EIP-55 checksum form. Take decimals from the token's decimals(): stablecoins on BSC have 18.

3. Write the data

  • One file per chain at the top of packages/chains/src/, named after the chain's registry key (bsc.ts), exported as a ChainDefinition from @binference/chain: the CAIP-2 id, the key, the name, the family, the native asset, the block time, the finality rule, RPCs, relays, explorers (each with its txUrl transaction page, {hash} where the hash goes, and its addressUrl address page, {address} where the address goes), tokens and contracts.
  • Every token and contract carries a verification: its source URL, the day you read it and control: "read" ("not_read" while the proxy and owner are still unread).
  • Contract names are kebab-case and unique within their venue; the venue is the plugin's id.
  • The chain's ceiling caps and price feeds sit beside it, as bsc.ts exports bscCeilingCaps and bscPriceFeeds.
  • Export the new values from packages/chains/src/index.ts. Any helper file goes into a folder: check:chain-literals reads every top-level file name as a chain key.
  • Pure packages (marked pure in config/package-graph.json) never spell a chain: no eip155: literal, chain id, chain key or hex address.

4. Wire it

  • The composition root lists the chains it serves (selfHostedChains in packages/cli/src/compose/open-engine-parts.ts).
  • The config schema in packages/cli/src/config/schema/chains-venues.schema.ts holds the chain's defaults, such as its network fee cap. Run pnpm check:config-schema --write and commit the regenerated snapshot and key reference.

5. Test

  • The chain's *.test.ts beside its file, like bsc.test.ts: the definition parses, every address is checksummed and appears once, each has a dated, sourced verification.
  • A fork test in packages/chain-evm/src/fork/ reads eth_getCode at every token and contract at the pinned block, like bsc-addresses.test.ts. The fork suite forks BSC today; a second chain adds its fork to the suite's global setup in config/vitest/fork-setup.ts.
  • Venues that trade on the chain run their fork tests on it (add-venue).
pnpm vitest run packages/chains --maxWorkers=2
pnpm test:fork packages/chain-evm/src/fork
pnpm run check:chain-literals

chains is money-path code: run review-money-path and paste its checklist into the pull request.

6. Report

The chain or the addresses added, each with its source and the day it was read, the fork run that read them, and the ADR when a chain was added.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.