Skip to content

Add code pair interview .cursorrules #100

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -221,6 +221,7 @@ By creating a `.cursorrules` file in your project's root directory, you can leve
- [Next.js (Type LLM)](./rules/next-type-llm/.cursorrules)
- [Unity (C#)](./rules/unity-cursor-ai-c-cursorrules-prompt-file/.cursorrules)
- [Web App Optimization](./rules/web-app-optimization-cursorrules-prompt-file/.cursorrules)
- [Code Pair Interviews](./rules/code-pair-interviews/.cursorrules)

### Utilities

33 changes: 33 additions & 0 deletions rules/code-pair-interviews/.cursorrules
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
You are an expert software developer focused on producing clean, well-structured, and professional-quality code, suitable for a code pair programming interview.

Code Structure and Organization

- Organize code logically with a clear separation of concerns.
- Break down problems into smaller, self-contained units using functions and classes.
- Ensure modularity and reusability of code components.
- Adhere to the Single Responsibility Principle: each function/class should have one specific job.
- When tackling complex problems, begin by outlining a high-level plan before writing code.
- Start with a simple, straightforward solution to the core problem, optimizing later if time allows.
- Select appropriate data structures and algorithms with a focus on clarity and efficiency.
- Example: Use a hash map for quick lookups when appropriate.

Coding Style

- Maintain consistent indentation using 2 spaces (prefer spaces over tabs).
- Use meaningful and descriptive names for variables, functions, and classes.
- Avoid single-letter or cryptic abbreviations.
- Example: Use `calculate_total_cost` instead of `calc`.
- Employ comments judiciously to explain non-obvious logic or provide high-level overviews.
- Use docstrings for functions and methods to describe purpose, parameters, and return values.
- Avoid over-commenting self-explanatory code.
- Keep lines of code within a reasonable length (80-100 characters) to enhance readability.
- Use blank lines to separate logical blocks of code and improve visual organization.

Coding Best Practices

- Write clean and readable code.
- Prioritize clarity in code structure and style.
- Consider edge cases and implement error handling.
- Strive for efficient solutions.
- Test code thoroughly with various inputs, including edge cases.
- Start simple and optimize later.
30 changes: 30 additions & 0 deletions rules/code-pair-interviews/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Cursor AI code pair interviews .cursorrules prompt file

Author: Radamés Roriz

## What you can build

This .cursorrules file is designed to guide Cursor AI in generating code that adheres to the best practices and expectations of code structure and style commonly assessed in code pair programming interviews. It emphasizes clean, maintainable, and professional-quality code, along with collaborative coding practices.

## Benefits

- **Improved Code Quality:** Ensures generated code is well-structured, readable, and follows industry-standard style conventions.
- **Interview Readiness:** Helps in practicing and preparing for code pair interviews by simulating the expected coding environment and standards.
- **Effective Collaboration:** Promotes code that is easy to understand and work with in a collaborative setting.
- **Reduced Errors:** Encourages the generation of code that considers edge cases and includes basic error handling.
- **Consistency:** Maintains a consistent coding style throughout the generated code, reflecting professional software development practices.

## Synopsis

The .cursorrules file provides Cursor AI with detailed instructions on:

- **Code Structure and Organization:** How to break down problems, organize code into modular units, and select appropriate data structures and algorithms.
- **Coding Style:** Guidelines for indentation, naming conventions, commenting, line length, and code layout.
- **Collaboration and Communication:** Practices for thinking aloud, giving/receiving feedback, and collaborative debugging.
- **Coding Best Practices:** Emphasis on writing clean code, handling edge cases, and time management.
- **Style Guides:** Reference to PEP 8 for Python and general principles of code styling.
- **Pitfalls to Avoid:** Common mistakes in code pair interviews and how to prevent them.

## Overview of .cursorrules prompt

This .cursorrules prompt acts as a comprehensive guide for Cursor AI to generate code that mirrors the quality and collaborative approach expected in a code pair programming interview. It covers not only the technical aspects of writing correct code but also the crucial elements of code clarity, style consistency, and effective communication that are essential for success in such evaluations. By adhering to these rules, Cursor AI can produce code that demonstrates a candidate's readiness for real-world software development and collaborative coding environments.