near-smart-contracts

Write, review, and deploy NEAR Protocol smart contracts in Rust.

14|3|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/near/agent-skills --skill near-smart-contracts
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: near-smart-contracts
Source: https://github.com/near/agent-skills/tree/main/skills/near-smart-contracts
Command: npx skills add https://github.com/near/agent-skills --skill near-smart-contracts

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a comprehensive, practical guide for developers to write, review, and deploy NEAR Protocol smart contracts in Rust, helping teams build secure and efficient on-chain programs.

Core Features & Use Cases

  • Guided contract development: from initialization to deployment with best practices for security, structure, and optimization.
  • Code review and auditing: checklists and patterns for cross-contract calls, state management, and gas optimization.
  • Use Case: When starting a new NEAR Rust contract, use these guidelines to design a robust contract architecture, implement storage patterns, and ensure security requirements are met.

Quick Start

Read the guide to begin structuring your Rust NEAR contract code and align with NEAR SDK patterns.

Frequently Asked Questions about near-smart-contracts

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a secure NEAR smart contract in Rust?

To structure a secure NEAR smart contract in Rust, apply guidelines covering contract architecture, state management, and security patterns aligned with the NEAR SDK. This approach ensures robust initialization and safe on-chain program deployment.

What are the best practices for cross-contract calls on the NEAR Protocol?

Best practices for cross-contract calls on NEAR involve using structured checklists and specific patterns to manage gas optimization and security. Following these guidelines prevents common vulnerabilities and ensures reliable cross-contract communication.

How do I test and audit NEAR Rust contracts for security vulnerabilities?

To test and audit NEAR Rust contracts, utilize provided checklists and security patterns to review state management and cross-contract calls. This process identifies potential vulnerabilities and verifies compliance with gas optimization standards.

Do I need the NEAR SDK and Rust tooling to build NEAR smart contracts?

Yes, you need the NEAR SDK for Rust and standard Rust tooling to build NEAR smart contracts. These dependencies are required to implement the structured rules for state management, testing, and security best practices.

How should I manage state and optimize gas in NEAR Rust contracts?

Manage state and optimize gas in NEAR Rust contracts by applying specific storage patterns and optimization rules from the development guide. This approach minimizes on-chain resource consumption while maintaining secure state integrity.