agentleFS
rylsherdamz-rgbrylsherdamz-rgb/stellar-forge/skills/dapp/SKILL.md

dapp

Skill17 starsChanged 2 months agoMITView on GitHub

Stellar dApp / frontend development. Covers javascript stellar-sdk, Stellar Wallets Kit, and the agentic kit data layer — useStellarData(), useContract(), useStellarWallet(). No raw RPC or curl.

1 other project uses a version of this.

Adopted by

Most recently taken up by

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:

    All blockchain queries go through useStellarData().

    line 9
  2. Very specific:

    All examples live in templates/frontend/examples/ — reference them directly when generating code

    line 154

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

dApp — Agentic Kit Frontend

All blockchain queries go through useStellarData(). Never write raw RPC or curl.

Wallet Setup (one-time)

// providers/wallet-provider.tsx
import { WalletProvider } from "@/providers/wallet-provider";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <WalletProvider>
      {children}
    </WalletProvider>
  );
}

Hooks API

useStellarData() — Blockchain queries

import { useStellarData } from "@/hooks/use-stellar-data";

const {
  getBalances,     // (address: string) => { asset, balance }[]
  queryContract,   // (id: string, method: string, args: ScVal[]) => ScVal | null
  getContractData, // (id: string, key: ScVal) => ScVal | null
  getEvents,       // (id: string, limit?: number) => Event[]
  getTransaction,  // (hash: string) => TxResponse | null
  loading,         // boolean
  error,           // string | null
  rpc,             // raw RPC client (fallback only)
} = useStellarData();

useContract(contractId) — Contract read/write

import { useContract } from "@/hooks/use-contract";

const c = useContract("CA3...");
await c.read("name");                              // simulation-only, no tx
await c.read("balance_of", [addressArg]);          // any read method
await c.write(sender, "transfer", args, signFn);   // full sign+submit
// c.data exposes the underlying useStellarData()

useStellarWallet() — Wallet connection + data

import { useStellarWallet } from "@/hooks/use-stellar-wallet";

const {
  address,      // string | null
  network,      // string | null
  connect,      // () => Promise<void>
  disconnect,   // () => void
  sign,         // (xdr: string) => Promise<string>
  getBalances,  // () => Promise<{asset, balance}[]>
  data,         // useStellarData()
} = useStellarWallet();

useWallet() — From WalletProvider context

import { useWallet, useContract, useStellarData } from "@/providers/wallet-provider";

const { address, sign, data, getBalances } = useWallet();
// Same as useStellarWallet() but from context — no need to call connect()

Source Files (published with this skill)

FileLocationContents
Hook sourcehooks/use-stellar-data.tsgetBalances, queryContract, getContractData, getEvents, getTransaction
Hook sourcehooks/use-contract.tsread() (simulation), write() (sign+submit)
Hook sourcehooks/use-stellar-wallet.tsconnect, disconnect, sign, getBalances
Providerproviders/wallet-provider.tsxReact context + useWallet() export
Componentscomponents/connect-button.tsxConnect + disconnect + XLM balance badge
Componentscomponents/invoke-contract.tsxRead/write any contract method from UI
Componentscomponents/send-payment.tsxSend XLM with balance refresh after send
Configlib/stellar-config.tsRPC config, network config, helper ScVal functions
Examplesexamples/use-stellar-data-example.tsxBalanceViewer, ContractReader, EventList, UsdcBalance, XlmBalanceBadge
Examplesexamples/dashboard-page.tsxFull dashboard layout with ConnectButton + InvokeContract

Working Examples

Balance viewer

function Balances({ address }: { address: string }) {
  const { data } = useWallet();
  const [bals, setBals] = useState<{asset:string,balance:string}[]>([]);
  useEffect(() => { data.getBalances(address).then(setBals); }, [address]);
  return <ul>{bals.map(b => <li key={b.asset}>{b.asset}: {b.balance}</li>)}</ul>;
}

Contract name reader

function ContractName({ id }: { id: string }) {
  const { read } = useContract(id);
  const [name, setName] = useState("...");
  useEffect(() => { read("name").then(r => r && setName(scvalToString(r))); }, [id]);
  return <p>{name}</p>;
}

Contract write + balance refresh

function Transfer({ id, to }: { id: string; to: string }) {
  const { address, sign } = useWallet();
  const { write } = useContract(id);
  const [status, setStatus] = useState("");

  async function handleTransfer() {
    if (!address) return;
    setStatus("sending...");
    const res = await write(address, "transfer", [
      addressToScVal(address), addressToScVal(to), i128ToScVal(100_000_000n)
    ], sign);
    setStatus(`done: ${res.hash}`);
  }

  return <button onClick={handleTransfer}>{status || "Transfer 100 USDC"}</button>;
}

Event list (recent 5)

function Events({ id }: { id: string }) {
  const { data } = useWallet();
  const [events, setEvents] = useState<any[]>([]);
  useEffect(() => { data.getEvents(id).then(setEvents); }, [id]);
  return <ul>{events.slice(0,5).map((e,i) => <li key={i}>{e.type}</li>)}</ul>;
}

Strict Rules

  1. useStellarData() for every blockchain query — no fetch(), no curl, no raw RPC
  2. useContract().read() for simulation-only reads (zero fees, no wallet prompt)
  3. useContract().write() for state-changing calls (handles sim + assemble + sign + submit + confirm)
  4. For raw RPC access (rare): use data.rpc.* only when none of the above methods fit
  5. All examples live in templates/frontend/examples/ — reference them directly when generating code

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.