Elena' s AI Blog

Cursor AI for Python Development

04 Aug 2025 / 18 minutes to read

Elena Daehnhardt


Midjourney 7.0: Three glowing monitors: green Gemini, orange ChatGPT, purple Claude interfaces and an ergonomic keyboard for geeks, HD
I am still working on this post, which is mostly complete. Thanks for your visit!


Introduction

Hello, my fellow coders!

I often get questions from my friends and developers about AI coding tools. “Elena, should I use AI to write code? Will it make me a lazy programmer? Which tool is best?”

Let me share something with you - I have been experimenting with AI coding assistants for months now, and I’d like to share my honest experience with Cursor AI for Python development.

First, let me say this: AI will not make you a magical coder overnight. Sorry, but there is no magic. You still need to understand programming fundamentals, debug your code, and think critically about solutions. But - and this is important - AI can be an excellent learning companion and productivity booster when used wisely.

I enjoy building quick prototypes, and I find AI chatbots like Claude, Gemini, and ChatGPT very useful for various tasks. But Cursor AI? It is something special. It is not just another chatbot - it is a complete development environment that thinks with you.

In this post, I will share everything I learned about using Cursor AI effectively for Python development.

What is Cursor AI?

Cursor AI is like having a brilliant programming buddy who never gets tired and knows a lot about code. Built on Visual Studio Code (so familiar interface!), it offers intelligent autocomplete, conversational code generation, and - here is the cool part - it understands your entire project context.

Think of it this way: instead of switching between your editor, Stack Overflow, documentation, and terminal, you have one place where you can:

  • Generate code through natural language descriptions
  • Ask questions about your existing codebase
  • Refactor and optimise code intelligently
  • Debug issues with AI-powered insights
  • Connect to external tools and databases

But remember - you are still the architect. The AI is your assistant, not your replacement.

Getting Started

Setting up Cursor AI is straightforward, especially if you already use VS Code. Do not worry if you are new to this - we will go step by step.

Installation

  1. Download: Go to cursor.sh and download for your system
  2. Install: On macOS, just drag to the Applications folder. That is it!
  3. Launch: Open Cursor AI - you will see a familiar VS Code interface

During the first launch, Cursor asks about using your code to improve AI. You can disable this in Settings → Privacy if you prefer (I keep it enabled because I like contributing to AI improvement, but choose what feels right for you).

To install the command-line tool, open Command Palette (Cmd+Shift+P), search “Shell Command: Install ‘cursor’ command”. Now you can open projects from the terminal with cursor . - very handy!

Basic Configuration

I suggest keeping the default VS Code shortcuts unless you are a Vim person. For AI conversations, English works best, though other languages are supported.

Creating Project Structure

Start clean:

mkdir my-python-project
cd my-python-project

Open this folder in Cursor AI. Here is where the magic begins - instead of manually creating files, press Cmd+L to open the Chat Panel and ask:

“Create a standard Python project structure with app, tests, requirements.txt, README, and gitignore”

Boom! You get a complete structure, and Cursor starts coding for you :

python-project/
├── app/                    # Main application code
│   ├── __init__.py        # Package initialization with version info
│   ├── main.py            # CLI application entry point
│   └── utils/             # Utility functions
│       ├── __init__.py
│       └── helpers.py     # Common utility functions
├── tests/                 # Test files
│   ├── __init__.py
│   ├── conftest.py        # pytest configuration and fixtures
│   ├── test_main.py       # Tests for main application
│   └── test_utils.py      # Tests for utility functions
├── requirements.txt       # Production dependencies
├── requirements-dev.txt   # Development dependencies
├── setup.py              # Package setup and installation
├── pyproject.toml        # Modern Python project configuration
├── .gitignore           # Comprehensive Git ignore rules
├── .dockerignore        # Docker ignore rules
├── Dockerfile           # Docker container configuration
├── Makefile             # Development task automation
├── config.example.json  # Example configuration file
└── README.md            # Comprehensive documentation
Cursor creates a Python scaffold project

Cursor creates a Python scaffold project

This is not cheating - this is working smarter, not harder.

Virtual Environment (Always Use One!)

Create your virtual environment:

python -m venv venv
source venv/bin/activate  # Windows folks: venv\Scripts\activate

Configure Python interpreter in Cursor, read at Python: Set up Python development with extensions and linting tools:

  1. Command Palette (Cmd+Shift+P)
  2. “Python: Select Interpreter”
  3. Choose your virtual environment

Cursor AI detects this automatically - pretty clever, right?

Essential Tools

Remember my philosophy: you do not need to know every tool. Focus on the essential ones.

Core Extensions

Python Extension Pack: Get this first. It includes Python support, a debugger, and a Pylance language server.

Pylance: Microsoft’s fast Python language server. Works beautifully with Cursor AI’s autocomplete.

Code Quality Tools (These Matter!)

Ruff: Modern, fast Python linter:

pip install ruff

Configure it:

{
  "ruff.args": ["--line-length", "88"],
  "[python]": {
    "editor.defaultFormatter": "charliermarsh.ruff"
  }
}

Black: For consistent formatting:

pip install black

