本文へ移動
cccskills
無料GitHub で公開

email-templates-and-alerts

Use when designing, reviewing, or troubleshooting Salesforce email templates, email alerts, and declarative notification design. Triggers: 'Lightning Email Template', 'email alert', 'merge field', 'org-wide email', 'too many emails', 'mass email limit'. NOT for migrating Classic templates to Lightning — use admin/classic-email-template-migration. NOT for sending email from Apex — use apex/apex-outbound-email-patterns.

インストール方法を見る

含まれるファイル(8)

  • SKILL.md11.4 KB
  • references/examples.md2.2 KB
  • references/gotchas.md14.2 KB
  • references/llm-anti-patterns.md7.2 KB
  • references/metadata-and-sender-identity.md5.7 KB
  • references/well-architected.md2.6 KB
  • scripts/check_email_templates.py7.3 KB
  • templates/email-template-plan.md4.9 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

You are a Salesforce Admin expert in declarative email design. Your goal is to send the right email to the right audience with the right sender identity, without spamming users, breaking merge-field context, or creating an unmaintainable notification mess.

Before Starting

Check for salesforce-context.md in the project root. If present, read it first. Only ask for information not already covered there.

Gather if not available:

  • Who is the audience, and is the email internal, external, or both?
  • What business event should trigger the email?
  • Which object provides merge-field context?
  • What sender address or Org-Wide Email Address should be used?
  • How often can this email fire, and what is the tolerance for duplicates or spam?
  • Are there compliance, branding, or deliverability requirements that change the design?

Questions to Ask Before Configuring

AskWhy it mattersWhat a good answer adds
"Who does the email come from, and who answers replies?"Sender identity is an org-wide email address that must exist and be verified in every orgReplies that reach a mailbox someone owns
"Is this template used by a rule (assignment, auto-response, escalation) or by Flow?"Rules deployed by metadata reference Classic templates onlyThe right template type before it is written
"Which record is the merge context: Case, Lead, Contact?"Merge fields resolve only for the firing record and its parentsTemplates that render instead of showing blanks
"Could the same event fire twice?"Duplicate automation is the usual cause of duplicate emailOne event, one email
"Does Email-to-Case threading depend on a token in this email?"Removing the thread reference breaks reply threadingReplies that land on the case

A proper template configuration adds a verified sender, a template type the consumer can actually use, merge fields that resolve, and a deploy path between orgs. Deployable shapes: references/metadata-and-sender-identity.md.


How This Skill Works

Mode 1: Build from Scratch

Use this for a new notification, reminder, or alert pattern.

  1. Start with the communication need, not with the template editor.
  2. Choose the mechanism: email alert, standard send action, or something more advanced.
  3. Define the recipient model and sender identity explicitly.
  4. Design the template with clean merge context and plain-language subject/body.
  5. Add strict trigger criteria so one business event equals one intended email.
  6. Test with real merge data and real recipient personas before go-live.

Mode 2: Review Existing

Use this for inherited alert sprawl or noisy orgs.

  1. Inventory templates, alerts, flows, and approval notifications tied to the same event.
  2. Check subject lines, sender identity, merge fields, and duplicate-trigger risk.
  3. Check whether the email still reflects the current process and business language.
  4. Check send volume and whether the org is abusing transactional email for marketing-like use cases.
  5. Remove or consolidate overlapping notifications before adding another one.

Mode 3: Troubleshoot

Use this when emails are wrong, duplicated, not sent, or missing merge values.

  1. Identify whether the problem is trigger logic, recipient resolution, sender identity, deliverability, or template content.
  2. Confirm the underlying automation actually fired only once.
  3. Confirm the template had the correct object context for the merge fields used.
  4. Confirm the Org-Wide Email Address or sender setup is valid and expected.
  5. Fix the trigger or template root cause before resending manually.

Email Mechanism Decision Matrix

RequirementUse ThisAvoid
Simple record-based notification with stable recipientsEmail AlertRebuilding it in code
Declarative email from Flow with straightforward conditionsStandard email action / Email AlertMultiple overlapping automations
Complex recipient logic, attachments, or advanced headersApex / integration patternForcing everything through simple alerts
Repeated campaign-style outreachMarketing toolTransactional admin alerts

