Skip to content

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

Install NPL-Dev in VS Code

Or manually:

  1. Open VS Code
  2. Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X)
  3. Search for "NPL-Dev" in the marketplace
  4. Click Install on the NPL-Dev for VS Code extension

2. Enable AI instructions

  1. After installing NPL-Dev, VS Code will prompt you with a message asking if you want to use the AI rules file
  2. Click "Yes" to enable AI instructions for NPL development
  3. 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

  1. Open GitHub Copilot Chat (Ctrl+I or Cmd+I)
  2. Start requesting NPL code - the AI instructions are already configured to generate proper NPL

Setup with Cursor

1. Install the NPL-Dev extension

Install NPL-Dev in Cursor

Or manually:

  1. Open Cursor
  2. Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X)
  3. Search for "NPL-Dev" in the marketplace
  4. Click Install on the NPL-Dev for VS Code extension

2. Enable AI instructions

  1. After installing NPL-Dev, Cursor will prompt you with a message asking if you want to use the AI rules file
  2. Click "Yes" to enable AI instructions for NPL development
  3. 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

  1. Open a new chat with your AI assistant (Cmd+L or Ctrl+L)
  2. 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:

Copy AI instructions

For Claude Code

If you're using Claude Code, you can create or append to a CLAUDE.md file in your project:

  1. Copy the AI instructions using the button above
  2. Create a new file named CLAUDE.md in your project root (or append to an existing one)
  3. Paste the instructions into the file
  4. Claude Code will automatically use these instructions when working in your project

For other AI assistants

  1. Start a new conversation with your AI assistant
  2. Paste the instructions as your first message
  3. 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