
In this three-part series, we will explore ICP Ninja - an innovative web-based development environment that changes the way developers build and deploy applications on the Internet Computer.
This article focuses on the AI assistant of ICP Ninja and how it enhances the development experience by helping to explain, fix, and optimize code. We will demonstrate how this powerful tool simplifies the development process for both novice and experienced developers through practical examples.
To learn more about ICP Ninja, read our article 'ICP Ninja: Your Internet Computer Dojo'. For detailed information about the latest platform enhancements, check out our first article 'ICP Ninja Update: Unleashing the Coulomb Milestone', which covers project sharing, authentication options, and cross-chain functionality.
Today, we are excited to reveal how the integrated AI assistant in ICP Ninja is transforming the development experience for Internet Computer developers. This article explores the powerful AI features recently added to ICP Ninja as part of the Coulomb milestone, showcasing how this intelligent assistant can be your personal coding partner.
What is ICP Ninja?
ICP Ninja is a web-based development environment designed to make developing and deploying dapps on ICP fun, fast, and educational. Simply choose from a range of example projects or start a new project, and begin building your dapp directly in your web browser.
As part of the Coulomb milestone, the new features offered by ICP Ninja include:
Enhance developer productivity: Container logs, real-time project compile logs, and a brand new code editor provide developers with tools to enhance productivity in an environment that looks and feels similar to other popular IDEs.
AI Learning Assistant: Trained with specialized ICP documentation and developer resources, the AI learning assistant can answer questions about ICP, explain container code, and even fix and modify code.
Project sharing and exporting projects: Showcase your creations by sending direct links to your code to others, or save your project to a new GitHub repository.
Log in with Internet Identity or GitHub and save projects: Log in with your chosen account, save your progress, and start developing from any device and location.
ICP AI Learning Assistant
ICP Ninja has launched a brand new ICP AI learning assistant that not only answers questions and provides resource links for further reading but also serves as a personal coding assistant. You can ask it to help modify, fix, or explain code snippets, and you can even prompt it to improve your code, ensuring that your project is optimized and adheres to best practices.
To learn more, let's look at how AI can assist through the following Counter dapp example:

Explain code
In ICP Ninja, right-click on the code you want AI to interact with and select 'Ask AI - Explain'. For the code example above, the AI will return the following explanation:

This explanation not only breaks down the structure and functionality of the code but also provides important resource links for further reference. It also highlights key features demonstrated by the code, including orthogonal persistence, stable variables, and query and update calls.
Fix code
If your code has errors, such as undefined participants, you can prompt the AI to fix the code by selecting 'Ask AI - Fix'. The AI will return a correctly compiled fixed version and then explain the changes:

Improve code
When you ask the AI to improve the code, it modifies the code to follow best practices and applies any applicable optimizations. Optimizations may include using query calls instead of update calls for speed and cost efficiency or compressing multiple functions into one for improved code efficiency.
For the counterexample shown above, when prompted with 'Ask AI - Improve', the AI suggests the following improvements:

Modify this code
Finally, you can ask the AI learning assistant to modify code by selecting 'Ask AI - Modify', then input a prompt specifying how you want the code changed. For example, you can ask the AI, 'Modify the code to start the counter at 100 and increase the counter by 10.' The AI will return the modified code:

ICP Ninja AI Example Project
The AI learning assistant is not the only AI application on ICP Ninja. The platform has now launched a new example project, an AI chatbot, which uses the Ollama model, providing you with a starting point to customize and create your own AI applications.
You can customize the robot's name and icon, or program the robot to respond to specific prompts.
This example project showcases decentralized AI (DeAI) on ICP, where container smart contracts can directly interact with language learning models running on or off the chain. AI applications hosted on ICP feature tamper-proof, verifiable, and unstoppable characteristics. Other AI examples deployed on the chain include facial recognition examples and image classification examples.
Start with the LLM chatbot example, available in Motoko or Rust!

Start development
Start building ICP dapps on ICP Ninja, check the developer documentation, or learn more about decentralized AI on ICP.
You can also view the complete details of the Coulomb milestone:
internetcomputer.org/roadmap#Developer%20Experience-Coulomb

IC content you care about
Technical Progress | Project Information | Global Activities

Follow the IC Binance channel
Stay updated with the latest news