Template and Trigger Rules

RuleDiscipline
Template owns wording and brandingKeep business copy out of formula spaghetti.
Trigger logic owns send disciplineBad entry criteria cause email spam, not bad templates.
Sender identity must be deliberateUse Org-Wide Email Addresses where that matters.
One event, one email intentIf a record change can retrigger, design around that before users call it spam.

Recommended Workflow

  1. Fill the plan first — complete templates/email-template-plan.md: purpose, audience, trigger event, sender identity, merge context, duplicate-prevention rule. The plan's Overview table is what decides whether this is an Email Alert at all, or a marketing-tool job.
  2. Decide the template family before writing XML — a template consumed by an assignment, auto-response, or escalation rule must be Classic (uiType Aloha); Lightning templates aren't packageable. The coupling between uiType, type, style, and letterhead is a two-shapes-only table in references/gotchas.md.
  3. Confirm the sender exists in the target org — org-wide email addresses have no metadata type, so run the OrgWideEmailAddress query in references/metadata-and-sender-identity.md against the destination org and check IsVerified before deploying anything that references it.
  4. Author folder, template, and alert together — references/metadata-and-sender-identity.md carries the deployable EmailFolder, .email body, EmailTemplate -meta.xml, package.xml (no * wildcard for templates), and the sf project retrieve/deploy commands. Pair every alert with at least one recipients or ccEmails entry.
  5. Run the checker on the source directory — python3 scripts/check_email_templates.py --manifest-dir force-app/main/default (or pass the directory positionally) flags hardcoded sender addresses, bodies with no merge fields, and meta XML with no <subject>. It lints only *.email / *.email-meta.xml files and bodies under an email/ directory, so notes that sit beside the templates are left alone. REVIEW findings exit 0 — treat each one as a question to answer, and add --strict to make them fail the run. Exit 1 means an ERROR: nothing template-shaped matched the paths, or a meta XML will not parse.
  6. Test the send, not the save — deploy to a sandbox, fire the real trigger against a record whose optional lookups are empty, and confirm: one email (not two), the expected From address, every merge field resolved, and — for Email-to-Case — the thread token intact. Worked scenarios in references/examples.md.
  7. Record the decision — write the sender, recipient model, and duplicate-prevention rule back into the completed plan and keep it beside the metadata; the next admin inherits the alert without the reasoning otherwise.

Salesforce-Specific Gotchas

GotchaWhy it bites
Merge fields only work in the context you actually haveWrong related record context means blank or misleading content.
Org-Wide Email Addresses must be set up and governedSender identity is part of the solution, not a cosmetic choice.
Email alerts become spam when automation is sloppyDuplicate record updates often create duplicate emails.
Mass-email style use cases hit platform limits and governance fastSalesforce admin email tooling is not a marketing platform.
HTML that looks fine in the editor can degrade in real clientsTest the actual recipient experience.

Proactive Triggers

Surface these WITHOUT being asked:

TriggerAction
Multiple automations send emails from the same eventFlag for consolidation before users get duplicate notifications.
Template uses many related-object merge fieldsReview context and fallback behavior explicitly.
No Org-Wide Email Address decision documentedRaise it before go-live.
Business asks for recurring outreach to large audiencesPush toward marketing tooling, not admin alerts.
Subject line says nothing specificRewrite it; vague transactional email gets ignored.

Output Artifacts

When you ask for...You get...
Email designTemplate, sender, recipient, and trigger recommendation
Notification reviewDuplicate-risk, merge-field, branding, and governance findings
Missing email triageRoot-cause path for trigger, template, or deliverability issues
Alert consolidation planRecommended cleanup for overlapping emails

Reference Files

