Agents

Give your agent the rules, the docs as Markdown, and live state.

The Quick Start prompt on Get Started sets up all three for your agent. Pick by what the agent needs.

UseWhen the agent
SkillWrites code against Secondlayer and needs the rules it gets wrong without them
Connect an AgentNeeds live state: your subgraphs, webhooks, chain tips
Docs as MarkdownNeeds a page, an endpoint or the whole site as text

Every docs page is plain text for an agent, with no HTML to strip.

URLHolds
/llms.txtShortest path, products, and a link to every page
/llms-api.txtEvery endpoint as a Markdown URL
/llms-full.txtEvery guide in one file
/docs/<page>.mdAny docs page, as Markdown
/docs/api-reference/<anchor>.mdOne endpoint or object from the API reference

Page twins end with a Notes for agents section: the rules an agent must follow on that page.

Edit on GitHub

Quick Start

Copy this prompt into your agent.

Set up Secondlayer Index in this project. It reads Stacks chain data, decoded, from block 1.

1. Install `@secondlayer/sdk` with the project's package manager. If a release-age policy blocks the install, stop and ask me instead of changing it.
2. Ask me for a Secondlayer API key (`sk-sl_...`, from https://www.secondlayer.tools/signin) and put it in `.env` as `SECONDLAYER_API_KEY`. Never commit it. If I self-host, use `INSTANCE_TOKEN` and my instance URL instead. Until I give you one, read with a free trial key: `curl -X POST https://api.secondlayer.tools/api/public/trial-key` returns `{ key }`, read-only for Streams and Index, good for 24 hours and 100,000 rows. Keep it out of git too.
3. Add a note to `AGENTS.md`, creating it if needed: before using Secondlayer, follow the secondlayer skill if it's installed, and read https://www.secondlayer.tools/llms.txt. Before writing code, read https://www.secondlayer.tools/docs/index.md. Any docs page opens as Markdown when you add `.md` to its URL.
4. If you support skills, run: `bunx skills add ryanwaits/secondlayer --skill secondlayer -y`