# Audit Result: AI Development Constitution Source plan: `plans/rule-ai.md` Date: 2026-06-29 ## What Was Audited - Folder structure under `src/app`, `src/components`, `src/features`, `src/hooks`, `src/lib`, `src/db`, and `src/config`. - Feature structure for all directories in `src/features`. - Table patterns across training records, pending review, employee directory, audit logs, users, courses, employees, products, notifications, announcements, and online lessons. - Form patterns using `useAppForm` and Zod. - Route Handler and Drizzle persistence patterns. - Auth and role helpers. - Shared UI, dialog, sheet, alert dialog, upload, table, and layout components. - Existing documentation and `AGENTS.md`. ## Important Corrections From The Plan The plan names some tools that are not the actual stack. The generated docs follow the real repository implementation: - Persistence is Drizzle ORM, not Prisma. - Forms use TanStack Form, not React Hook Form. - Runtime mutations use Route Handlers plus TanStack Query, not `next-safe-action`. - Icons come from `@/components/icons`. - Data tables should use the shared DataTable stack. ## Canonical Features Selected Primary: - `training-records` Secondary: - `employee-directory` - `announcements` - `audit-logs` ## Documents Created - `docs/AI_DEVELOPMENT_GUIDE.md` - `docs/PROJECT_ARCHITECTURE.md` - `docs/REFRACTOR_REPORT.md` ## Files Updated - `AGENTS.md` ## Key Findings - `training-records` is the strongest canonical feature because it covers server data, Route Handlers, table, form, upload, and review behavior. - `employee-directory` is a strong table reference for responsive DataTable behavior. - `announcements` and `notifications` still use manual pagination in places. - Legacy/template areas such as `products`, `employees`, `forms`, `kanban`, `chat`, and demo pages should not be copied into new runtime work. - New tables should use `DataTable`, `DataTableToolbar`, `DataTablePagination`, `DataTableViewOptions`, `DataTableColumnHeader`, and `useDataTable`. - New forms should use `useAppForm`, shared TanStack Form wrappers, and Zod. ## Recommended Next Steps 1. Keep `training-records` as the default feature reference for future work. 2. Finish aligning `online-lessons` to a single DataTable implementation. 3. Do not refactor legacy features without explicit approval. 4. Use `docs/REFRACTOR_REPORT.md` as the backlog for future consistency work.