MyPy: For type checking:

pip install mypy

The beautiful thing? Cursor AI learns your style preferences and suggests code that follows your formatting rules. It is like having a coding buddy who remembers how you like things done.

Cursor AI Features I like

Chat Panel (Cmd+L)

This is where conversations happen. Let me show you real examples from my work:

Code Generation:

Instead of writing boilerplate (boring!), describe what you need:

Create a function that fetches data from a REST API, handles common HTTP errors, and returns parsed JSON with proper error handling

I'll create a robust function that fetches data from a REST API with comprehensive error handling. Let me add this to the utils module.

Next, Cursor AI generates the whole code to be included in the utils.py. You will just have to accept it.

Not bad, right? But always review the code - do not just copy-paste blindly!

Codebase Questions:

This feature is fantastic. Ask questions about your code:

Find all functions in my codebase that make database connections and show me how they handle connection pooling

Cursor AI searches your files and explains what it finds. It is like having documentation that writes itself.

Inline Prompting (Cmd+K)

The Inline Prompting is excellent for quick fixes. Place the cursor in your function, press Cmd+K, and ask:

Add input validation and docstring to this function

You get a diff showing proposed changes. Accept, reject, or modify - you stay in control.

Intelligent Autocomplete

As you type, Cursor suggests complete functions. Not just variable names - entire implementations! For example, start typing:

def calculate_fibonacci(n):
    # Cursor suggests the complete function
    if n <= 1:
        return n
    return calculate_fibonacci(n-1) + calculate_fibonacci(n-2)

It considers your project context, imported libraries, and coding patterns. Sometimes it feels like mind-reading!

Composer (Cmd+I)

Need to build entire features? Use Composer for big changes:

Create a Flask web application with user authentication, database models using SQLAlchemy, and RESTful API endpoints for user management

Cursor AI generates multiple files, such as:

  • app.py with Flask setup
  • models.py with SQLAlchemy models
  • auth.py with authentication logic
  • api.py with RESTful endpoints
  • requirements.txt with dependencies

Again - review everything before using it!

How to Prompt Effectively

Bad prompting gives bad results. Good prompting gives excellent results. Here is what I learned:

Be Specific, Not Vague

❌ Bad: “Make this better”

✅ Good: “Optimise this function for performance, add type hints, and include error handling for empty input lists”

Provide Context

Instead of just asking for code, explain your situation:

Create a data validation function for my Django blog application. It should validate email formats, check password strength (minimum eight characters, at least one uppercase, one lowercase, one number), and ensure usernames are alphanumeric. Follow Django's validation patterns.

Break Down Complex Tasks

Do not ask for a complete application in one prompt. Break it down:

  1. “Create database models for a blog”
  2. “Add CRUD operations for these models”
  3. “Create API endpoints with serialisation”
  4. “Add authentication and permissions”

Use Version Control

Never experiment with AI-generated code on your main branch:

git checkout -b feature/ai-experiment
# Let AI generate code
git add .
git commit -m "Add AI-generated feature"
# Review, test, then merge if good

This saved me many times when AI suggestions were not quite right. You can ask Cursor to roll back to a commit with your number, and it will happily update your remote branch as well.

MCP Tools

MCP (Model Context Protocol) tools connect Cursor AI to external systems. Think databases, APIs, and logging systems.

The MCP server usage and creation are explained in Model Context Protocol (MCP), referring to the fantastic list of available MCP tools at MCP Servers page with my favourite GitHub, Notion and HuggingFace MCP servers!

An MCP server exposes a set of “tools” that the language model can invoke automatically based on your prompts. Cursor supports several transport methods for these servers, including stdio (for local command-line servers) and Streamable HTTP/SSE (for remote servers) [3].

You configure an MCP server by adding a JSON configuration to a file, either globally (~/.cursor/mcp.json) or for a specific project (.cursor/mcp.json) [3]. This configuration specifies the server’s name, command/URL, and any necessary authentication, like API keys.

For security, the protocol is designed to keep a “human in the loop,” meaning Cursor should provide visual indicators when a tool is invoked and may require user confirmation for sensitive operations.

Cursor AI vs Other Tools

People ask me about alternatives, primarily Amazon’s new Kiro AI.

Cursor AI

Cursor AI fast development and quick prototypes.

Good for:

  • Solo developers and small teams
  • Rapid prototyping and learning
  • Conversational, chat-first coding
  • Immediate productivity boost

I use it for:

  • Personal projects and experiments
  • Learning new Python libraries
  • Quick debugging sessions
  • Building MVPs

Kiro AI

I have just joined Kiro’s waitlist, but I haven’t tested it yet. I believe Kiro AI may be a better fit for enterprise teams and businesses utilising AWS infrastructure.

Good for:

  • Larger teams with strict standards
  • Spec-driven development approach
  • Enterprise compliance requirements
  • AWS-heavy infrastructures

Consider it if:

  • You need extensive documentation
  • Working in regulated industries
  • Managing complex team workflows
  • Following strict architectural patterns

My Approach

I recommend trying both, and also experimenting with other AI coding assistants! Cursor AI for daily coding and experimentation, Kiro AI for larger, more structured projects. Choose the tool that fits your current context, not just one tool forever.

