Published on

Building a Documentation-Driven AI Assistant for my project

Authors

The Problem I Faced

I'm currently porting my project to new technologies (TanStack Start, orpc, Clerk) and found myself constantly explaining the same architectural decisions to Cursor over and over again. Every time I asked for help, I'd have to re-explain my import patterns, component organization, testing strategy, and coding conventions. It was like having a brilliant developer on my team who kept forgetting our project's standards.

The Lightbulb Moment

Instead of repeating myself constantly, I realized I could teach Cursor once and have it remember everything.

So I asked Cursor to help me create a comprehensive documentation system based on the decisions I'd made during our conversations about the project architecture.

The Two-File Strategy

I ended up with two key files:

.cursorrules - This became my minimal reference system that points to detailed documentation.

.cursorcontext - This provides the high-level project context that helps Cursor understand the bigger picture. It covers my project description, key architectural patterns, and technology stack.

Together, these files give Cursor both the detailed rules and the broader context it needs to be a true project partner.

What I Built

Honest truth—I asked Cursor to generate the documentation for me. Based on my old implementation and the decisions I made during our back-and-forth conversations about the new architecture, Cursor helped me create a comprehensive system.

The Rules

My .cursorrules file is intentionally minimal—it's just a reference system:

# Cursor IDE Rules for the project

## Documentation References

- **Quick Reference**: See docs/RULES-INDEX.md for a complete overview
- **Coding Standards**: See docs/CODING-GUIDELINE.md for all coding patterns
- **Architecture**: See docs/ARCHITECTURE.md for component organization
- **Design**: See docs/DESIGN.md for user experience specifications

## Rule Sources

All rules are defined in their respective documentation files. This file only references where to find them.

The Documentation System I Created

I organized everything into four focused documents that Cursor can reference:

1. CODING-GUIDELINE.md - Development Standards

This captures all the coding patterns I've established:

  • Import Rules: How I handle imports between packages, apps, and within the same codebase
  • Naming Conventions: My file naming, variable, and function patterns
  • Testing Strategy: Where I place tests and what I mock vs. what I test directly
  • Technology Stack: The specific versions and configurations I'm using
  • Code Style: My BiomeJS setup and formatting preferences

2. ARCHITECTURE.md - System Design

This documents how I've structured the project:

  • Component Architecture: How I organize shared vs app-specific components
  • CRUD Hooks Organization: My single-file pattern for data operations
  • Dependency Management: How my packages relate to each other
  • Performance Patterns: Caching and optimization strategies I use

3. DESIGN.md - Product Vision

This covers the user experience side:

  • User Flows: How users will interact with the app
  • Feature Specifications: What each feature does and why
  • UI Patterns: My design system and component guidelines
  • Success Metrics: How I'll measure if the project is working

4. RULES-INDEX.md - Quick Reference

A comprehensive index that helps me and Cursor find the right rule quickly:

  • By Task: "Setting up imports" → points to specific sections
  • By File Type: "React components" → relevant rules
  • Cross-References: How different rules relate to each other

The .cursorcontext File

My .cursorcontext provides the high-level project context, covering description, key architectural patterns, technology stack.

How This Changed My Development Process

1. No More Repetition

I define my rules once in documentation, and Cursor remembers them. When I update a rule, I update it in one place, and Cursor automatically gets the latest version.

2. Comprehensive Coverage

Instead of trying to fit everything into .cursorrules, I can have detailed, well-organized documentation that covers every aspect of my development process.

3. Consistent Code Generation

Cursor now generates code that follows my patterns automatically. Every component, hook, and utility follows the same conventions I've established.

4. Project Growth

As my project evolves, I can add new sections to documentation without cluttering the .cursorrules file. The system grows with my needs.

5. Better Focus

I spend less time explaining patterns and more time building features. Cursor understands my project's DNA.

The Real Impact on My Work

This system has completely transformed how I work on my project. Now when I collaborate with Cursor, it understands my project's patterns and generates code that fits perfectly. Here's what changed:

  • Faster Development: I spend less time explaining patterns and more time building features
  • Consistent Code: Everything Cursor generates follows my established conventions
  • Better Focus: I can focus on logic and architecture instead of style and organization
  • Seamless Collaboration: Cursor feels like a true project partner who knows my codebase

What I Learned

If you want to try this approach for your own project:

  1. Start Simple: Begin with basic .cursorrules for your immediate needs
  2. Document Patterns: As you identify patterns in your work, move them to documentation
  3. Reference System: Update .cursorrules to reference your documentation
  4. Iterate: Continuously improve based on what works for your specific project

The Bottom Line

For me, .cursorrules and .cursorcontext became more than configuration files—they became my project's coding DNA. By creating comprehensive documentation that Cursor can reference, I turned it from a helpful tool into a true project partner who understands my project's architecture and follows my conventions.

The key wasn't just having these files, but organizing them in a way that scales with my work. This is not a final system—I'll continue iterating with Cursor to polish and refine these rules as the project evolves.