Major release with significant performance improvements and new processing strategy. ## Core Changes - Implemented simple_full_document processing strategy (default) - Full document → LLM approach: 1-2 passes, ~5-6 minutes processing time - Achieved 100% completeness with 2 API calls (down from 5+) - Removed redundant Document AI passes for faster processing ## Financial Data Extraction - Enhanced deterministic financial table parser - Improved FY3/FY2/FY1/LTM identification from varying CIM formats - Automatic merging of parser results with LLM extraction ## Code Quality & Infrastructure - Cleaned up debug logging (removed emoji markers from production code) - Fixed Firebase Secrets configuration (using modern defineSecret approach) - Updated OpenAI API key - Resolved deployment conflicts (secrets vs environment variables) - Added .env files to Firebase ignore list ## Deployment - Firebase Functions v2 deployment successful - All 7 required secrets verified and configured - Function URL: https://api-y56ccs6wva-uc.a.run.app ## Performance Improvements - Processing time: ~5-6 minutes (down from 23+ minutes) - API calls: 1-2 (down from 5+) - Completeness: 100% achievable - LLM Model: claude-3-7-sonnet-latest ## Breaking Changes - Default processing strategy changed to 'simple_full_document' - RAG processor available as alternative strategy 'document_ai_agentic_rag' ## Files Changed - 36 files changed, 5642 insertions(+), 4451 deletions(-) - Removed deprecated documentation files - Cleaned up unused services and models This release represents a major refactoring focused on speed, accuracy, and maintainability.
23 KiB
Best Practices for Debugging with Cursor: Becoming a Senior Developer-Level Debugger
Transform Cursor into an elite debugging partner with these comprehensive strategies, workflow optimizations, and hidden power features that professional developers use to maximize productivity.
Core Debugging Philosophy: Test-Driven Development with AI
Write Tests First, Always
The single most effective debugging strategy is implementing Test-Driven Development (TDD) with Cursor. This gives you verifiable proof that code works before deployment1 2 3 .
Workflow:
- Start with: "Write tests first, then the code, then run the tests and update the code until tests pass"1
- Enable YOLO mode (Settings → scroll down → enable YOLO mode) to allow Cursor to automatically run tests, build commands, and iterate until passing1 4
- Let the AI cycle through test failures autonomously—it will fix lint errors and test failures without manual intervention1 5
YOLO Mode Configuration: Add this prompt to YOLO settings:
any kind of tests are always allowed like vitest, npm test, nr test, etc. also basic build commands like build, tsc, etc. creating files and making directories (like touch, mkdir, etc) is always ok too
This enables autonomous iteration on builds and tests1 4 .
Advanced Debugging Techniques
1. Log-Driven Debugging Workflow
When facing persistent bugs, use this iterative logging approach1 6 :
- Tell Cursor: "Please add logs to the code to get better visibility into what is going on so we can find the fix. I'll run the code and feed you the logs results"1
- Run your code and collect log output
- Paste the raw logs back into Cursor: "Here's the log output. What do you now think is causing the issue? And how do we fix it?"1
- Cursor will propose targeted fixes based on actual runtime behavior
For Firebase Projects: Use the logger SDK with proper severity levels7 :
const { log, info, debug, warn, error } = require("firebase-functions/logger");
// Log with structured data
logger.error("API call failed", {
endpoint: endpoint,
statusCode: response.status,
userId: userId
});
2. Autonomous Workflow with Plan-Approve-Execute Pattern
Use Cursor in Project Manager mode for complex debugging tasks5 8 :
Setup .cursorrules file:
You are working with me as PM/Technical Approver while you act as developer.
- Work from PRD file one item at a time
- Generate detailed story file outlining approach
- Wait for approval before executing
- Use TDD for implementation
- Update story with progress after completion
Workflow:
- Agent creates story file breaking down the fix in detail
- You review and approve the approach
- Agent executes using TDD
- Agent runs tests until all pass
- Agent pushes changes with clear commit message5 8
This prevents the AI from going off-track and ensures deliberate, verifiable fixes.
Context Management Mastery
3. Strategic Use of @ Symbols
Master these context references for precise debugging9 10 :
@Files- Reference specific files@Folders- Include entire directories@Code- Reference specific functions/classes@Docs- Pull in library documentation (add libraries via Settings → Cursor Settings → Docs)4 9@Web- Search current information online@Codebase- Search entire codebase (Chat only)@Lint Errors- Reference current lint errors (Chat only)9@Git- Access git history and recent changes@Recent Changes- View recent modifications
Pro tip: Stack multiple @ symbols in one prompt for comprehensive context9 .
4. Reference Open Editors Strategy
Keep your AI focused by managing context deliberately11 :
- Close all irrelevant tabs
- Open only files related to current debugging task
- Use
@to reference open editors - This prevents the AI from getting confused by unrelated code11
5. Context7 MCP for Up-to-Date Documentation
Integrate Context7 MCP to eliminate outdated API suggestions12 13 14 :
Installation:
// ~/.cursor/mcp.json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp@latest"]
}
}
}
Usage:
use context7 for latest documentation on [library name]
Add to your cursor rules:
When referencing documentation for any library, use the context7 MCP server for lookups to ensure up-to-date information
Power Tools and Integrations
6. Browser Tools MCP for Live Debugging
Debug live applications by connecting Cursor directly to your browser15 16 :
Setup:
- Clone browser-tools-mcp repository
- Install Chrome extension
- Configure MCP in Cursor settings:
{
"mcpServers": {
"browser-tools": {
"command": "node",
"args": ["/path/to/browser-tools-mcp/server.js"]
}
}
}
- Run the server:
npm start
Features:
- "Investigate what happens when users click the pay button and resolve any JavaScript errors"
- "Summarize these console logs and identify recurring errors"
- "Which API calls are failing?"
- Automatically captures screenshots, console logs, network requests, and DOM state15 16
7. Sequential Thinking MCP for Complex Problems
For intricate debugging requiring multi-step reasoning17 18 19 :
Installation:
{
"mcpServers": {
"sequential-thinking": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-sequential-thinking"]
}
}
}
When to use:
- Breaking down complex bugs into manageable steps
- Problems where the full scope isn't clear initially
- Analysis that might need course correction
- Maintaining context over multiple debugging steps17
Add to cursor rules:
Use Sequential thinking for complex reflections and multi-step debugging
8. Firebase Crashlytics MCP Integration
Connect Crashlytics directly to Cursor for AI-powered crash analysis20 21 :
Setup:
- Enable BigQuery export in Firebase Console → Project Settings → Integrations
- Generate Firebase service account JSON key
- Configure MCP:
{
"mcpServers": {
"crashlytics": {
"command": "node",
"args": ["/path/to/mcp-crashlytics-server/dist/index.js"],
"env": {
"GOOGLE_SERVICE_ACCOUNT_KEY": "/path/to/service-account.json",
"BIGQUERY_PROJECT_ID": "your-project-id",
"BIGQUERY_DATASET_ID": "firebase_crashlytics"
}
}
}
}
Usage:
- "Fetch the latest Crashlytics issues for my project"
- "Add a note to issue xyz summarizing investigation"
- Use
crashlytics:connectcommand for structured debugging flow20 21
Cursor Rules & Configuration
9. Master .cursorrules Files
Create powerful project-specific rules22 23 24 :
Structure:
# Project Overview
[High-level description of what you're building]
# Tech Stack
- Framework: [e.g., Next.js 14]
- Language: TypeScript (strict mode)
- Database: [e.g., PostgreSQL with Prisma]
# Critical Rules
- Always use strict TypeScript - never use `any`
- Never modify files without explicit approval
- Always read relevant files before making changes
- Log all exceptions in catch blocks using Crashlytics
# Deprecated Patterns (DO NOT USE)
- Old API: `oldMethod()` ❌
- Use instead: `newMethod()` ✅
# Common Bugs to Document
[Add bugs you encounter here so they don't recur]
Pro Tips:
- Document bugs you encounter in .cursorrules so AI avoids them in future23
- Use cursor.directory for template examples11 23
- Stack multiple rule files: global rules + project-specific + feature-specific24
- Use
.cursor/rulesdirectory for organized rule management24 25
10. Global Rules Configuration
Set personal coding standards in Settings → Rules for AI11 4 :
- Always prefer strict types over any in TypeScript
- Ensure answers are brief and to the point
- Propose alternative solutions when stuck
- Skip unnecessary elaborations
- Emphasize technical specifics over general advice
- Always examine relevant files before taking action
11. Notepads for Reusable Context
Use Notepads to store debugging patterns and common fixes11 26 27 28 :
Create notepads for:
- Common error patterns and solutions
- Debugging checklists for specific features
- File references for complex features
- Standard prompts like "code review" or "vulnerability search"
Usage: Reference notepads in prompts to quickly load debugging context without retyping27 28 .
Keyboard Shortcuts for Speed
Essential Debugging Shortcuts29 30 31 :
Core AI Commands:
Cmd/Ctrl + K- Inline editing (fastest for quick fixes)1 32 30Cmd/Ctrl + L- Open AI chat30 31Cmd/Ctrl + I- Open Composer30Cmd/Ctrl + Shift + I- Full-screen Composer30
When to use what:
- Use
Cmd+Kfor fast, localized changes to selected code1 32 - Use
Cmd+Lfor questions and explanations31 - Use
Cmd+I(Composer) for multi-file changes and complex refactors32 4
Navigation:
Cmd/Ctrl + P- Quick file open29 33Cmd/Ctrl + Shift + O- Go to symbol in file33Ctrl + G- Go to line (for stack traces)33F12- Go to definition29
Terminal:
- `Cmd/Ctrl + `` - Toggle terminal29 30
Cmd + Kin terminal - Clear terminal (note: may need custom keybinding)34 35
Advanced Workflow Strategies
12. Agent Mode with Plan Mode
Use Plan Mode for complex debugging36 37 :
- Hit
Cmd+Nfor new chat - Press
Shift+Tabto toggle Plan Mode - Describe the bug or feature
- Agent researches codebase and creates detailed plan
- Review and approve before implementation
Agent mode benefits:
- Autonomous exploration of codebase
- Edits multiple files
- Runs commands automatically
- Fixes errors iteratively37 38
13. Composer Agent Mode Best Practices
For large-scale debugging and refactoring39 5 4 :
Setup:
- Always use Agent mode (toggle in Composer)
- Enable YOLO mode for autonomous execution5 4
- Start with clear, detailed problem descriptions
Workflow:
- Describe the complete bug context in detail
- Let Agent plan the approach
- Agent will:
- Pull relevant files automatically
- Run terminal commands as needed
- Iterate on test failures
- Fix linting errors autonomously4
Recovery strategies:
- If Agent goes off-track, hit stop immediately
- Say: "Wait, you're way off track here. Reset, recalibrate"1
- Use Composer history to restore checkpoints40 41
14. Index Management
Keep your codebase index fresh11 :
Manual resync: Settings → Cursor Settings → Resync Index
Why this matters:
- Outdated index causes incorrect suggestions
- AI may reference deleted files
- Prevents hallucinations about code structure11
15. Error Pattern Recognition
Watch for these warning signs and intervene1 42 :
- AI repeatedly apologizing
- Same error occurring 3+ times
- Complexity escalating unexpectedly
- AI asking same diagnostic questions repeatedly
When you see these:
- Stop the current chat
- Start fresh conversation with better context
- Add specific constraints to prevent loops
- Use "explain your thinking" to understand AI's logic42
Firebase-Specific Debugging
16. Firebase Logging Best Practices
Structure logs for effective debugging7 43 :
Severity levels:
logger.debug("Detailed diagnostic info")
logger.info("Normal operations")
logger.warn("Warning conditions")
logger.error("Error conditions", { context: details })
logger.write({ severity: "EMERGENCY", message: "Critical failure" })
Add context:
// Tag user IDs for filtering
Crashlytics.setUserIdentifier(userId)
// Log exceptions with context
Crashlytics.logException(error)
Crashlytics.log(priority, tag, message)
View logs:
- Firebase Console → Functions → Logs
- Cloud Logging for advanced filtering
- Filter by severity, user ID, version43
17. Version and User Tagging
Enable precise debugging of production issues43 :
// Set version
Crashlytics.setCustomKey("app_version", "1.2.3")
// Set user identifier
Crashlytics.setUserIdentifier(userId)
// Add custom context
Crashlytics.setCustomKey("feature_flag", "beta_enabled")
Filter crashes in Firebase Console by version and user to isolate issues.
Meta-Strategies
18. Minimize Context Pollution
Project-level tactics:
- Use
.cursorignoresimilar to.gitignoreto exclude unnecessary files44 - Keep only relevant documentation indexed4
- Close unrelated editor tabs before asking questions11
19. Commit Often
Let Cursor handle commits40 :
Push all changes, update story with progress, write clear commit message, and push to remote
This creates restoration points if debugging goes sideways.
20. Multi-Model Strategy
- Use Claude 3.5 Sonnet for complex reasoning and file generation5 8
- Try different models if stuck
- Some tasks work better with specific models
21. Break Down Complex Debugging
When debugging fails repeatedly39 40 :
- Break the problem into smallest possible sub-tasks
- Start new chats for discrete issues
- Ask AI to explain its approach before implementing
- Use sequential prompts rather than one massive request
Troubleshooting Cursor Itself
When Cursor Misbehaves:
- Check for .mdc glob attachment issues in settings
- Disable workbench/editor auto-attachment if causing crashes46
- Start new chat if context becomes corrupted48
Agent loops:47
- Stop immediately when looping detected
- Provide explicit, numbered steps
- Use "complete step 1, then stop and report" approach
- Restart with clearer constraints
- User rules may not apply automatically - use project .cursorrules instead49
- Test rules by asking AI to recite them
- Check rules are being loaded (mention them in responses)46
Ultimate Debugging Checklist
Before starting any debugging session:
Setup:
- Enable YOLO mode
- Configure .cursorrules with project specifics
- Resync codebase index
- Close irrelevant files
- Add relevant documentation to Cursor docs
During Debugging:
- Write tests first before fixing
- Add logging at critical points
- Use @ symbols to reference exact files
- Let Agent run tests autonomously
- Stop immediately if AI goes off-track
- Commit frequently with clear messages
Advanced Tools (when needed):
- Context7 MCP for up-to-date docs
- Browser Tools MCP for live debugging
- Sequential Thinking MCP for complex issues
- Crashlytics MCP for production errors
Recovery Strategies:
- Use Composer checkpoints to restore state
- Start new chat with git diff context if lost
- Ask AI to recite instructions to verify context
- Use Plan Mode to reset approach
By implementing these strategies systematically, you transform Cursor from a coding assistant into an elite debugging partner that operates at senior developer level. The key is combining AI autonomy (YOLO mode, Agent mode) with human oversight (TDD, plan approval, checkpoints) to create a powerful, verifiable debugging workflow1 5 8 4 . 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
-
https://cursorintro.com/insights/Test-Driven-Development-as-a-Framework-for-AI-Assisted-Development ↩︎
-
https://www.linkedin.com/posts/richardsondx_i-built-tdd-for-cursor-ai-agents-and-its-activity-7330360750995132416-Jt5A ↩︎
-
https://stack.convex.dev/6-tips-for-improving-your-cursor-composer-and-convex-workflow ↩︎
-
https://www.reddit.com/r/cursor/comments/1iga00x/refined_workflow_for_cursor_composer_agent_mode/ ↩︎
-
https://www.sidetool.co/post/how-to-use-cursor-for-efficient-code-review-and-debugging/ ↩︎
-
https://firebase.google.com/docs/functions/writing-and-viewing-logs ↩︎
-
https://forum.cursor.com/t/composer-agent-refined-workflow-detailed-instructions-and-example-repo-for-practice/47180 ↩︎
-
https://www.reddit.com/r/ChatGPTCoding/comments/1hu276s/how_to_use_cursor_more_efficiently/ ↩︎
-
https://www.reddit.com/r/cursor/comments/1jg0in6/i_cut_my_browser_debugging_time_in_half_using_ai/ ↩︎
-
https://skywork.ai/skypage/en/An-AI-Engineer's-Deep-Dive:-Mastering-Complex-Reasoning-with-the-sequential-thinking-MCP-Server-and-Claude-Code/1971471570609172480 ↩︎
-
https://firebase.google.com/docs/crashlytics/ai-assistance-mcp ↩︎
-
https://lobehub.com/mcp/your-username-mcp-crashlytics-server ↩︎
-
https://www.reddit.com/r/cursor/comments/1ik06ol/a_guide_to_understand_new_cursorrules_in_045/ ↩︎
-
https://forum.cursor.com/t/enhanced-productivity-persistent-notepads-smart-organization-and-project-integration/60757 ↩︎
-
https://iroidsolutions.com/blog/mastering-cursor-ai-16-golden-tips-for-next-level-productivity ↩︎
-
https://mehmetbaykar.com/posts/top-15-cursor-shortcuts-to-speed-up-development/ ↩︎
-
https://dev.to/romainsimon/4-tips-for-a-10x-productivity-using-cursor-1n3o ↩︎
-
https://skywork.ai/blog/vibecoding/cursor-2-0-workflow-tips/ ↩︎
-
https://forum.cursor.com/t/command-k-and-the-terminal/7265 ↩︎
-
https://forum.cursor.com/t/shortcut-conflict-for-cmd-k-terminal-clear-and-ai-window/22693 ↩︎
-
https://forum.cursor.com/t/10-pro-tips-for-working-with-cursor-agent/137212 ↩︎
-
https://ryanocm.substack.com/p/137-10-ways-to-10x-your-cursor-workflow ↩︎
-
https://forum.cursor.com/t/add-the-best-practices-section-to-the-documentation/129131 ↩︎
-
https://www.siddharthbharath.com/coding-with-cursor-beginners-guide/ ↩︎
-
https://www.letsenvision.com/blog/effective-logging-in-production-with-firebase-crashlytics ↩︎
-
https://www.ellenox.com/post/mastering-cursor-ai-advanced-workflows-and-best-practices ↩︎
-
https://forum.cursor.com/t/best-practices-setups-for-custom-agents-in-cursor/76725 ↩︎
-
https://www.reddit.com/r/cursor/comments/1jtc9ej/cursors_internal_prompt_and_context_management_is/ ↩︎
-
https://forum.cursor.com/t/endless-loops-and-unrelated-code/122518 ↩︎
-
https://forum.cursor.com/t/auto-injected-summarization-and-loss-of-context/86609 ↩︎
-
https://www.codecademy.com/article/how-to-use-cursor-ai-a-complete-guide-with-practical-examples ↩︎
-
https://launchdarkly.com/docs/tutorials/cursor-tips-and-tricks ↩︎
-
https://www.reddit.com/r/programming/comments/1g20jej/18_observations_from_using_cursor_for_6_months/ ↩︎
-
https://forum.cursor.com/t/composer-agent-refined-workflow-detailed-instructions-and-example-repo-for-practice/47180/5 ↩︎
-
https://hackernoon.com/two-hours-with-cursor-changed-how-i-see-ai-coding ↩︎
-
https://forum.cursor.com/t/how-are-you-using-ai-inside-cursor-for-real-world-projects/97801 ↩︎
-
https://forum.cursor.com/t/guide-a-simpler-more-autonomous-ai-workflow-for-cursor-new-update/70688 ↩︎
-
https://forum.cursor.com/t/good-examples-of-cursorrules-file/4346 ↩︎
-
https://patagonian.com/cursor-features-developers-must-know/ ↩︎
-
https://forum.cursor.com/t/ai-test-driven-development/23993 ↩︎
-
https://www.reddit.com/r/cursor/comments/1iq6pc7/all_you_need_is_tdd/ ↩︎
-
https://forum.cursor.com/t/best-practices-cursorrules/41775 ↩︎
-
https://engineering.monday.com/coding-with-cursor-heres-why-you-still-need-tdd/ ↩︎
-
https://www.reddit.com/r/cursor/comments/1khn8hw/noob_question_about_mcp_specifically_context7/ ↩︎
-
https://www.reddit.com/r/ChatGPTCoding/comments/1if8lbr/cursor_has_mcp_features_that_dont_work_for_me_any/ ↩︎
-
https://forum.cursor.com/t/how-to-debug-localhost-site-with-mcp/48853 ↩︎
-
https://www.mcp-repository.com/use-cases/ai-data-analysis ↩︎
-
https://github.com/firebase/firebase-functions/issues/1439 ↩︎
-
https://www.reddit.com/r/webdev/comments/1k8ld2l/whats_easy_way_to_see_errors_and_logs_once_in/ ↩︎
-
https://stackoverflow.com/questions/51212886/how-to-log-errors-with-firebase-hosting-for-a-deployed-angular-web-app ↩︎
-
https://forum.cursor.com/t/cmd-k-vs-cmd-r-keyboard-shortcuts-default/1172 ↩︎
-
https://forum.cursor.com/t/can-we-reference-docs-files-in-the-rules/23300 ↩︎
-
https://forum.cursor.com/t/cmd-l-l-i-and-cmd-k-k-hotkeys-to-switch-between-models-and-chat-modes/2442 ↩︎
-
https://www.reddit.com/r/cursor/comments/1gqr207/can_i_mention_docs_in_cursorrules_file/ ↩︎
-
https://forum.cursor.com/t/how-to-reference-symbols-like-docs-or-web-from-within-a-text-prompt/66850 ↩︎
-
https://forum.cursor.com/t/tired-of-cursor-not-putting-what-you-want-into-context-solved/75682 ↩︎
-
https://www.reddit.com/r/vscode/comments/1frnoca/which_keyboard_shortcuts_do_you_use_most_but/ ↩︎
-
https://forum.cursor.com/t/fixing-basic-features-before-adding-new-ones/141183 ↩︎