new
npx machina-cli add skill HCS412/contractkit/new --openclawContractKit: New Project
Scaffold a new smart contract project from a template.
Process
1. Gather Requirements
Ask the user for the following (use defaults if not specified):
| Parameter | Default | Options |
|---|---|---|
| Blueprint | erc20 | erc20, erc721, escrow, vault |
| Project name | Required | Any valid name |
| Token symbol | Required for erc20/erc721 | 3-5 uppercase letters |
| Output directory | ./contractkit-projects/<slug> | Any path |
2. Create Project
- Create output directory
- Copy template from
plugins/contractkit/templates/<blueprint>/ - Replace placeholders in all files:
{{PROJECT_NAME}}→ project name{{PROJECT_SLUG}}→ lowercase slug{{TOKEN_NAME}}→ project name (for tokens){{TOKEN_SYMBOL}}→ token symbol
3. Initialize Project
cd <project_directory>
forge install OpenZeppelin/openzeppelin-contracts --no-commit
forge install foundry-rs/forge-std --no-commit
4. Verify
forge fmt
forge build
forge test
If tests fail, diagnose and fix before completing.
5. Report Success
Print:
- Project location
- Next steps:
cd <project> /contractkit:test # Run tests /contractkit:local # Start local chain /contractkit:deploy local # Deploy locally
Example Usage
User: /contractkit:new
Response: "What blueprint would you like? (erc20, erc721, escrow, vault)"
User: "erc20"
Response: "What's the project/token name?"
User: "MyToken"
Response: "What's the token symbol? (e.g., MTK)"
User: "MTK"
Then execute the process above.
Template Locations
Templates are in the plugin directory:
plugins/contractkit/templates/erc20/plugins/contractkit/templates/erc721/plugins/contractkit/templates/escrow/plugins/contractkit/templates/vault/
Placeholder Reference
| Placeholder | Replaced With |
|---|---|
{{PROJECT_NAME}} | User's project name |
{{PROJECT_SLUG}} | Lowercase, hyphenated slug |
{{TOKEN_NAME}} | Token name (same as project name) |
{{TOKEN_SYMBOL}} | User's symbol (uppercase) |
Source
git clone https://github.com/HCS412/contractkit/blob/main/plugins/contractkit/skills/new/SKILL.mdView on GitHub Overview
Scaffold a new smart contract project by selecting a blueprint (erc20, erc721, escrow, vault), naming the project, and applying placeholders. It copies the chosen template, applies project-specific identifiers, and prepares a Forge-based workflow with dependencies.
How This Skill Works
Choose a blueprint and provide required details (project name, token symbol, output directory). The tool copies the corresponding template from plugins/contractkit/templates/<blueprint>/ and replaces placeholders such as {{PROJECT_NAME}}, {{PROJECT_SLUG}}, {{TOKEN_NAME}}, and {{TOKEN_SYMBOL}}. Finally, initialize dependencies with Forge and verify the setup with forge fmt, forge build, and forge test.
When to Use It
- Starting a brand-new contract project from a standard template (erc20, erc721, escrow, vault).
- Creating a token or NFT project by supplying a project name and symbol.
- Onboarding a team to a consistent scaffolding workflow with placeholder-based templates.
- Setting up a local Forge workflow by installing dependencies and running fmt, build, and tests.
- Generating a ready-to-run skeleton for demonstrations or quick deployments.
Quick Start
- Step 1: Gather requirements (blueprint, project name, token symbol, output dir).
- Step 2: Copy the selected template and replace placeholders ({{PROJECT_NAME}}, {{PROJECT_SLUG}}, {{TOKEN_NAME}}, {{TOKEN_SYMBOL}}).
- Step 3: Initialize dependencies and verify (forge install; forge fmt, forge build, forge test).
Best Practices
- Define required inputs up front (blueprint, name, symbol, output dir) before starting.
- Validate required fields (project name, symbol for tokens) to ensure template replacements succeed.
- Use descriptive PROJECT_NAME and PROJECT_SLUG to keep identifiers clear.
- Run forge fmt, then forge build and forge test to catch issues early.
- Document the final project location and next steps after scaffold completes.
Example Use Cases
- Scaffold ERC20 project named MyToken with symbol MTK.
- Create ERC721 project named ArtToken with symbol ART.
- Set up an escrow contract scaffold for a payment workflow.
- Generate a vault template for asset custody.
- Create a new contract kit project skeleton for demos.