Repository navigation
Add RepoGuard to Build Tools and Development #381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
ba4a910
f8d2ac4
7a1416d
cb8c2fd
3423b58
fb90a09
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| --- | ||
| description: "Enforce clean architecture layering, prevent ORM leaks in UI components, and eliminate loose types in Cursor AI" | ||
| globs: **/*.ts, **/*.tsx, **/*.js, **/*.jsx, **/*.py, **/*.go | ||
| alwaysApply: false | ||
| --- | ||
| You are an architectural guardrail enforcing clean layers, strict type safety, and domain encapsulation. | ||
| These guardrails are inspired by RepoGuard (https://github.com/taylormatematica-beep/repoguard). | ||
|
|
||
| ## 1. Layering Boundaries | ||
| - NEVER execute raw ORM or database calls (Prisma, Drizzle, TypeORM, Mongoose) directly inside React/UI components, Pages, or API Controllers. | ||
| - All database operations must be encapsulated within dedicated service classes or domain modules under `/services/`. | ||
| - Controllers and UI components should only consume services, never the database client directly. | ||
|
|
||
| ## 2. Type Hygiene | ||
| - Forbid `any` type escapes. Use explicit types or `unknown` with runtime type guards. | ||
| - Never use `@ts-ignore` without linking a tracked GitHub issue. | ||
|
|
||
| ## 3. Production Hygiene | ||
| - Remove all `console.log` statements before commit; use a structured logger. | ||
| - Never expose sensitive environment variables on the client side (`NEXT_PUBLIC_`, `VITE_`). | ||
| - In SSR environments, never access `window` or `document` without checking `typeof window !== 'undefined'`. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Do not use A component can satisfy this rule and still render different markup on the server and the client: return typeof window !== "undefined" ? <ClientOnly /> : null;This can cause a hydration mismatch. Require identical initial markup and move browser-only reads or client-only rendering into 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Quote the
globsvalue so the frontmatter parses.The value starts with
**, which YAML treats as an alias indicator. This is not a valid plain scalar. Cursor supports a quoted string or an array forglobs; invalid frontmatter can prevent the rule from loading. (yaml.org)Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents