Salesforce Managed Package — Message Grammar Audit
Generate an internal remediation report identifying grammatical issues in user-facing messages across a Salesforce managed package. This skill builds on the same extraction pipeline as sf-message-catalog but adds a grammar analysis pass and produces a different output format focused on actionable fixes.
Before You Begin
- Read the docx skill — locate and read the
docx SKILL.md in your available skills. You will generate a .docx using docx-js.
- Check if a recent message catalog exists. If the user has already run
sf-message-catalog and the output is available, you can read that file to extract messages instead of re-querying Salesforce. Ask the user.
- If no catalog exists, follow the same extraction process as
sf-message-catalog (query Tooling API across all five component types). The extraction instructions are identical — refer to that skill for the full Tooling API query patterns and message-detection regex.
- Identify the Salesforce org connector. Ask the user which connected Salesforce org to query. Look for available MCP tools matching
mcp__salesforce-*__tooling_execute. If multiple orgs are connected, ask the user to pick one.
- Identify the managed package namespace prefix (e.g.,
kugo2p).
Phase 1: Extract All Messages
Follow the same five-type extraction as sf-message-catalog:
- Apex Classes + Triggers —
addError(), ApexPages.addMessage(), throw new ...Exception()
- LWC —
ShowToastEvent, setCustomValidity, .catch() handlers, custom error components
- Aura —
force:showToast, component.set("v.errorMessage"), ServerActionService, c:Alert/c:Toast
- VF Pages —
apex:pageMessages, apex:pageMessage, JS alert()/confirm(), conditional panels
- VF Components — inline validation text, watermarks, conditional
apex:outputText
Parallelize extraction across component types using subagents when possible.
For each message, record: component name, method/context, message text, condition, severity, and source type (Apex/LWC/Aura/VF Page/VF Component).
Phase 2: Grammar Analysis
Analyze every extracted message for the following issue categories. This is the core value of this skill — be thorough and precise.
2.1 Article Errors (a/an)
Check every instance of "a" or "an" followed by a word:
- "a" before a vowel sound → should be "an" (e.g., "a Order" → "an Order", "a Invoice" → "an Invoice")
- "an" before a consonant sound → should be "a" (e.g., "an Product" → "a Product")
- Watch for acronyms where pronunciation matters (e.g., "an SQL" is correct, "a URL" is correct)
2.2 Subject-Verb Agreement
Check that subjects and verbs agree in number:
- "One of the Product has" — "Product" should be "Products" (object of "of" is plural)
- "One or more of the product/service do not belong" — singular noun with plural verb
- "line exist" — singular subject needs "exists"
- "There is ... Charge(s)" — "(s)" suffix implies plural, verb should be "are"
2.3 Plural/Singular Mismatches
Check for contradictions between articles and plural markers:
- "an Inactive Product(s)" — "an" contradicts "(s)"
- "has an ... Line(s)" — same pattern
- Fix by either dropping the article or removing the "(s)"
2.4 Spelling and Compound Words
- "Can not" → "Cannot" (one word in standard English)
- "Pricebook" vs "Price Book" — check for consistency within the package
- Common misspellings in technical messages
2.5 Capitalization Consistency
Check for inconsistent mid-sentence capitalization across related messages:
- "contact Roles" vs "Contact Roles" — pick one and flag the inconsistent ones
- Field names used as UI labels should follow a consistent pattern
- Compare across components: if
newQuote uses "Contact Roles" but newOrder uses "contact Roles", flag it
2.6 Punctuation
- Missing periods at the end of complete sentences
- Double periods
- Missing Oxford commas in three-item lists (e.g., "Buying, Shipping and Billing" → "Buying, Shipping, and Billing")
2.7 Cross-Component Inconsistencies
Compare messages that convey the same meaning across different components:
- Quote vs. Order vs. Invoice versions of the same validation should use parallel wording
- "products/services" in one handler but "product/service" in the equivalent handler for another object
- "do not belong to this Pricebook" vs. "do not belong to the Quote Pricebook" — standardize
Priority Assignment
Assign each issue a priority:
| Priority |
Criteria |
| High |
Clear grammar error visible to end users (wrong article, misspelling, broken subject-verb agreement). Fix before next release. |
| Medium |
Agreement mismatch or cross-component inconsistency. Fix when touching the component. |
| Low |
Capitalization or style inconsistency. Fix opportunistically. |
Phase 3: Generate the Report
Create a landscape .docx using docx-js (npm install docx if needed).
Title Page
- Title:
{Package Name} — Grammatical Issue Report
- Subtitle:
Generated {date}
- Tag line:
Internal — For Development Team Use
Summary Section
- Paragraph: total messages scanned, total issues found
- Summary table with columns: Issue Type, High, Medium, Low, Total
- Rows for each category (Article Errors, Subject-Verb Agreement, Plural/Singular, Spelling, Capitalization, Style)
- Bold TOTAL row
Priority Legend
- High (red
#C00000) — Fix before next release
- Medium (amber
#BF8F00) — Fix when touching the component
- Low (blue
#2E75B6) — Fix opportunistically
Detailed Findings Table
An 8-column landscape table:
| # |
Category |
Component |
Source Ref |
Current Message |
Suggested Fix |
Priority |
Issue Description |
Formatting rules:
- Component column: monospace font (
Courier New)
- Source Ref: italic gray text showing component type + line reference (e.g., "Apex — SalesOrderTriggerHandler", "LWC — newOrder")
- Current Message: normal font, exact text as it appears in source
- Suggested Fix: bold green text (
#548235) showing the corrected message
- Priority: color-coded (High=red, Medium=amber, Low=blue), bold, centered
- Issue Description: italic text explaining the specific problem
Document Formatting
- Landscape orientation (15840 x 12240 DXA)
- 0.75" margins (1080 DXA)
- Arial font throughout
- Header: report title right-aligned in gray
- Footer: centered page numbers
- Alternating row shading (
#F2F7FB / #FFFFFF)
- Dark header rows (
#1F4E79 with white text)
Validation
After generating, validate:
python <path-to-docx-skill>/scripts/office/validate.py output.docx
Phase 4: Deliver
Save the file as {PackageName} Grammatical Issue Report.docx and provide the user a link.
Scheduling
This skill is designed to run monthly so the development team can track message quality improvements over time. When scheduling:
- Use cron expression
0 9 1 * * (1st of each month at 9 AM)
- The scheduled prompt should include the namespace prefix and org connector name
- Each run overwrites the previous report
- Consider running this after
sf-message-catalog so the catalog is fresh
Relationship to sf-message-catalog
This skill shares the same Phase 1 extraction pipeline as sf-message-catalog. The difference:
|
sf-message-catalog |
sf-message-grammar-audit |
| Audience |
Customers, end users |
Internal development team |
| Focus |
Complete inventory of all messages |
Only messages with grammatical issues |
| Output |
Full catalog organized by component |
Prioritized remediation report |
| Action |
Reference document |
Fix list with suggested corrections |
If both skills are scheduled, run sf-message-catalog first, then this skill can optionally read the catalog instead of re-querying Salesforce.
1---2name: sf-message-grammar-audit3description: Audit user-facing messages in a Salesforce managed package for grammatical issues and generate a prioritized remediation report. Extracts messages from Apex classes, Apex triggers, LWC, Aura Components, Visualforce Pages, and Visualforce Components — same extraction as sf-message-catalog — then runs each through grammar analysis to flag article errors, subject-verb agreement, plural/singular mismatches, spelling, capitalization, punctuation, and cross-component wording inconsistencies. Produces a .docx report with current message, issue, suggested fix, component reference, and priority. Use when the user mentions 'grammar audit', 'message quality', 'fix error messages', 'grammatical issues', 'proofread messages', 'message consistency', 'clean up error messages', 'improve error messages', or asks to review messages for grammar, spelling, or consistency. Also triggers on 'typos in our messages' or 'message style review'. Internal-facing; can be scheduled monthly.4---56# Salesforce Managed Package — Message Grammar Audit78Generate an internal remediation report identifying grammatical issues in user-facing messages across a Salesforce managed package. This skill builds on the same extraction pipeline as `sf-message-catalog` but adds a grammar analysis pass and produces a different output format focused on actionable fixes.910## Before You Begin11121. **Read the docx skill** — locate and read the `docx` SKILL.md in your available skills. You will generate a .docx using docx-js.132. **Check if a recent message catalog exists.** If the user has already run `sf-message-catalog` and the output is available, you can read that file to extract messages instead of re-querying Salesforce. Ask the user.143. **If no catalog exists**, follow the same extraction process as `sf-message-catalog` (query Tooling API across all five component types). The extraction instructions are identical — refer to that skill for the full Tooling API query patterns and message-detection regex.154. **Identify the Salesforce org connector.** Ask the user which connected Salesforce org to query. Look for available MCP tools matching `mcp__salesforce-*__tooling_execute`. If multiple orgs are connected, ask the user to pick one.165. **Identify the managed package namespace prefix** (e.g., `kugo2p`).1718## Phase 1: Extract All Messages1920Follow the same five-type extraction as `sf-message-catalog`:21221. **Apex Classes + Triggers** — `addError()`, `ApexPages.addMessage()`, `throw new ...Exception()`232. **LWC** — `ShowToastEvent`, `setCustomValidity`, `.catch()` handlers, custom error components243. **Aura** — `force:showToast`, `component.set("v.errorMessage")`, `ServerActionService`, `c:Alert`/`c:Toast`254. **VF Pages** — `apex:pageMessages`, `apex:pageMessage`, JS `alert()`/`confirm()`, conditional panels265. **VF Components** — inline validation text, watermarks, conditional `apex:outputText`2728Parallelize extraction across component types using subagents when possible.2930For each message, record: component name, method/context, message text, condition, severity, and source type (Apex/LWC/Aura/VF Page/VF Component).3132## Phase 2: Grammar Analysis3334Analyze every extracted message for the following issue categories. This is the core value of this skill — be thorough and precise.3536### 2.1 Article Errors (a/an)3738Check every instance of "a" or "an" followed by a word:39- "a" before a vowel sound → should be "an" (e.g., "a Order" → "an Order", "a Invoice" → "an Invoice")40- "an" before a consonant sound → should be "a" (e.g., "an Product" → "a Product")41- Watch for acronyms where pronunciation matters (e.g., "an SQL" is correct, "a URL" is correct)4243### 2.2 Subject-Verb Agreement4445Check that subjects and verbs agree in number:46- "One of the Product **has**" — "Product" should be "Products" (object of "of" is plural)47- "One or more of the product/service **do** not belong" — singular noun with plural verb48- "line **exist**" — singular subject needs "exists"49- "There **is** ... Charge(s)" — "(s)" suffix implies plural, verb should be "are"5051### 2.3 Plural/Singular Mismatches5253Check for contradictions between articles and plural markers:54- "an Inactive Product(s)" — "an" contradicts "(s)"55- "has an ... Line(s)" — same pattern56- Fix by either dropping the article or removing the "(s)"5758### 2.4 Spelling and Compound Words5960- "Can not" → "Cannot" (one word in standard English)61- "Pricebook" vs "Price Book" — check for consistency within the package62- Common misspellings in technical messages6364### 2.5 Capitalization Consistency6566Check for inconsistent mid-sentence capitalization across related messages:67- "contact Roles" vs "Contact Roles" — pick one and flag the inconsistent ones68- Field names used as UI labels should follow a consistent pattern69- Compare across components: if `newQuote` uses "Contact Roles" but `newOrder` uses "contact Roles", flag it7071### 2.6 Punctuation7273- Missing periods at the end of complete sentences74- Double periods75- Missing Oxford commas in three-item lists (e.g., "Buying, Shipping and Billing" → "Buying, Shipping, and Billing")7677### 2.7 Cross-Component Inconsistencies7879Compare messages that convey the same meaning across different components:80- Quote vs. Order vs. Invoice versions of the same validation should use parallel wording81- "products/services" in one handler but "product/service" in the equivalent handler for another object82- "do not belong to this Pricebook" vs. "do not belong to the Quote Pricebook" — standardize8384### Priority Assignment8586Assign each issue a priority:8788| Priority | Criteria |89|----------|----------|90| **High** | Clear grammar error visible to end users (wrong article, misspelling, broken subject-verb agreement). Fix before next release. |91| **Medium** | Agreement mismatch or cross-component inconsistency. Fix when touching the component. |92| **Low** | Capitalization or style inconsistency. Fix opportunistically. |9394## Phase 3: Generate the Report9596Create a landscape .docx using docx-js (`npm install docx` if needed).9798### Title Page99- Title: `{Package Name} — Grammatical Issue Report`100- Subtitle: `Generated {date}`101- Tag line: `Internal — For Development Team Use`102103### Summary Section104- Paragraph: total messages scanned, total issues found105- Summary table with columns: **Issue Type**, **High**, **Medium**, **Low**, **Total**106- Rows for each category (Article Errors, Subject-Verb Agreement, Plural/Singular, Spelling, Capitalization, Style)107- Bold **TOTAL** row108109### Priority Legend110- **High** (red `#C00000`) — Fix before next release111- **Medium** (amber `#BF8F00`) — Fix when touching the component112- **Low** (blue `#2E75B6`) — Fix opportunistically113114### Detailed Findings Table115116An 8-column landscape table:117118| # | Category | Component | Source Ref | Current Message | Suggested Fix | Priority | Issue Description |119|---|----------|-----------|------------|-----------------|---------------|----------|-------------------|120121Formatting rules:122- **Component** column: monospace font (`Courier New`)123- **Source Ref**: italic gray text showing component type + line reference (e.g., "Apex — SalesOrderTriggerHandler", "LWC — newOrder")124- **Current Message**: normal font, exact text as it appears in source125- **Suggested Fix**: bold green text (`#548235`) showing the corrected message126- **Priority**: color-coded (High=red, Medium=amber, Low=blue), bold, centered127- **Issue Description**: italic text explaining the specific problem128129### Document Formatting130- Landscape orientation (15840 x 12240 DXA)131- 0.75" margins (1080 DXA)132- Arial font throughout133- Header: report title right-aligned in gray134- Footer: centered page numbers135- Alternating row shading (`#F2F7FB` / `#FFFFFF`)136- Dark header rows (`#1F4E79` with white text)137138### Validation139After generating, validate:140```bash141python <path-to-docx-skill>/scripts/office/validate.py output.docx142```143144## Phase 4: Deliver145146Save the file as `{PackageName} Grammatical Issue Report.docx` and provide the user a link.147148## Scheduling149150This skill is designed to run monthly so the development team can track message quality improvements over time. When scheduling:151- Use cron expression `0 9 1 * *` (1st of each month at 9 AM)152- The scheduled prompt should include the namespace prefix and org connector name153- Each run overwrites the previous report154- Consider running this after `sf-message-catalog` so the catalog is fresh155156## Relationship to sf-message-catalog157158This skill shares the same Phase 1 extraction pipeline as `sf-message-catalog`. The difference:159160| | sf-message-catalog | sf-message-grammar-audit |161|---|---|---|162| **Audience** | Customers, end users | Internal development team |163| **Focus** | Complete inventory of all messages | Only messages with grammatical issues |164| **Output** | Full catalog organized by component | Prioritized remediation report |165| **Action** | Reference document | Fix list with suggested corrections |166167If both skills are scheduled, run `sf-message-catalog` first, then this skill can optionally read the catalog instead of re-querying Salesforce.