All skills

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.

Use this Skill: https://skilld.dev/gh/algorand-devrel/algorand-agent-skills/algorand-core

This session only. Nothing lands on disk.

referenceslanguage-subset-model.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Language Subset Model

You are writing AVM programs in TypeScript/Python syntax. The Puya compiler translates a strict subset into TEAL opcodes. If a feature doesn't map to AVM operations, it won't compile.

What the AVM Does NOT Have

Missing Feature Implication
Heap / dynamic memory No new, no dynamic arrays, no growing collections
Floating-point numbers Use fixed-point math (multiply by 10^n)
Signed integers Check a > b before a - b to avoid underflow
Null / undefined / None Use .exists checks on state, or maybe() pattern
Objects / classes Use ARC-4 structs (compile to byte-encoded tuples)
Dynamic dispatch All call targets resolved at compile time
Closures / lambdas Use module-level functions only
Recursion Use loops instead (no call stack)
Exceptions / try-catch assert fails the entire program; validate inputs first
Async / await Synchronous execution only
Standard library No Math, Array.map, json, re — use AVM opcodes
String manipulation bytes only — use Bytes, String from SDK
Generics (custom) Only SDK-provided generics work (BoxMap<K,V>, GlobalState<T>)
npm/pip imports Only @algorandfoundation/algorand-typescript or algopy

What DOES Compile

Feature Notes
Integer arithmetic (+, -, *, /, %) Unsigned uint64, overflow fails
Byte operations (concat, extract, len) Max 4096 bytes per value
Comparison and boolean operators Standard ==, !=, <, >, &&, ||, !
If/else, for/while loops Watch opcode budget with large iterations
Functions (callsub/retsub) No recursion, no closures
ARC-4 structs and arrays Fixed-layout byte-encoded tuples
Global/Local state, Box storage Key-value with size limits
Inner transactions Create txns from within contracts
ABI methods Standard contract interfaces
Constants and type assertions Compiled inline / compile-time only

Key Restrictions

Numbers

  • TypeScript: uint64 type, Uint64() constructor. Never use number or bigint in contracts.
  • Python: UInt64 from algopy. Never use Python int for on-chain values.
  • No negatives, no floats. Overflow fails. Division truncates.

Strings and Bytes

  • TypeScript: string / bytes (AVM types). Not JavaScript String.
  • Python: String / Bytes from algopy. Not Python str / bytes.
  • Max 4096 bytes per value. No regex, no Unicode processing.

Data Structures

  • No Map, Set, dict, list. Use BoxMap for key-value, StaticArray/DynamicArray for sequences.
  • TypeScript: Must clone() complex types before mutation — value semantics, not reference semantics.

The Compilation Boundary

Contract Code Client / Test / Deploy Code
Files .algo.ts / algopy modules Regular .ts / .py files
Runtime AVM (on-chain) Node.js / Python (off-chain)
Language Strict subset Full language
Types uint64, bytes, ARC-4 types Any type
Imports SDK only Any package

Never mix these. Contract code cannot import npm/pip packages. Client code cannot use AVM types directly. The typed client (from ARC-56 app spec) bridges the boundary.

Source: SKILL.md on GitHub

No alerts16d3 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill provides comprehensive documentation and best practices for developing smart contracts on the Algorand Virtual Machine (AVM). It contains technical reference material and guidelines for avoiding common developer errors. No malicious patterns or security vulnerabilities were detected.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

Signed by skilld at 774f8a8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 3 weeks ago.

Activeupdated 6 months ago

README badge

README badge for algorand-devrel/algorand-agent-skills/algorand-core