agentleFS
algorand-devrelalgorand-devrel/algorand-agent-skills/skills/algorand-core/SKILL.md

algorand-core

Skill33 starsChanged 10 months agoMITView on GitHub

Foundational mental model for the Algorand Virtual Machine (AVM). Use when encountering AVM concepts, stack machine questions, resource limit errors, opcode budget issues, program size problems, or constraint errors. Use when an agent defaults to PyTEAL, Beaker, or raw TEAL. Read BEFORE writing any smart contract code. Covers the two-type system (uint64/bytes), compilation from TypeScript/Python to TEAL, hard resource limits, and common LLM anti-patterns.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read this before writing any contract code.

    line 8
  2. Distinctive:

    Use native types for internal logic (more efficient).

    line 26

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

Algorand Core: The AVM Mental Model

Read this before writing any contract code.

The AVM Is Not What You Think

The AVM is a stack machine with two fundamental data types: uint64 and bytes. No heap, no GC, no objects, no dynamic dispatch, no closures, no exceptions, no standard library.

When you write contracts in TypeScript or Python, you are not writing TypeScript or Python. You are writing AVM programs using TS/Python syntax. The Puya compiler translates a strict subset of the language into TEAL bytecode. Any feature that doesn't map to AVM operations fails at compile time.

Types

At the AVM level, every value is uint64 or bytes (max 4096 bytes). However, the SDKs and AVM provide richer abstractions:

AVM reference types — The AVM natively supports Account, Asset, and Application via dedicated opcodes (acct_params_get, asset_holding_get, app_params_get, etc.). These are passed to contracts via foreign arrays and resolved by index at runtime.

ARC-4 encoded types — The ARC-4 ABI standard defines high-level types encoded as bytes: Bool, UInt8–UInt512, UFixedNxM (fixed-point decimals), String, DynamicBytes, Address, StaticArray, DynamicArray, Struct, and Tuple. The SDKs provide these via the arc4 module.

SDK native types — Both SDKs provide native types that compile to efficient AVM operations: UInt64/uint64, Bytes/bytes, BigUInt/biguint, String/string, Account, Asset, Application, Boolean/bool, plus storage types (GlobalState, LocalState, Box, BoxMap).

Use native types for internal logic (more efficient). Use ARC-4 types for ABI method parameters/returns, storage, and cross-contract interfaces. The compiler auto-converts between native and ARC-4 types at ABI boundaries.

Compilation Pipeline

Algorand TypeScript (.algo.ts)  ──┐
                                  ├──→  Puya Compiler  ──→  TEAL  ──→  AVM Bytecode
Algorand Python (algopy)        ──┘

Contract code (.algo.ts / algopy modules) compiles to TEAL. Test/deploy code is normal TS/Python. Never mix these — see language-subset-model.md.

Critical Limits

ResourceLimitNotes
Opcode budget700 per app callPooled across group (max 11,200; up to 190,400 with inner txn pooling)
Program size2048 bytes per pageMax 4 pages = 8192 bytes total
Transaction group16 transactionsAtomic — all succeed or all fail
Inner transactions256 pooled across groupMax depth 8 levels
Global state64 key-value pairsKey + value ≤ 128 bytes combined
Local state16 key-value pairs per accountKey + value ≤ 128 bytes combined
Box storage32,768 bytes per boxMBR: 2,500 + 400 × (name + value length) µAlgo; 2,048 bytes I/O per box ref
Log output32 calls, 1024 bytes totalPer app call
Min transaction fee1000 microAlgoFee pooling within groups

Full limits with MBR formulas: avm-resource-limits.md

Rules

  • NEVER use PyTEAL, Beaker, or raw TEAL — use Algorand TypeScript or Algorand Python
  • Two fundamental types — uint64 and bytes at the AVM level; SDKs provide higher-level abstractions (ARC-4 types, reference types) that compile down to these
  • Hard limits are hard — no clever code bypasses opcode budget or program size limits
  • No re-entrancy — applications cannot call themselves, even indirectly through inner transactions
  • Contract code is not normal code — .algo.ts / algopy compiles to TEAL; test/deploy files are normal TS/Python
  • Read the language skill next — algorand-typescript or algorand-python for syntax and patterns

Reference Guide

TopicFileWhen to Read
Execution modelavm-execution-model.mdHow programs run, budget pooling, program structure
Resource limitsavm-resource-limits.mdHitting limits, planning storage, MBR calculations
Language subsetlanguage-subset-model.mdCompiler errors, "can I use X?", compilation boundary
LLM mistakescommon-llm-mistakes.mdDebugging, code review, avoiding anti-patterns

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.