Instruction file imported from sg-mbarnett/ETL-Python (
.cursor/rules/ViewOrganization.mdc). Copyright stays with the author.
Rule Name: ViewOrganization.mdc
Description: Standardizes the organization of SQL view files and their related documentation.
Structure
- All SQL view files should reside within the main
views/directory. - Each view (
<view_name>.sql) should have its own dedicated subdirectory withinviews/, named after the view file without the extension (e.g.,views/<view_name>/). - The SQL file itself should be located inside this subdirectory (e.g.,
views/<view_name>/<view_name>.sql). - Any markdown files (planning, tasks, analysis notes, documentation) specifically related to that view should also be placed within the same subdirectory (e.g.,
views/<view_name>/related_notes.md).
AI Guidance
- New View Identification: When a new SQL view file is created or identified during the conversation (either by user statement or AI inference):
- Proactively check if it follows the standard structure.
- If it's in the root or another location, suggest or automatically (with user confirmation implicitly given by this rule) create the appropriate
views/<view_name>/subdirectory and move the.sqlfile into it.
- Related Documentation: When creating markdown files related to a specific SQL view currently under discussion:
- Default the save location to that view's dedicated subdirectory (
views/<view_name>/). - Confirm this location if ambiguity exists.
- Default the save location to that view's dedicated subdirectory (
Goal
Maintain a clean, predictable structure where each SQL view and its associated artifacts are co-located, preventing clutter in the root or docs/ directories.