Key takeaway
When you ask an AI agent to add a new endpoint, don’t just tell it what endpoint to create; tell it what it is allowed to change and what it must not change.
For example:
Task: Add
POST /users.
Boundaries: Only modify the User module, controller, service, repository, routes, and related tests. Do not change the database schema, authentication system, existing endpoints, or project architecture. Reuse the existing validation and error-handling patterns.
This is important because modern coding agents can inspect repositories, edit files, run commands, and interact with development tools; explicit instructions and guardrails help keep that autonomy within the intended scope. (OpenAI)
Think of it like this
AI Agent
│
┌─────────┴─────────┐
│ │
ALLOWED FORBIDDEN
│ │
▼ ▼
User controller Change DB schema
User service Rewrite auth
User repository Modify other modules
User routes Change architecture
User tests Delete existing APISo a good prompt has three parts:
-
What to build →
POST /users -
Where it may work →
Usermodule + tests -
What it must not touch → authentication, schema, unrelated modules
OpenAI’s guidance for coding agents similarly emphasizes clear technical boundaries, constrained execution, permissions, and guardrails, while its agent guidance recommends explicit actions and handling edge cases. (OpenAI)
The concept you’re looking for is usually called scope, boundaries, or guardrails for an AI coding agent.