Skip to content

Using Cursor with ConnectSoft

This document provides internal best practices for using Cursor on ConnectSoft repositories and documentation. It is written for ConnectSoft team members using Cursor for code and documentation work.

Cursor is a powerful AI-powered code editor that excels at code editing, refactoring, and documentation updates. This guide shows how to use Cursor effectively with ConnectSoft patterns and style.

Tip

Cursor Best Practices: 1. Use ConnectSoft instructions/system prompts for consistency 2. Keep diffs small and focused 3. Commit often with clear messages 4. Review all changes before committing 5. Use Cursor for code, ChatGPT for high-level thinking

Workspace Configuration

Open Main Repositories: - ConnectSoft.CompanyDocumentation - Documentation - ConnectSoft.*Template - Templates - ConnectSoft.Extensions.* - Libraries - ConnectSoft.AI.SoftwareFactory.* - Factory code

System Instructions

ConnectSoft System Prompt for Cursor:

You are an expert .NET architect and engineer working on ConnectSoft projects.

ConnectSoft Principles:
- Clean Architecture (Domain → Application → Infrastructure)
- Domain-Driven Design (bounded contexts, aggregates, domain events)
- Event-Driven Architecture (MassTransit, Azure Service Bus)
- Cloud-Native (stateless, scalable, observable)
- Multi-Tenant SaaS by default

Technology Stack:
- .NET 10, C# 
- ASP.NET Core
- NHibernate
- MassTransit
- OpenIddict
- Azure (AKS, Service Bus, Cosmos DB, Key Vault)

Code Style:
- Follow C# coding conventions
- Use async/await for I/O operations
- Include XML documentation
- Use dependency injection
- Include observability (logging, tracing, metrics)

Documentation Style:
- Follow ConnectSoft documentation style guide
- Use single # title
- Include 1-3 sentence intro
- Use logical headings
- Include appropriate callouts
- Cross-link to related docs

Always:
- Review code for Clean Architecture compliance
- Ensure observability hooks are present
- Include tests for new code
- Update documentation when changing code

Typical Cursor Workflows

Workflow 1: Implement Documentation Structure

Task: Create documentation structure from instructions

Steps: 1. Open documentation file in Cursor 2. Use Cursor to generate structure based on style guide 3. Review and refine structure 4. Add content section by section 5. Add cross-links and callouts 6. Preview in MkDocs 7. Commit changes

Example Prompt:

Create documentation structure for [topic] following ConnectSoft style guide.
Include: title, intro, logical sections, callouts, cross-links.

Workflow 2: Refactor Template with Tests

Task: Refactor a template while maintaining tests

Steps: 1. Open template repository in Cursor 2. Identify refactoring target 3. Use Cursor to refactor code 4. Update tests to match refactoring 5. Run tests to validate 6. Review changes 7. Commit with clear message

Example Prompt:

Refactor [component] to follow Clean Architecture.
Maintain all existing tests.
Update tests if needed.

Workflow 3: Add Cross-Cutting Feature

Task: Add cross-cutting feature to multiple projects

Steps: 1. Design feature in ChatGPT first 2. Open relevant projects in Cursor 3. Use Cursor to add feature consistently 4. Update tests across projects 5. Update documentation 6. Review changes 7. Commit to each project

Example Prompt:

Add [feature] to [project] following ConnectSoft patterns.
Include: implementation, tests, documentation updates.

Managing Large Refactors

Strategy: Incremental Refactoring

Approach: 1. Plan - Use ChatGPT to plan refactoring strategy 2. Break Down - Break into small, incremental changes 3. Refactor - Use Cursor for each incremental change 4. Test - Test after each change 5. Commit - Commit each incremental change 6. Review - Review before merging

Best Practices

  • Small Diffs - Keep diffs small and focused
  • Frequent Commits - Commit often with clear messages
  • Test Continuously - Run tests after each change
  • Review Regularly - Review changes before merging

Tip

Incremental Refactoring: Break large refactorings into small, incremental changes. This makes reviews easier, reduces risk, and maintains code quality.

Working with MkDocs and Docs

Documentation Editing Workflow

Steps: 1. Open Markdown file in Cursor 2. Use Cursor to edit content 3. Preview locally with mkdocs serve 4. Review formatting and links 5. Commit changes

Common Documentation Tasks

Adding New Page: 1. Create .md file in appropriate folder 2. Add frontmatter (title, description, tags) 3. Add content following style guide 4. Update mkdocs.yml navigation 5. Preview and test

Updating Existing Page: 1. Open file in Cursor 2. Edit content 3. Check cross-links 4. Preview changes 5. Commit

Adding Cross-Links: 1. Identify related documents 2. Add links using relative paths 3. Verify links work 4. Commit

Do's and Don'ts

Do's

  • Do: Keep diffs small and focused
  • Do: Commit often with clear messages
  • Do: Review all changes before committing
  • Do: Use ConnectSoft patterns and style
  • Do: Include tests for code changes
  • Do: Update documentation when changing code
  • Do: Preview documentation locally before committing

Don'ts

  • Don't: Let Cursor auto-change large areas without review
  • Don't: Commit without reviewing changes
  • Don't: Skip tests or documentation updates
  • Don't: Break existing functionality
  • Don't: Ignore style guide or patterns
  • Don't: Paste secrets or sensitive data

Warning

Critical Don'ts: 1. Don't Auto-Change Large Areas - Always review Cursor's changes, especially for large refactorings 2. Don't Skip Review - Never commit without reviewing changes 3. Don't Break Functionality - Ensure tests pass and functionality works 4. Don't Ignore Style - Follow ConnectSoft style guide and patterns