Skip to content
Back to skills

003 Name Skill E25e6d7d

ASecurity

Syntax rules and patterns for Algorand TypeScript (PuyaTs) smart contracts. Use when writing TypeScript contract code, encountering Puya compiler errors, asking about AVM types or value semantics, needing guidance on storage patterns (GlobalState, BoxMap), or asking about clone(), arrays, or inner transactions. Strong triggers include "Puya compiler error", "How do I use uint64?", "What is clone() for?", "BoxMap not working", "AVM type error", "GlobalState not updating".

  • 11 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 10, 2026
developmentjavascripttypescriptgojava

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 10, 2026

npx -y skills add tools-only/X-Skills --skill 003-name-skill_e25e6d7d --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 003 Name Skill E25e6d7d?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 003 Name Skill E25e6d7d
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-003-name-skill-e25e6d7d/badge)](https://www.skillsdirectory.com/skills/tools-only-003-name-skill-e25e6d7d)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: algorand-typescript
description: Syntax rules and patterns for Algorand TypeScript (PuyaTs) smart contracts. Use when writing TypeScript contract code, encountering Puya compiler errors, asking about AVM types or value semantics, needing guidance on storage patterns (GlobalState, BoxMap), or asking about clone(), arrays, or inner transactions. Strong triggers include "Puya compiler error", "How do I use uint64?", "What is clone() for?", "BoxMap not working", "AVM type error", "GlobalState not updating".
---

# Algorand TypeScript Rules

Critical syntax rules for Algorand TypeScript (PuyaTs) that prevent compiler errors and runtime failures.

**File Extension**: Contract files must use `.algo.ts` extension (e.g., `Counter.algo.ts`).

## Overview / Core Workflow

1. Identify the syntax issue or pattern needed
2. Apply the correct AVM-compatible pattern
3. Use `clone()` for complex types
4. Verify no union types or JavaScript `number`

## How to proceed

1. **Check the most critical rules below**
2. **Consult detailed reference files** for specific topics
3. **Apply the correct pattern** with proper AVM types
4. **Build to verify**: `algokit project run build`

## Important Rules / Guidelines

### Numbers: No JavaScript `number`

```typescript
// CORRECT
const amount: uint64 = Uint64(20)
const total: uint64 = amount + Uint64(100)

// INCORRECT - Compiler error
const amount = 20
```

**Numeric limits**: Algorand TypeScript supports integers up to 2^512. Use `biguint` for values exceeding uint64 (2^64 - 1).

### Value Semantics: Always `clone()`

```typescript
import { clone } from '@algorandfoundation/algorand-typescript'

const state = clone(this.appState.value)     // Read: clone
const updated = clone(state)                  // Modify: clone
this.appState.value = clone(updated)          // Write: clone
```

### No Union Types

```typescript
// CORRECT - Use boolean flags
let found = false
let foundItem: Item = { /* defaults */ }

// INCORRECT - Compiler error
let foundItem: Item | null = null
```

### Arrays: Clone Before Iterating

```typescript
// CORRECT
for (const item of clone(array)) { }
```

## Common Variations / Edge Cases

| Topic | Rule |
|-------|------|
| Numbers | Use `uint64` + `Uint64()`, never `number` |
| Strings | No `.length`; use `text !== ''` for empty check |
| Storage | Clone on read AND write for complex types |
| Arrays | Clone before iterating; indices must be `uint64` |
| Classes | No class properties; use module-level constants |
| Methods | Public = ABI method; private = subroutine |

## References / Further Reading

Detailed rules by topic:

- [Types and Values](./references/types-and-values.md) — AVM types, numbers, clone(), value semantics
- [Storage](./references/storage.md) — GlobalState, LocalState, BoxMap, MBR funding
- [Methods and ABI](./references/methods-and-abi.md) — Decorators, lifecycle methods, visibility
- [Transactions](./references/transactions.md) — Group transactions (gtxn), inner transactions (itxn)
- [Full Reference Index](./references/REFERENCE.md)

Files in this skill

  • README.md922 B
  • skill.md3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.