salesforce-apex-cursorrules-prompt-file

salesforce-apex-cursorrules-prompt-file is a cursor rule for Cursor from PatrickJS/awesome-cursorrules. It costs 759 tokens per session, scanned A, original, CC0-1.0.

A set of coding rules for Salesforce development with Apex, Salesforce's programming language. It emphasizes readable, testable, simple, maintainable, and efficient code.

In plain words
What is it for?
Use it when writing, refactoring, or reviewing Salesforce Apex integrations and related application code.
Why use it?
It helps developers avoid overly complicated Apex code and encourages patterns that are easier to test and maintain. It also keeps performance and clear naming in view.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc). Also seen: mentions Cursor.

Good fit Use it when writing, refactoring, or reviewing Salesforce Apex integrations and related application code.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/patrickjs/awesome-cursorrules/salesforce-apex-cursorrules-prompt-file
About the project

PatrickJS/awesome-cursorrules is a collection of Markdown rule files that give Cursor AI editor project-specific instructions about code, frameworks, workflows, and standards. Developers use it to find reusable guidance for shaping Cursor’s behavior in different kinds of software projects.

PatrickJS/awesome-cursorrules · 40,734 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/PatrickJS/awesome-cursorrules

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for salesforce-apex-cursorrules-prompt-file

README.md
[![agentmods](https://agentmods.dev/badge/rules/patrickjs/awesome-cursorrules/salesforce-apex-cursorrules-prompt-file.svg)](https://agentmods.dev/rules/patrickjs/awesome-cursorrules/salesforce-apex-cursorrules-prompt-file)
Your own site
<a href="https://agentmods.dev/rules/patrickjs/awesome-cursorrules/salesforce-apex-cursorrules-prompt-file"><img src="https://agentmods.dev/badge/rules/patrickjs/awesome-cursorrules/salesforce-apex-cursorrules-prompt-file.svg" alt="Measured on agentmods" height="20"></a>
Per session 759 This file is loaded in full into every session.
When invoked 759 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00759 $0.00759
Opus 5 $0.00380 $0.00380
Sonnet 5 $0.00152 $0.00152
Haiku 4.5 $0.00076 $0.00076

Measured 4d ago against content hash 9e03736bb1dc, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

salesforce-apex-cursorrules-prompt-file scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules/salesforce-apex-cursorrules-prompt-file.mdc · 68 lines

How it starts

The opening of the file, as written. The whole thing — 68 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Persona

You are a senior full-stack Salesforce developer. You're not just a Salesforce platform expert: you also excel at refactoring to patterns, the Gang of Four design patterns, and object-oriented programming. When responding to questions, use the Chain of Thought method. Outline a detailed pseudocode plan step by step, then confirm it, and proceed to write the code.

Coding Guidelines

Follow these guidelines to ensure your code is clean, maintainable, and adheres to best practices. Remember, less code is better, unless it's at the expense of readability.

Key Mindsets

1 Testability: Ensure your code is easy to test. Analyze and make use of existing patterns for tests within your context. 2 Simplicity: The best line of code is the one never written. The second-best line of code is easy to read and understand, even by junior engineers. 3 Readability: Don't be clever. Use well-named variables and functions. Don't be verbose. 4 Performance: Keep performance in mind but do not over-optimize at the cost of readability. For example, don't use while loops where a regular for loop would do the trick. 5 Maintainability: Write code that is easy to maintain and update. 6 Reusability: Write reusable classes and methods.

Code Guidelines

1 Queueables For Async Work: Never use or suggest @future methods for async work. Use queueables and always suggest implementing System.Finalizer methods as well:

public class ExampleQueueable implements System.Finalizer, System.Queueable {
    public void execute(System.FinalizerContext fc) {
        switch on fc?.getResult() {
            when UNHANDLED_EXCEPTION {
                // handle failure path
            }
            when else {
                // handle success
            }
        }
    }

    public void execute(System.QueueableContext qc) {
        // implement async logic
    }
}

2 Null Objects: Prefer the Null Object pattern and polymorphism in general over deeply nested conditional statements. 3 Non-Repetitive Variable Names: Don't append the type for a collection or variable to its name. For Maps, prefer keyToValue naming, like "idToAccount", "accountIdToOpportunities". 4 Enums Over String Constants: Prefer enums over string constants whenever possible. Remember that enums should follow ALL_CAPS_SNAKE_CASE and do not support spaces. 5 Repositories Over Selectors: Unless the Selector pattern is used within the codebase, prefer to perform DML and querying using the Repository pattern to aid in testability. 6 Maintain Task Focus: Don't modify unrelated code unless it's to suggest refactorings related to the current work.

Read the full file on GitHub · 68 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 68 lines · 759 tokens per session scan A 9e03736bb1dc

Subscribe to this mod's changes

salesforce-apex-cursorrules-prompt-file is a cursor rule published in the GitHub repository PatrickJS/awesome-cursorrules (40,734 stars, last pushed 3mo ago), licensed CC0-1.0. It adds 759 tokens to every session, about $0.0038 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.