TorbatYar/docs/ai-framework/prompt-rules.md
2026-07-28 20:39:10 +03:30

80 lines
4.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Prompt Rules
How every future AI phase prompt must behave.
## Core Rules
1. **Never duplicate permanent instructions.** Do not paste [master-prompt.md](master-prompt.md), Definition of Done, enterprise completeness checklists, project principles, or entire architecture docs into a phase prompt.
2. **Only describe the current phase.** Objective, Scope, Out of Scope, modules/services touched, completion criteria, and phase-specific constraints.
3. **Follow Runtime Read Policy.** Instruct the agent to follow [runtime-read-policy.md](runtime-read-policy.md); start from [`docs/project-status.yaml`](../project-status.yaml); do not duplicate document lists in phase prompts.
4. **Enterprise quality is automatic.** Do not ask whether to add health, permissions, tests, audit, events, OpenAPI, pagination, or other [mandatory-phase-artifacts.md](mandatory-phase-artifacts.md) — the framework already requires them when applicable.
5. **Enterprise Phase Discovery is automatic.** Agents must run [enterprise-phase-discovery.md](enterprise-phase-discovery.md) before Implementation — do not restate the full Discovery procedure in the phase prompt.
6. **Reference, dont rewrite.** Link to templates, gates, DoD, Discovery, and manifests instead of redefining them.
7. **No silent scope expansion.** Out of Scope must be explicit; agents must not implement adjacent or future phases ([boundary-rules.md](boundary-rules.md)).
8. **No business logic in framework prompts.** Framework docs stay process-only; phase prompts carry feature intent.
9. **Completion stops the agent.** After Discovery gaps closed + DoD + gates + handover + **Project Status update** are done, stop — do not start the next phase unless asked.
10. **CRUD is never enough.** Phase prompts must not imply that CRUD-only delivery completes a phase.
11. **Project Status is mandatory.** Every Complete phase must update [`docs/project-status.yaml`](../project-status.yaml) and [`docs/project-status.md`](../project-status.md) per `automatic_update_rules`. Agents must not full-project-scan when project-status exists. Prefer `execution_priority` / `critical_path` — never rely on deprecated `next_recommended_phase`.
## Required Phase Prompt Skeleton
```markdown
# Phase <ID> — <Title>
Follow [Runtime Read Policy](runtime-read-policy.md) — read [`docs/project-status.yaml`](../project-status.yaml) first.
Permanent framework rules live under `docs/ai-framework/` — link to them; do not paste ([prompt-rules.md](prompt-rules.md)).
## Objective
...
## Scope
...
## Out of Scope
(explicit; do not pull future phases forward)
## Required Templates
(list only those that apply: service/module/entity/repository/service-layer/api/event/testing/documentation)
## Completion Criteria
- Enterprise Phase Discovery completed (gaps promoted & closed)
- Business Analysis + Domain Modeling completed
- Mandatory phase artifacts delivered for this boundary
- Definition of Done satisfied (CRUD is not sufficient)
- Enterprise Completeness signed off
- Development loop completed
- Quality gates passed
- Phase handover completed
- Registries/manifests/progress/next-steps/**project-status** updated
- Stop after this phase only
```
## Forbidden Prompt Behaviors
- Re-stating Database-per-Service, tenancy, FE/BE, DoD, Discovery procedure, or completeness matrices in full (link instead)
- Asking to “also quickly do” the next phase
- Allowing TODO leftovers for claimed work
- Instructing agents to bypass quality gates or mark missing artifacts as “limitations”
- Overwriting accepted ADRs
- Treating CRUD as the definition of done
- Skipping Discovery or coding before the Discovery Record exists
- Waiving tenant isolation, audit, events, or tests for convenience
- Full-project scans or unrelated-service inspection when `docs/project-status.yaml` exists
- Completing a phase without updating Project Status
## When to Extend the Framework
If a permanent rule is missing, update `docs/ai-framework/` (and ADR if architectural) in a dedicated docs change — do not bury permanent rules inside a single phase prompt.
## Related Documents
- [Project Status](../project-status.yaml)
- [Runtime Read Policy](runtime-read-policy.md)
- [Master Prompt](master-prompt.md)
- [Enterprise Phase Discovery](enterprise-phase-discovery.md)
- [Definition of Done](definition-of-done.md)
- [Cursor Guidelines](cursor-guidelines.md)
- [Phase Template](phase-template.md)
- [docs/README.md](../README.md)