Create Aptos Project Skill
Purpose
Scaffold new Aptos projects using npx create-aptos-dapp. This is the mandatory first step when a user wants to
build any new Aptos app, dApp, or project — regardless of how they phrase it.
ALWAYS
- 1. Use
npx create-aptos-dapp to scaffold — NEVER create projects from scratch manually - Ask the user about project type, framework, and network before scaffolding
- Verify
.env is in .gitignore before any git operations - Use the same network for both
create-aptos-dapp and INLINECODE5 - Follow the full Build a dApp workflow after scaffolding (contracts, tests, audit, deploy, frontend)
NEVER
- 1. Skip scaffolding — even for "simple" projects, always start with INLINECODE6
- Create project structure manually — the boilerplate template handles this
- Display or read private keys — use
"0x..." as placeholder - Run
git add . or git add -A without first verifying .env is in INLINECODE11
Decision Tree
Before running the scaffold command, gather these inputs from the user:
1. Project Name
Derive from the user's description or ask directly. Use kebab-case (e.g., habit-tracker, nft-marketplace).
2. Project Type
| Option | When to Use |
|---|
| Fullstack (default) | User wants a frontend + smart contracts |
| Contract-only |
User only wants Move smart contracts (no frontend) |
3. Framework (fullstack only)
| Option | When to Use |
|---|
| Vite (default) | Default choice, lighter setup |
| Next.js |
User asks for Next.js or SSR |
4. Network
| Option | When to Use |
|---|
| devnet (default) | Development and testing |
| testnet |
Pre-production, user explicitly asks |
|
mainnet | Production, user explicitly asks |
5. API Key (optional)
Ask if the user has a Geomi API key. It's optional for devnet but recommended for testnet/mainnet to avoid rate limits.
Get one at https://geomi.dev (create project -> API Resource -> copy key).
Scaffolding Commands
CODEBLOCK0
Optional flags:
- -
--api-key <key> — Pass a Geomi API key during scaffolding - INLINECODE15 — Enable Surf for type-safe contract interactions
Post-Scaffold Checklist
After scaffolding, complete these steps in order:
- 1. INLINECODE16
- Verify
.env is in .gitignore before any git operations - Run
aptos init --network <network> --assume-yes (use the same network as above) - Verify: INLINECODE20
- INLINECODE21
Build a dApp Workflow
ALWAYS follow this workflow when the user wants to build a new Aptos app, dApp, or project. This applies regardless
of how the user phrases it ("build me a ...", "create a ...", "make a ...", "I want to build ...").
- 1.
/create-aptos-project -> scaffold with npx create-aptos-dapp (this skill — NEVER skip) - INLINECODE24 -> write Move modules
- INLINECODE25 -> create test suite, verify 100% coverage
- INLINECODE26 -> audit before deployment
- INLINECODE27 -> deploy contract to specified network
- INLINECODE28 -> orchestrates frontend integration (routes to ts-sdk-client, ts-sdk-transactions,
ts-sdk-view-and-query, ts-sdk-wallet-adapter as needed)
What the Boilerplate Includes
Fullstack Template
- -
contract/ — Move smart contract with Move.toml and starter module - INLINECODE31 — React app with Aptos wallet adapter pre-configured
- INLINECODE32 — Scripts for
move:compile, move:test, move:publish, dev, INLINECODE37 - INLINECODE38 — Environment variables for network, API key, and publisher account
Contract-Only Template
- -
contract/ — Move smart contract with Move.toml and starter module - INLINECODE41 — Scripts for
move:compile, move:test, INLINECODE44 - INLINECODE45 — Environment variables for network and publisher account
Troubleshooting
npx create-aptos-dapp command not found
CODEBLOCK1
If that still fails, verify Node.js and npm are installed (node -v && npm -v).
Compile failures after scaffold
- 1. Check
contract/Move.toml has correct named addresses - Run
aptos init --network <network> --assume-yes if not done - Verify
my_addr is set to "_" in [addresses] section
Named address errors
The boilerplate uses my_addr = "_" which gets resolved from .env at compile time. Ensure
VITE_MODULE_PUBLISHER_ACCOUNT_ADDRESS is set in .env (populated by aptos init).
创建Aptos项目技能
目的
使用 npx create-aptos-dapp 脚手架搭建新的Aptos项目。当用户想要构建任何新的Aptos应用、dApp或项目时,这是必须的第一步,无论用户如何表述。
始终遵循
- 1. 使用 npx create-aptos-dapp 搭建脚手架——绝不手动从零创建项目
- 在搭建前询问用户项目类型、框架和网络
- 在执行任何git操作前验证 .env 是否在 .gitignore 中
- 对 create-aptos-dapp 和 aptos init 使用相同的网络
- 搭建后遵循完整的构建dApp工作流程(合约、测试、审计、部署、前端)
绝对禁止
- 1. 跳过脚手架搭建——即使是简单项目,始终从 create-aptos-dapp 开始
- 手动创建项目结构——模板框架会处理这些
- 显示或读取私钥——使用 0x... 作为占位符
- 在未先验证 .env 是否在 .gitignore 中时运行 git add . 或 git add -A
决策树
在运行脚手架命令前,收集用户的以下输入:
1. 项目名称
从用户描述中推导或直接询问。使用短横线命名法(例如:habit-tracker、nft-marketplace)。
2. 项目类型
| 选项 | 使用场景 |
|---|
| 全栈(默认) | 用户需要前端 + 智能合约 |
| 仅合约 |
用户只需要Move智能合约(无前端) |
3. 框架(仅全栈)
| 选项 | 使用场景 |
|---|
| Vite(默认) | 默认选择,更轻量的设置 |
| Next.js |
用户要求Next.js或SSR |
4. 网络
| 选项 | 使用场景 |
|---|
| devnet(默认) | 开发和测试 |
| testnet |
预生产环境,用户明确要求 |
|
mainnet | 生产环境,用户明确要求 |
5. API密钥(可选)
询问用户是否有Geomi API密钥。devnet环境可选,但testnet/mainnet环境建议使用以避免速率限制。
在 https://geomi.dev 获取(创建项目 -> API资源 -> 复制密钥)。
脚手架命令
bash
使用Vite的全栈dApp(前端 + 合约)
npx create-aptos-dapp <项目名称> \
--project-type fullstack \
--template boilerplate-template \
--framework vite \
--network <网络>
使用Next.js的全栈dApp
npx create-aptos-dapp <项目名称> \
--project-type fullstack \
--template boilerplate-template \
--framework nextjs \
--network <网络>
仅合约(Move项目)
npx create-aptos-dapp <项目名称> \
--project-type move \
--network <网络>
可选标志:
- - --api-key <密钥> — 在搭建时传入Geomi API密钥
- --use-surf — 启用Surf以实现类型安全的合约交互
搭建后检查清单
搭建完成后,按顺序完成以下步骤:
- 1. cd <项目名称>
- 在执行任何git操作前验证 .env 是否在 .gitignore 中
- 运行 aptos init --network <网络> --assume-yes(使用与上述相同的网络)
- 验证:npm run move:compile && npm run move:test
- git init && git add . && git commit -m Initial commit
构建dApp工作流程
当用户想要构建新的Aptos应用、dApp或项目时,始终遵循此工作流程。 无论用户如何表述(帮我构建一个...、创建一个...、做一个...、我想构建...),此流程均适用。
- 1. /create-aptos-project -> 使用 npx create-aptos-dapp 搭建脚手架(此技能——绝不跳过)
- /write-contracts -> 编写Move模块
- /generate-tests -> 创建测试套件,验证100%覆盖率
- /security-audit -> 部署前进行安全审计
- /deploy-contracts -> 将合约部署到指定网络
- /use-ts-sdk -> 编排前端集成(根据需要路由到ts-sdk-client、ts-sdk-transactions、ts-sdk-view-and-query、ts-sdk-wallet-adapter)
模板包含内容
全栈模板
- - contract/ — 包含 Move.toml 和入门模块的Move智能合约
- frontend/ — 预配置Aptos钱包适配器的React应用
- package.json — 包含 move:compile、move:test、move:publish、dev、build 脚本
- .env — 网络、API密钥和发布者账户的环境变量
仅合约模板
- - contract/ — 包含 Move.toml 和入门模块的Move智能合约
- package.json — 包含 move:compile、move:test、move:publish 脚本
- .env — 网络和发布者账户的环境变量
故障排除
npx create-aptos-dapp 命令未找到
bash
自动确认npx包安装提示
npx --yes create-aptos-dapp <项目名称> ...
如果仍然失败,请验证Node.js和npm是否已安装(node -v && npm -v)。
搭建后编译失败
- 1. 检查 contract/Move.toml 中的命名地址是否正确
- 如果未执行,运行 aptos init --network <网络> --assume-yes
- 验证 [addresses] 部分中的 myaddr 是否设置为
命名地址错误
模板使用 myaddr = ,编译时会从 .env 解析。确保 .env 中设置了 VITEMODULEPUBLISHERACCOUNTADDRESS(由 aptos init 填充)。