Analytics as Code with Cursor: How do you make the most out of it?

4 min read | Published
  • GoodData logo
Written by Andrii Chumak
Analytics as Code with Cursor: How do you make the most out of it?

Analytics as Code is slowly becoming the norm for analytics solutions, much the same as Infrastructure as Code and Security as Code. The level of confidence in your solution that you get from version control and CI/CD pipelines is hard to beat.

Meanwhile, smart IDEs, like Cursor and Windsurf, are getting more and more popular, helping software engineers to be more productive. For data analysts, Cursor can help write SQL or Python code. It’s generally good with widespread technologies and languages, as there is a lot of data to train on. But how can you take advantage of AI features for more niche technologies like Analytics as Code?

In this article, I’ll show you how to make the most of any AI-powered IDE when working with Analytics as Code by leveraging rule filesVS Code extensions, and MCP servers.

Out-of-the-Box Cursor Experience

I must admit, when I first tried using our Analytics as Code with Cursor, I was worried we’d have to make a lot of changes to our setup to take advantage of AI features in full. But the out-of-the-box experience was surprisingly good.

Work by Example

First of all, AI coding agents are quite good at creating new code by example. If you’re not starting from scratch and already have some analytics in the workspace, the chances are Cursor will work great for you. It helps that our Analytics as Code syntax is based on YAML, and AI models know how to write a valid YAML file already — that’s included in the training. They only need to figure out the correct schema for our specific use case.

VS Code Extension

The second contributing factor is that we already have a VS Code extension — that works in Cursor and Windsurf as they’re both based on VS Code.

The extension is available in both Microsoft Marketplace for VS Code and OpenVSX Marketplace for Cursor. Just looks for “GoodData” in the extensions tab.

Our extension does a lot of things, from syntax highlighting to autocomplete, reference resolution, and previews. But most importantly, schema validation and reference integrity validation. Cursor listens to any validation errors the extension produces and is capable of fixing them automatically.

GoodData for VS Code highlighting referential error

Let’s say you’re building a new visualization: Cursor will look at any existing visualizations for examples and produce a new one. Sure, it may hallucinate a reference to some non-existing metric, but then our extension will highlight the error and suggest a list of valid metrics that can be used instead. And since Cursor works iteratively, it can choose the right metric and fix the code before handing control back to you.

A Better Cursor Experience

But we can take this even further by leveraging more advanced Cursor features, rule files and MCP server integration.

It’s worth noting that most of the features described here will also work in other VS Code-based smart IDEs, like Windsurf.

Cursor Rules

The rule files are designed for developers to give Cursor more context about the workspace. It’s a simple Markdown file where you can describe how to work with certain file types, how the project is structured, how to perform a specific task, and so on. All the things you probably should have had in the internal documentation a long time ago, but were too lazy to write down.

Rule files are the perfect place to provide Cursor with examples to reduce its dependence on pre-existing items for examples, as well as to cover rare cases that you likely don’t have in the workspace just yet.

MCP Server

I was checking out Model Context Protocol (MCP) and noticed a lot of commonalities with Language Server Protocol (LSP). Both protocols provide a useful abstraction for the communication between server and client, as well as features discoverability, authentication, and transport for the messages. This means you can implement your LLM app as an MCP client and not need to care if the MCP servers you’re connecting to are written in different programming languages, running locally, or deployed on a 3rd party server.

This makes an MCP server a perfect companion for AI-driven development in Cursor, as it complements the Language Server. It can provide additional context and trigger (read-only) actions on the user’s behalf — all good things for your productivity.

Imagine you have a new table added to the data source. With well-defined rules, Language Server and MCP Server, Cursor can automatically:

  • Scan the database model to review the new table.
  • Sample the data to understand the contents.
  • Create the dataset definition.
  • Validate it and fix any issues.
  • Run the dataset preview to verify the result.

We’ve Got You Covered

Starting v0.14.0, the GoodData for VS Code extension comes with batteries included for AI-assisted development.

New Project Initialization and Cursor Rules

When starting a new project, you can now pass a --cursor parameter to add boilerplate Cursor rules and a configuration for the MCP server to let Cursor know how to connect to it. See all commands and options in our documentation.

The rule files are a good starting point for any analytics project, but feel free to edit those as you identify any gaps in Cursor’s understanding of your code.

Bundled MCP Server

GoodData for VS Code MCP Server connected to Cursor

The extension itself now comes with the MCP server bundled in. Once enabled and configured in Cursor, it will provide tools for database schema scanning, all kinds of previews, as well as shortcuts for workspace deploy and clone commands.

Conclusion

AI-assisted software engineering is in a volatile state these days. Some people swear by it, others hate it. Some say it’s a productivity booster, while others call it a time-waster. It’s not clear what final form it will take when all is said and done, but it’s quite clear that software engineering is changing. And, more importantly, data analysts take note, or risk being left behind.

Want to learn more?

If you’d like to learn more about our different AI initiatives, you can read some of our other articles, such as Why AI in Analytics Needs Metadata or our other technical articles.

Want to see what GoodData can do for you?

Request a demo

Stay updated on analytics as code

Subscribe

Read more

Cover image for

Cover image for

Cover image for