arrow_backBack to Chapter

Module: Good and Bad Patterns

Interactive Module
infoYou're viewing as a guest — progress won't be saved. Sign in to track your progress.

Good and Bad Patterns

Recap how we used Salesforce metadata - this is all good. However, we were micromanaging Cursor - that's not so good.

Reflecting on the Metadata-First Approach

In our previous modules, we leveraged a powerful 'Good Pattern': Metadata-Driven Development. By working directly with Salesforce XML files and the SFDX CLI via Cursor, we bypassed the manual clicks of the Setup UI. This approach is highly effective because LLMs like Cursor are exceptionally good at reading, generating, and structured-editing XML and JSON. This allows for version-controllable changes and rapid deployment cycles that are far more scalable than traditional 'point-and-click' administration.

The Trap of Micromanagement

However, we also engaged in a 'Bad Pattern' that is common for beginners: Micromanaging the Agent. In the previous exercise, you likely gave Cursor specific, step-by-step instructions—telling it exactly which file to open, which line to edit, and which CLI command to run. While this works, it treats Cursor as a simple 'autocomplete' tool rather than a sophisticated engineering agent. When you micromanage, you become the bottleneck, spending more time thinking about the implementation details than the business solution.

Transitioning to Goal-Oriented Prompting

To truly unlock 'Agentic Engineering,' we must move from Imperative Prompting (telling it how) to Declarative Prompting (telling it what). Instead of saying 'Open the Account.field-meta.xml and add a picklist,' a better pattern is to say: 'Add a new picklist field called Industry Segment to the Account object with values X, Y, and Z, and ensure it is visible to the Standard User profile.' This allows Cursor to:

  • Independently locate the correct metadata files.
  • Identify necessary dependencies (like Permission Sets or Layouts).
  • Execute the deployment commands automatically.

Test Your Understanding

Complete this check to unlock the Discovery Checklist and Implementation Guide.

bolt

Knowledge Check

What is the primary downside of 'micromanaging' Cursor by providing step-by-step file instructions?

Why is working with Salesforce metadata (XML/JSON) considered a 'Good Pattern' for AI-assisted engineering?

Which of the following prompts represents a 'Better Pattern' (Declarative/Goal-Oriented)?