diff --git a/rules/go-production/.cursorrules b/rules/go-production/.cursorrules new file mode 100644 index 00000000..c2427ef4 --- /dev/null +++ b/rules/go-production/.cursorrules @@ -0,0 +1,9 @@ +.cursorrules — Go Production + +- Never ignore returned error with _. Handle or return every error. +- Wrap with context: fmt.Errorf("functionName: %w", err). +- Define interfaces at the consumer package. Keep interfaces to 1-2 methods. +- ctx context.Context as first parameter in every I/O function. +- Every goroutine has a clear owner and shutdown path. Use errgroup. +- Always name struct fields. No positional initialization. +- Table-driven tests with t.Run(tt.name, ...). diff --git a/rules/python-fastapi-production/.cursorrules b/rules/python-fastapi-production/.cursorrules new file mode 100644 index 00000000..6a5f543f --- /dev/null +++ b/rules/python-fastapi-production/.cursorrules @@ -0,0 +1,9 @@ +.cursorrules — Python FastAPI Production + +- Every function signature must include type hints. +- Never bare except: — catch specific exceptions or re-raise. +- Pydantic BaseModel for API boundary data. @dataclass for internal structures. +- Pass dependencies as parameters. No global variables in business logic. +- Always pathlib.Path. / operator for path joining. +- Never time.sleep() in async. Use asyncio.sleep(). +- Validate env vars at startup. No os.environ.get() silent defaults. \ No newline at end of file diff --git a/rules/react-nextjs-production/.cursorrules b/rules/react-nextjs-production/.cursorrules new file mode 100644 index 00000000..35840c48 --- /dev/null +++ b/rules/react-nextjs-production/.cursorrules @@ -0,0 +1,9 @@ +.cursorrules — React + Next.js App Router + +- Default to Server Components. Add "use client" only for hooks/browser APIs/event handlers. +- Fetch data in Server Components. Never fetch in useEffect. +- Use server actions for mutations, not client-side API route calls. +- One component per file. File name = component name (PascalCase). +- Define explicit interface Props. Never use any as prop type. +- Every async route needs a sibling loading.tsx and error.tsx. +- Use next/image instead of img. Use next/font instead of Google Fonts link tags. diff --git a/rules/typescript-strict-production/.cursorrules b/rules/typescript-strict-production/.cursorrules new file mode 100644 index 00000000..543df2fd --- /dev/null +++ b/rules/typescript-strict-production/.cursorrules @@ -0,0 +1,9 @@ +.cursorrules — TypeScript Strict Mode + +- tsconfig.json must have "strict": true. Never disable strict checks. +- No any. Use unknown + type guards, or as Type only at I/O boundaries. +- Every exported function needs explicit return type including async (Promise). +- Model state as discriminated unions: { status: "loading" } | { status: "success"; data: T }. +- Readonly for immutable data. as const for config objects. +- Validate env vars at startup. Never process.env.FOO in business logic. +- No TypeScript enum. Use const object + typeof union.