Skip to content

OffchainLabs/arbitrum-docs / .agents/skills/arbitrum-best-practices

arbitrum-best-practices

Verified

Arbitrum L2 development best practices. Use when implementing bridges, Orbit chains, SDK integrations, or debugging cross-chain transactions. Triggers on Arbitrum, L2, rollup, bridge, retryable, Orbit, Nitro, or cross-chain contexts.

rules/security-bridge-validation.md

View on GitHub
---
title: Validate All Bridge Inputs
impact: HIGH
impactDescription: prevents loss of funds
tags: security, bridge, validation
---

## Validate All Bridge Inputs

Bridge operations handle user funds across chains. Validate addresses, amounts, and registration status before executing—failures can mean permanent fund loss.

**Incorrect (no validation):**

```typescript
// Bad: Direct bridge call without validation
await bridger.deposit({ erc20L1Address: token, amount, destinationAddress: to })
// Risk: Invalid address, unregistered token, insufficient balance
```

**Correct (validate before bridging):**

```typescript
// Good: Validate all inputs before bridge operation
if (!isAddress(to) || to === ZeroAddress) throw new Error('Invalid recipient')

const gateway = await bridger.getL1GatewayAddress(token, l1Provider)
if (gateway === ZeroAddress) throw new Error('Token not registered')

const balance = await tokenContract.balanceOf(sender)
if (balance < amount) throw new Error('Insufficient balance')

await bridger.deposit({ erc20L1Address: token, amount, destinationAddress: to })
```

| Validation | Risk if Skipped |
|------------|-----------------|
| Recipient address | Permanent fund loss |
| Token registration | Stuck in limbo |
| Balance/allowance | Failed tx, wasted gas |
| Refund addresses | Funds to wrong party |

For cross-chain security, see [Token Bridging](https://docs.arbitrum.io/build-decentralized-apps/token-bridging/token-bridge-erc20).
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 197kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall