Cursor Agent Workflows

James Phoenix
James Phoenix

Practical patterns for maximizing coding agent effectiveness in day-to-day development.


Core Insight

“Agents perform best when they have a clear target to iterate against.”

The most productive agent workflows combine upfront planning with verifiable goals. Planning forces clear thinking; verifiable goals (tests, types, linters) give agents concrete success signals.


Plan Mode: Research Before Code

Use Plan Mode (Shift+Tab in Cursor) for complex features:

  1. Research the codebase for relevant files
  2. Clarify requirements before implementing
  3. Generate detailed implementation plans with file paths
  4. Wait for approval before writing code

When to plan:

  • Complex features requiring multiple file changes
  • Unfamiliar domains needing research
  • Multi-day projects

When to skip:

  • Quick fixes in familiar territory
  • Small, isolated changes

Recovery principle: When agent output misses the mark, revert changes and refine the plan. This yields cleaner results than follow-up corrections.


Context Management

Let Agents Search

Don’t manually tag every file. Agents have powerful semantic and grep search capabilities. Including irrelevant files confuses the agent about what’s important.

Fresh Conversations vs. Long Context

Start fresh when:

  • Shifting to a different task
  • Agent becomes confused or repetitive
  • Completing a logical work unit

Continue when:

  • Iterating on the same feature
  • Agent needs earlier context
  • Debugging code it just built

“Long conversations cause agents to lose focus. After many turns and summarizations, context accumulates noise.”


Rules: Static Project Context

Create .cursor/rules/ markdown files for project-specific guidance:

# Commands
- `npm run build`: Build the project
- `npm run typecheck`: Run typechecker

# Code Style
- Use ES modules (import/export), not CommonJS
- Reference `components/Button.tsx` for component structure

# Workflow
- Always typecheck after code changes

Best practices for rules:

  • Keep focused on essentials
  • Reference canonical files (don’t copy content)
  • Avoid duplicating style guides (use linters)
  • Start simple—add rules only when you notice repeated mistakes

TDD Pattern for Agents

Test-driven development gives agents clear targets:

  1. Request tests for input/output pairs; mention TDD explicitly to avoid mock implementations
  2. Run tests, confirm failure without implementation
  3. Commit tests when satisfied
  4. Request implementation, forbid test modifications
  5. Iterate until tests pass
  6. Commit implementation

This works because agents iterate effectively against concrete pass/fail signals.


Visual Input

Design-to-Code

Paste design mockups and request implementation. Agents match layouts, colors, and spacing effectively.

Visual Debugging

Screenshot unexpected behavior rather than describing it verbally. Visual context often communicates better than text descriptions.


Git Workflow Automation

Example /pr skill structure:

  1. Review staged/unstaged changes with git diff
  2. Write clear commit message
  3. Commit and push to current branch
  4. Use gh pr create with title/description
  5. Return PR URL

Useful automated commands:

  • /fix-issue [number]: Fetch issue → find code → implement fix → open PR
  • /review: Run linters → check common issues → summarize concerns
  • /update-deps: Update dependencies with testing between each

Parallel Execution

Git Worktrees

Use worktrees for isolated parallel agent execution—each agent operates in its own checkout without conflicts.

Cloud Agents

Delegate tasks discovered mid-work:

  • Bug fixes
  • Code refactors
  • Test generation
  • Documentation updates

Cloud agents clone the repo, create a branch, work autonomously, and open a PR when complete.


Debug Mode for Difficult Bugs

Evidence-based debugging for reproducible but unclear issues:

  1. Generate multiple hypotheses about wrong state
  2. Instrument code with logging statements
  3. Reproduce bug while collecting runtime data
  4. Analyze actual behavior to identify root cause
  5. Apply targeted fixes based on evidence

Best for: Race conditions, performance issues, regressions, state bugs.


Five Developer Traits for Agent Effectiveness

  1. Write specific prompts: “Write a test case for auth.ts covering the logout edge case, using patterns in __tests__/ and avoiding mocks”

  2. Iterate on setup: Begin simple. Add rules only after noticing repeated mistakes

  3. Review carefully: “AI code can appear correct while containing subtle errors. The faster the agent works, the more important your review process becomes”

    Udemy Bestseller

    Learn Prompt Engineering

    My O'Reilly book adapted for hands-on learning. Build production-ready prompts with practical exercises.

    4.5/5 rating
    306,000+ learners
    View Course
  4. Provide verifiable goals: Use typed languages, configure linters, write tests. Give agents clear success signals

  5. Treat agents as collaborators: Request plans, ask for explanations, push back on approaches you dislike


Key Principle

“Planning reduces rework. Verifiable goals drive quality. Fresh starts beat long conversations.”

The patterns evolve with newer models, but the core insight remains: agents amplify developer effectiveness proportional to the clarity of goals and constraints provided.


Related

Topics
Agent WorkflowsAi AgentsContext ManagementDeveloper ExperienceProductivity

More Insights

Cover Image for Thought Leaders

Thought Leaders

People to follow for compound engineering, context engineering, and AI agent development.

James Phoenix
James Phoenix
Cover Image for Systems Thinking & Observability

Systems Thinking & Observability

Software should be treated as a measurable dynamical system, not as a collection of features.

James Phoenix
James Phoenix