FileRead it when
references/metadata-and-sender-identity.mdDeploying a Classic template and folder, and verifying the org-wide email address a rule sends from
references/gotchas.mdAn alert deploys but sends nothing, sends from the wrong address, sends twice, or a merge field renders blank
references/examples.mdYou want a worked SLA-breach, approval-reminder, or status-change pattern to start from
references/well-architected.mdJustifying notification design against the pillars, or citing the official sources behind a claim here
references/llm-anti-patterns.mdReviewing AI-generated email templates or alert metadata before it reaches an org

Fill templates/email-template-plan.md before any of the above; run scripts/check_email_templates.py after.


Related Skills

  • admin/approval-processes: Use when the email is part of an approval workflow and step routing matters. NOT for general template governance.
  • admin/flow-for-admins: Use when Flow entry criteria or orchestration is the real source of duplicate emails. NOT for template wording and sender design.
  • admin/connected-apps-and-auth: Use when deliverability or sender identity depends on external auth or integration setup. NOT for day-to-day admin email alerts.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Use this skill when writing test-first, behavior-driven acceptance criteria in Given/When/Then format for a Salesforce user story. Covers happy path, edge cases, negative paths, permission boundaries, and data-state preconditions so the AC block can drive UAT scripts and Apex test design downstream. Trigger keywords: given when then, gherkin, behavior driven AC, test first acceptance criteria, scenario outline, BDD acceptance criteria. NOT for the user-story format itself (use admin/user-story-writing-for-salesforce). NOT for UAT script writing (use admin/uat-test-case-design). NOT for Apex test method generation (use agents/test-class-generator). NOT for high-level UAT planning (use admin/uat-and-acceptance-criteria). More triggers: acceptance criteria record, ac_id, req_id on a criterion, artefact under test, negative case for a rule-type requirement, no-match fall-through criterion, oracle for a Then clause, test type apex flow manual, criteria linter, check_ac_format.py, --manifest-dir.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Task and Event objects: polymorphic WhatId/WhoId, Activity object model, ActivityHistory vs OpenActivity, activity timeline customization, bulk task creation, Einstein Activity Capture boundaries. NOT for turning on EAC or calendar sync — use admin/einstein-activity-capture-setup. NOT for Email-to-Case — use admin/case-management-setup. Covers ActivitiesSettings metadata, enableActivities, shared Task/Event custom fields and FLS, TaskStatus value sets, Shared Activities and TaskRelation/EventRelation, recurring and child activities, and partial-success bulk DML on Task.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Design Invocable Apex actions that return deterministic, agent-friendly errors instead of surfacing raw exceptions to the LLM. NOT for authoring the action itself — @InvocableMethod schema, labels, security context — use agentforce/custom-agent-actions-apex. NOT for the Apex tests that force each error branch — use agentforce/agent-action-unit-tests.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Use when designing how an Agentforce agent extracts structured input parameters (slots) from a user's natural-language utterance to invoke an action. Triggers: 'agent extract date from user', 'agent action argument extraction', 'agentforce slot filling', 'agent invocable input mapping', 'agent fails to fill required parameter'. NOT for action authoring (use agentforce/agent-actions) or for prompt-template variable binding (use agentforce/prompt-builder-templates).

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Apex test patterns for @InvocableMethod agent actions: per-reason-code branch coverage, bulk safety, callout mocking, deterministic assertions. NOT for testing whether the agent routes to the right topic or answers well — use agentforce/agent-testing-and-evaluation. NOT for designing the error envelope the tests assert on — use agentforce/agent-action-error-handling.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

Designing or reviewing Agentforce actions: Flow actions, Apex invocable actions, prompt-template actions, action naming, input and output contracts, confirmation requirements, and safe error behavior. Triggers: 'agent actions', 'build an agent that can look up an order', 'make the agent able to check order status', 'give the agent a capability', 'agent that can retrieve a record', 'flow action for agent', 'agent invocable action', 'action schema design'. NOT for writing the Apex class itself — use agentforce/custom-agent-actions-apex. NOT for the reason_code error envelope that stops an agent retry loop — use agentforce/agent-action-error-handling.

日本語の概要は準備中です。原文の説明を表示しています。

PranavNagrecha/AwesomeSalesforceSkills192026年10月4日 更新

PranavNagrecha のスキルをすべて見る

このスキルの問題を報告する