Prompt:

Master Codebase Rules

The Advanced Prompt Generation Service ā€” your reliable tool for crafting precise, structured, and detailed prompts for use across various AI platforms and services!

Prompt Content:
// .cursorrules: Short Master Version
//
// 1. GENERAL
//   - Write concise, maintainable, bug-free code.
//   - Use DRY, SOLID, early returns for clarity; handle edge cases first.
//   - Document complex logic; keep READMEs up to date.
//   - Test thoroughly (unit, integration, or e2e). Meaningful > 100% coverage.
//   - Use secure coding (sanitize inputs, no secrets in code).

// 2. NAMING
//   - Files/dirs: lowercase-dashes (e.g., user-profile.ts).
//   - Variables/functions: camelCase (JS) or snake_case (Py).
//   - Classes/types/interfaces: PascalCase (UserModel).
//   - Constants: UPPER_SNAKE_CASE (MAX_COUNT).

// 3. STYLE & SYNTAX
//   - Use recommended language style (e.g., PEP 8 for Py, ESLint + Prettier for JS).
//   - Prefer functional & declarative patterns over OOP if possible.
//   - Keep functions small; one responsibility. Avoid deep nesting.
//   - For conditionals, use guard clauses & minimal branches.


// 4. FRAMEWORK-SPECIFIC EXAMPLES
//   - React/Next.js: 
//       - Rely on server components & minimal "use client" usage.
//       - Lazy load large components; dynamic routes in Next.js App Router.
//   - Vue/Nuxt:
//       - Use Composition API, single-file components. Keep SFCs small.
//   - Svelte/SvelteKit:
//       - Use reactive declarations, minimal client scripts, prerender SSR if possible.
//   - Python (FastAPI/Django):
//       - Keep models & endpoints modular, use Pydantic or Django forms for validation.
//   - Laravel/PHP/WordPress:
//       - Small controllers, keep logic in services, follow WP coding standards.
//   - Mobile (React Native/Expo):
//       - Keep components small, rely on built-in UI libs, handle platform quirks.

// 5. ERROR HANDLING & LOGGING
//   - Validate inputs early; throw or return typed errors if invalid.
//   - Use structured logging & avoid leaking secrets.

// 6. DATA VALIDATION & FORMS
//   - Use typed schemas (Zod, Pydantic, etc.).
//   - Provide helpful error messages. Keep UI & server checks consistent.

// 7. DATABASE & INFRA
//   - Use migrations & consistent versioning (Prisma, Alembic, etc.).
//   - Limit raw SQL; use ORMs or query builders. Add indexes for frequent lookups.
//   - Dockerize or containerize if relevant. Keep environment configs out of code.

// 8. PERFORMANCE
//   - Profile slow spots. Cache repeated calls. Use concurrency or async if needed.
//   - Bundle-split, code-split, or lazy load for large UI libs.

// 9. DEPENDENCY MGMT
//   - Maintain lockfiles. Update regularly. Audit for security issues.

// 10. OTHER
//   - i18n: place strings in external files. Provide fallback locales.
//   - AI: keep prompts & logic in dedicated modules. If streaming, handle partial tokens safely.
//   - Large Projects: consider monorepos or Nx/Turborepo. Document thoroughly.