SF Prompt Library — VS Code Extension
A cross-IDE VSIX extension that gives your team a shared library of reusable AI prompts.
Works in VS Code, Cursor, and Antigravity (Windsurf).
How to use
Open the prompt launcher
| Action |
Shortcut |
| Open prompt picker |
Ctrl+Shift+/ (Windows/Linux) |
| Open prompt picker |
Cmd+Shift+/ (Mac) |
| Command Palette |
Ctrl+Shift+P → type SF Prompts |
| Right-click in editor |
Context menu → SF Prompts: Open Prompt Launcher |
With code selected (recommended)
- Select the code you want the prompt to apply to
- Open the launcher (
Ctrl+Shift+/)
- Search and pick a prompt
- The prompt wraps your selected code and is inserted directly into the editor
- Copy and paste into any AI chat (Copilot, Cursor, Claude, etc.)
Without a selection
- Open the launcher
- Pick a prompt
- The resolved prompt text is copied to your clipboard
- Paste into any AI chat
Adding your own prompts
All prompts live in one file: prompts/prompts.json
You do not need to touch any TypeScript. Edit the JSON, rebuild, redistribute the .vsix.
Structure of a prompt entry
{
"id": "my-prompt-id",
"label": "Category: Short Name",
"description": "One line shown under the label in the picker",
"category": "Salesforce",
"template": "Your full prompt text here.\n\n```apex\n{{selected_code}}\n```"
}
Fields
| Field |
Required |
Notes |
id |
✅ |
Unique, no spaces or special chars (e.g. apex-review) |
label |
✅ |
Shown as the main title in the QuickPick menu |
description |
✅ |
Shown as subtitle — keep to one line |
category |
✅ |
Groups prompts with a separator (e.g. Salesforce, General) |
template |
✅ |
The full prompt. Use placeholders (see below) |
Placeholders
| Placeholder |
Replaced with |
{{selected_code}} |
Whatever code the user has highlighted in the editor |
{{file_name}} |
The current file name (e.g. AccountTrigger.cls) |
{{language}} |
The language ID of the current file (e.g. apex, javascript) |
Tips for writing good prompts
- Start with the goal: "Review / Generate / Explain / Convert / Document"
- Be specific about output format: ask for numbered lists, sections with headers, code blocks
- Put
{{selected_code}} at the end of your template so context comes first
- Use markdown headers inside templates — AI models respect them well
- Keep templates under ~800 chars for reliability; longer prompts dilute focus
Example — adding a new Salesforce prompt
{
"id": "sf-permission-set-review",
"label": "SF: Permission Set Review",
"description": "Audit a permission set for over-permissioning",
"category": "Salesforce",
"template": "Review the following Salesforce Permission Set metadata and identify:\n\n1. **Over-permissioning** — any object or field permissions that are broader than needed\n2. **Sensitive access** — Modify All, View All, or access to financial/PII fields\n3. **System permissions** — flag any risky system-level permissions enabled\n4. **Recommendations** — suggest a least-privilege alternative\n\n```xml\n{{selected_code}}\n```"
}
Rebuilding the VSIX after editing prompts
# Install dependencies (first time only)
npm install
# Compile TypeScript
npm run compile
# Package as VSIX
npm run package
# → generates sf-prompts-extension-1.0.0.vsix
Installing the VSIX
VS Code
Extensions panel (Ctrl+Shift+X) → ⋯ menu → Install from VSIX
Cursor
Extensions panel → ⋯ menu → Install from VSIX
Antigravity / Windsurf
Extensions panel → ⋯ menu → Install from VSIX
Or via terminal in any IDE:
code --install-extension sf-prompts-extension-1.0.0.vsix
Included prompt library
Salesforce
| ID |
Name |
Purpose |
apex-code-review |
Apex: Code Review |
Governor limits, FLS, bulkification |
apex-trigger-review |
Apex: Trigger Pattern Check |
Handler pattern, recursion, bulk safety |
apex-soql-optimize |
Apex: SOQL Optimization |
Indexes, row limits, caching |
apex-convert-batch |
Apex: Convert to Batch |
Converts logic to Batch Apex |
flow-document |
Flow: Generate Documentation |
Documents a Flow from XML |
lwc-explain |
LWC: Explain Component |
Structure, data flow, events |
sf-test-class |
Apex: Write Test Class |
Full test class with bulk + edge cases |
sf-metadata-describe |
SF: Describe Metadata |
Explains any SF metadata XML |
General
| ID |
Name |
Purpose |
explain-code |
General: Explain This Code |
Plain English walkthrough |
refactor-code |
General: Refactor for Readability |
DRY, naming, guard clauses |
write-unit-tests |
General: Write Unit Tests |
Happy path, edge cases, mocks |
add-comments |
General: Add JSDoc / Comments |
Documentation comments |
code-review-general |
General: Code Review |
Prioritized feedback (🔴🟡🟢) |
convert-async |
General: Convert to Async/Await |
Replaces callbacks/Promise chains |
Project structure
sf-prompts-extension/
├── src/
│ ├── extension.ts ← Registers commands, QuickPick launcher
│ └── promptLoader.ts ← Loads prompts.json, resolves placeholders
├── prompts/
│ └── prompts.json ← ✏️ EDIT THIS to add/change prompts
├── package.json ← Command declarations and keybindings
├── tsconfig.json
└── README.md ← This file
Versioning prompts
When you update prompts.json, bump the version in package.json before packaging:
"version": "1.1.0"
This makes it easy to track which version of the prompt library each team member has installed.