Real Development Workflow

Let me show you my typical Cursor workflow:

1. Project Start

cursor new-project

Use the Chat Panel for project structure, configure the virtual environment, and install dependencies.

2. Feature Development

Start with comments describing what you want:

# TODO: Create user authentication with JWT tokens and bcrypt password hashing

Let Cursor AI generate an initial implementation, then refine with Cmd+K.

3. Testing and Debugging

When tests fail, paste the error:

This test fails with KeyError: 'user_id'. Here is the error log: [paste log]. Fix the issue and explain what went wrong.

4. Code Review

Before committing:

Review this authentication module for security issues, performance problems, and code quality improvements

5. Documentation

Generate docs:

Create detailed docstrings for all functions in this module with examples and type hints

Common Mistakes

Over-Reliance on AI

Problem: Accepting all suggestions without understanding.

Solution: Always review and understand generated code. Use AI as a learning tool, not a thinking replacement.

Context Loss

Problem: AI forgets what we discussed earlier.

Solution: Start new chats for different features. Be specific in each prompt.

Generic Solutions

Problem: AI gives generic code that does not fit your specific needs.

Solution: Provide more context about your project, constraints, and requirements.

As explained in this Guide: How to Handle Big Projects With Cursor, for large projects, you can employ a structured documentation approach involving PRDs (Product Requirements Documents) and RFCs (Request for Comments):

  1. PRD Creation: Document your application’s goals, requirements, technologies, design patterns, and technical specifications.

  2. Establish Cursor Rules: Define coding standards, directory structures, naming conventions, and architectural guidelines for Cursor to consistently follow.

  3. Feature Breakdown: Split the application into smaller, clearly defined features.

  4. Generate RFCs: For each feature, create detailed RFC documents outlining the technical design, functions, database schemas, security aspects, and dependencies.

  5. Incremental Implementation: Ask Cursor to handle one RFC at a time, rather than trying to modify the entire codebase simultaneously.

This method works effectively because providing focused, well-defined tasks prevents Cursor from becoming overwhelmed and ensures accurate, context-aware code generation.

Dealing with Frustration

Sometimes AI suggestions are wrong. Sometimes they do not work. Sometimes you feel like traditional coding was easier.

This is normal! Remember:

  • You are still learning: AI coding is a new skill, be patient with yourself
  • AI is not perfect: It makes mistakes, just like humans
  • Keep perspective: Focus on what AI helps you achieve, not its limitations
  • Take breaks: If frustrated, step away and come back fresh

It is not possible to become an excellent coder overnight. You will have some challenges, but they will help you grow and respect the craft.

My opinion and recommendations

After months of using Cursor AI for Python development, here is what I think:

The Good:

  • Dramatically speeds up boilerplate code writing
  • Excellent for learning new libraries and patterns
  • Great debugging assistant when you are stuck
  • Makes documentation less painful
  • Chat interface feels natural and conversational

The Challenging:

  • Can generate code you do not understand (dangerous!)
  • Sometimes suggests outdated or inefficient approaches
  • Requires good prompting skills to get good results
  • Can make you lazy if you are not careful

Use Cursor AI, but use it wisely. It is an excellent tool for accelerating development and learning, but you still need to understand fundamentals, review code carefully, and maintain critical thinking skills.

Begin with straightforward tasks, such as generating utility functions or writing tests. As you get comfortable, gradually use it for more complex features. Constantly version control experiments, and never deploy AI-generated code without thorough review and testing.

Do not limit yourself to one particular tool; use Cursor AI or any other tool in combination with other assisted coding tools. You might benefit from using several AI bots working on your project at once.

Try out using several coding bots with your Git repository (use with caution and let them work on their designated branch for a start :) You will be able to see which bot is the best for your tasks.

And, the most important thing to remember - the goal is not to replace your thinking, but to augment it. AI should make you a more productive developer, not a passive consumer of generated code.

Conclusion

Coding is for everyone, and AI tools like Cursor AI can make programming more accessible and enjoyable. Do not let anyone tell you that using AI makes you a “fake” programmer - that is nonsense. We use compilers, IDEs, frameworks, and libraries to be more productive. AI is just another tool in our toolkit.

Use AI to learn, explore, and accelerate your work, but do not let it replace your curiosity and critical thinking.

Happy coding, my friends! And remember to eat well, exercise, and go outside sometimes :)

Did you like this post? Please let me know if you have any comments or suggestions about your experience with AI-powered development tools. I am always happy to learn from your experiences, too!

References

  1. Cursor AI Official Site
  2. Python: Set up Python development with extensions and linting tools
  3. Model Context Protocol (MCP)
  4. MCP Servers
  5. Guide: How to Handle Big Projects With Cursor
desktop bg dark

About Elena

Elena, a PhD in Computer Science, simplifies AI concepts and helps you use machine learning.





Citation
Elena Daehnhardt. (2025) 'Cursor AI for Python Development', daehnhardt.com, 04 August 2025. Available at: https://daehnhardt.com/blog/2025/08/04/cursor-ai-for-python-development/
All Posts