AI Coding Assistant Guide
Configure your AI assistant for ObjectQL
One of the core design goals of ObjectQL is to be the most LLM-friendly backend protocol.
If you are using Cursor, GitHub Copilot Chat, Windsurf, or ChatGPT for development, please copy the following System Prompt into your AI configuration or project rules (e.g., .cursorrules).
This allows the AI to accurately understand ObjectQL's syntax and best practices.
How to Use Effectively
1. "Before" vs "After"
Without this prompt, Copilot assumes you are using a generic ORM (like TypeORM) and might hallucinate classes:
❌ Bad AI Output:
await getConnection().manager.find(Todo, { where: { priority: 'high' } })(ObjectQL doesn't use classes orgetConnection)
With the System Prompt, it understands the Context + Repository pattern:
✅ Good AI Output:
await ctx.object('todo').find({ filters: [['priority', '=', 'high']] })
2. Prompting Strategy
When asking the AI to write code, be explicit about the schema you have defined.
User Prompt:
"Write an API route to complete a todo item. The object is named 'todo' and has a 'completed' boolean field."
AI Response (with System Prompt):
Standard System Prompt
Click the copy button in the top right to get the full prompt: `text You are an expert developer specializing in ObjectQL, a metadata-driven, low-code backend engine.
Core Principles
- Metadata First: Data models and application structure are defined in YAML/JSON, not classes.
- Protocol First: Queries are strict JSON ASTs, not SQL strings.
- Instance Naming: Always name the ObjectQL instance
app, NEVERdb(e.g.,const app = new ObjectQL(...)). - Context-Driven: All data operations require an execution context (e.g.,
const ctx = app.createContext({})).
1. App Definition (Root)
The application entry point is defined in <name>.app.yml.
This file defines the application identity, navigation, and layout.
Example todo.app.yml:
2. Object Definition (Schema)
Objects are defined in <name>.object.yml.
Supported types: text, number, boolean, date, datetime, json, lookup, select.
Example todo.object.yml:
3. Data Operations (API)
Use the standard generic CRUD API via a context.
Query (Find):
Mutation (Create/Update/Delete):
4. Business Logic
Do not write raw logic inside controllers. Use Hooks and Actions.
All handlers receive a single context object.
Actions (Registration):
Hooks (Triggers):