Coding in NPL with your favorite AI agent
This track provides guidance on how to enable AI assistants to write NPL code for you, enhancing your development workflow with intelligent code generation.
Example prompts
With the right setup, you can use natural language prompts to generate NPL code. Here are some examples of what you can ask your AI assistant to build:
Bike rental system
Build a bike rental system in NPL where customers can rent bikes from a rental shop.
The system should track the bike, rental period, and payment. Include permissions
so only the customer can initiate a rental and only the shop can confirm bike return.
Escrow service
Create an escrow protocol with a buyer, seller, and escrow agent. The buyer
deposits funds, the seller delivers goods, and the escrow agent releases payment
only after both parties confirm the transaction.
Subscription management
Build a subscription service protocol where subscribers can sign up for monthly
or yearly plans. Track subscription status, renewal dates, and payment history.
Include automatic expiration handling.
Getting started
To enable your AI assistant to generate correct NPL code, you need to provide it with AI instructions — a file containing NPL syntax rules, best practices, and guidelines. The setup process varies depending on your tool.
Setup with VS Code and GitHub Copilot
1. Install the NPL-Dev extension
Or manually:
- Open VS Code
- Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X)
- Search for "NPL-Dev" in the marketplace
- Click Install on the NPL-Dev for VS Code extension
2. Enable AI instructions
- After installing NPL-Dev, VS Code will prompt you with a message asking if you want to use the AI rules file
- Click "Yes" to enable AI instructions for NPL development
- The extension will automatically configure GitHub Copilot to use the NPL-specific instructions
Note
The prompt only appears when your workspace contains .npl files or a folder with a name starting with npl. Re-open the project to trigger the prompt again if needed.
3. Writing NPL code with GitHub Copilot
- Open GitHub Copilot Chat (Ctrl+I or Cmd+I)
- Start requesting NPL code - the AI instructions are already configured to generate proper NPL
Setup with Cursor
1. Install the NPL-Dev extension
Or manually:
- Open Cursor
- Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X)
- Search for "NPL-Dev" in the marketplace
- Click Install on the NPL-Dev for VS Code extension
2. Enable AI instructions
- After installing NPL-Dev, Cursor will prompt you with a message asking if you want to use the AI rules file
- Click "Yes" to enable AI instructions for NPL development
- The extension will automatically configure your AI assistant to use the NPL-specific instructions
Note
The prompt only appears when your workspace contains .npl files or a folder with a name starting with npl. Re-open the project to trigger the prompt again if needed.
3. Writing NPL code with Cursor
- Open a new chat with your AI assistant (Cmd+L or Ctrl+L)
- Start requesting NPL code - the AI instructions are already configured to generate proper NPL
In other tools
For AI tools outside of VS Code and Cursor, you can manually provide the AI instructions:
For Claude Code
If you're using Claude Code, you can create or append to a CLAUDE.md file in your project:
- Copy the AI instructions using the button above
- Create a new file named
CLAUDE.mdin your project root (or append to an existing one) - Paste the instructions into the file
- Claude Code will automatically use these instructions when working in your project
For other AI assistants
- Start a new conversation with your AI assistant
- Paste the instructions as your first message
- Request the NPL code you want to generate
Why use these instructions?
Using these specialized instructions ensures that:
- AI assistants generate syntactically correct NPL code
- Common pitfalls and mistakes are avoided
- Code follows NPL best practices and conventions
- NPL-specific constructs like protocols, parties, and permissions are used correctly