AI Agents
Using AI tools effectively with ReadyKit.
Overview
ReadyKit is designed to work seamlessly with AI-powered development tools like Cursor, Claude Code, and GitHub Copilot. The codebase follows consistent patterns that AI assistants can understand and replicate.
Project Instructions
AGENTS.md at the repository root is the instruction file every coding agent reads. It is the single source of truth: update it when the architecture changes.
It covers:
- Project architecture overview
- Multi-tenant patterns and conventions
- Workspace-scoped model examples
- Route protection patterns
- Database query conventions
- Billing integration details
- The checks to run before work is reported as done
Key Patterns for AI Prompts
When asking AI assistants to help with ReadyKit, reference these patterns:
Creating Workspace-Scoped Features
"Create a new [Feature] model that belongs to workspaces,
with CRUD routes using @require_workspace_access decorator"The AI should generate:
- Model with
WorkspaceScopedmixin - Routes with workspace_id parameter
- Proper decorator usage
- Workspace-scoped queries
Route Protection
"Add a route for [action] that only workspace admins can access"Expected pattern:
python
@app.route("/workspace/<int:workspace_id>/admin-action/")
@require_workspace_access("admin")
def admin_action(workspace_id):
workspace = g.current_workspace
# ...Database Queries
"Query [Model] filtered by current workspace"Expected pattern:
python
from enferno.services.workspace import workspace_query
stmt = workspace_query(Model).where(Model.status == "active")
results = db.session.scalars(stmt).all()Project Conventions
When working with AI assistants, these conventions should be followed:
File Organization
| Type | Location |
|---|---|
| Models | enferno/user/models.py or new enferno/[feature]/models.py |
| Routes | enferno/portal/views.py or enferno/api/ |
| Services | enferno/services/ |
| Templates | enferno/templates/ |
| Static files | enferno/static/ |
Naming Conventions
- Routes:
snake_case(list_projects,create_project) - Models:
PascalCase(Project,ProjectComment) - Templates:
snake_casedirectories and files (projects/list.html) - URL patterns:
/workspace/<int:workspace_id>/[resource]/
Import Patterns
python
# Extensions
from enferno.extensions import db
# Services
from enferno.services.workspace import require_workspace_access, WorkspaceScoped
from enferno.services.billing import requires_pro_plan
# Models
from enferno.user.models import User, Workspace, Membership
# Flask utilities
from flask import g, render_template, redirect, url_for, flash, abort
from flask_security import current_user, auth_requiredTips for AI Assistants
If you're an AI assistant working with ReadyKit:
- Always scope data to workspaces - Use scoped helpers or explicit workspace filters. A foreign key and mixin alone do not filter ordinary queries.
- Use the decorator -
@require_workspace_access('member')or@require_workspace_access('admin') - Access workspace via
g- After the decorator, useg.current_workspace - SQLAlchemy 2.0 style - Use
db.select(),db.session.scalars(), not legacy Query API - Commit explicitly - Call
db.session.commit()after mutations