One of the fastest ways to build a Gadget application is by using AI to assist with writing code. When building, iterating on, or debugging applications using AI tools and Large Language Models (LLMs), a well-structured and extensive prompt helps provide the model with clearer guidelines and examples that can dramatically improve output.
Using AI agents with Gadget
Gadget provides several ways to use AI effectively:
Built-in Gadget assistant: Great for data modeling and app scaffolding. Use it in the Gadget editor to create models, set up relationships, and scaffold your application structure.
Local development with ggt: Use ggt dev to bring your project down locally, then use Cursor, Claude Code, or other AI-powered editors to write frontend and backend code.
Quick tips
Be explicit: If known, tell the assistant exactly what you want it to output and in which format. It is best to tell the assistant what you want instead of what not to do.
Give context: Include the purpose, audience, and any constraints.
If known, use Gadget vocabulary: use models (Postgres tables under the hood), actions (API endpoints), and background actions (background jobs). This helps the assistant map intent to Gadget concepts.
Clear context regularly: If the assistant is not providing the expected output, clear the context or start a new chat, and try again.
Providing Gadget-specific context
AI editors like Cursor allow you to index documentation.
You can also provide the following as context by copy-pasting the raw markdown or URLs:
Documentation context: Each documentation page has a "Copy as Markdown" button that you can use to provide context to AI assistants. You can also access any docs page as markdown by appending .md to the URL. For example, /guides/models/overview.md.
llms.txt file: Gadget provides https://gadget.dev/llms.txt with comprehensive information about the platform.
Recommended workflow
Start with the built-in assistant: Use Gadget's built-in AI assistant in the editor to scaffold your app, create models, and set up your initial data structure.
Bring it down locally: Run ggt dev to sync your project to your local machine.
Use your preferred AI editor: Open the project in Cursor, Claude Code, or another AI-powered editor to write and refine your frontend and backend code with full context of your project structure.
Make sure to use source control to track your changes and version your code.
Additional resources
We recommend reading the following guides to learn more about prompting AI agents:
Even if the assistant generates code, human review is essential. Check for correctness, security, and adherence to your team's standards
before deploying to production.