fix(agent): Add NF prompt Database Component Agent #1008
Merged
+379
−28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request significantly enhances the database design documentation and review prompts for authentication/authorization and general schema normalization in the agent package. The changes clarify critical normalization rules, automate detection of common schema patterns, and strengthen guidance on proper actor/session separation and parent-child table relationships. These improvements aim to prevent common mistakes, enforce best practices, and make the prompts more actionable for both table design and review.
Major improvements include:
Authentication & Authorization Table Design
DATABASE_AUTHORIZATION.md, detailing which fields belong in actor (identity) vs. session (connection context) tables, with explicit schema patterns and anti-patterns for guests and members. This prevents mixing session data into identity tables, which is a frequent normalization error.Database Normalization Principles
DATABASE_AUTHORIZATION.mdandDATABASE_COMPONENT.md, including examples of violations and correct patterns. This ensures all contributors understand and apply normalization rigorously. [1] [2]DATABASE_COMPONENT.mdthat maps requirement keywords (e.g., "question", "review", "attachment") to required table patterns, with explicit instructions to add missing tables immediately.Automated Schema Review and Pattern Detection
DATABASE_COMPONENT_REVIEW.mdto an "Automatic Pattern Detection Rules" matrix, requiring reviewers to scan for keywords and verify or create corresponding tables. Special rules for Q&A, polymorphic entities, and separate entity patterns are now explicit.DATABASE_SCHEMA_REVIEW.mdto detect and reject parent-child field duplication (3NF violation), with a scenario demonstrating detection and correction of redundant fields in child tables. [1] [2]Documentation and Process Improvements
These changes collectively enforce stricter normalization, automate error detection, and make the prompts more robust for both design and review phases.
References:
Authentication/Authorization separation and normalization [1] [2] [3] [4]
Pattern detection and normalization checklists [1] [2] [3]
Parent-child field duplication detection [1] [2]
Process and documentation improvements [1] [2] [3]