PranavNagrecha/AwesomeSalesforceSkills / skills/admin/formula-fields
formula-fields
VerifiedUse when designing, reviewing, or troubleshooting Salesforce formula fields. Triggers: 'formula field', 'cross-object formula', 'null handling', 'compile size', 'HYPERLINK', 'IMAGE', 'why is formula slow', 'formulaTreatBlanksAs', 'BlankAsZero', 'blank field handling', 'field-meta.xml formula', 'CustomField formula deploy', 'formula returns blank', 'formula field read-only on data load'. NOT for a formula field slowing a SOQL query or blocking an index — use apex/formula-field-performance-and-limits. NOT for Formula resources inside a Flow — use flow/flow-formula-and-expression-patterns.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 14.2 KB |
| references/examples.md | markdown | 1.4 KB |
| references/gotchas.md | markdown | 9.3 KB |
| references/llm-anti-patterns.md | markdown | 8.6 KB |
| references/metadata-examples.md | markdown | 12.2 KB |
| references/well-architected.md | markdown | 4.3 KB |
| scripts/check_formula_fields.py | script | 8.5 KB |
| templates/formula-field-design-template.md | markdown | 2.4 KB |
templates/formula-field-design-template.md
View on GitHub# Formula Field Design Template
Use this before creating or rewriting a complex formula field.
---
## Overview
| Property | Value |
|----------|-------|
| Field label | _e.g. Open Pipeline Net_ |
| API name | _e.g. `Open_Pipeline_Net__c`_ |
| Return type | Text / Number / Currency / Percent / Checkbox / Date / URL |
| Object | _e.g. Opportunity_ |
| Business purpose | _one sentence; this becomes the field `description`_ |
## Design Checks
| Question | Answer |
|----------|--------|
| Is a formula field the right tool? | _Yes / No — a value that must be frozen, written to, or replicated is a stored field_ |
| If not a formula, what should store the value? | _field + the Flow or Apex that stamps it_ |
| Cross-object references used? | _list each traversal and its hop count_ |
| Null / blank scenarios handled? | _`BlankAsZero` or `BlankAsBlank`, plus the `ISBLANK()` guards the switch does not cover_ |
| Reporting impact considered? | _which reports, list views, exports, and integrations read it_ |
## Formula Draft
```text
_paste the expression here, then paste the XML-escaped version that goes into `<formula>`_
```
## Test Cases
| Scenario | Input | Expected Output |
|----------|-------|-----------------|
| Happy path | _record id + input values_ | _expected result_ |
| Blank value | _record where a referenced field is genuinely null_ | _expected result under the chosen blank handling_ |
| Zero or false value | _record with `0` / unchecked, not blank_ | _expected result, and how it differs from blank_ |
| Cross-object missing parent data | _child with no parent, or parent field empty_ | _expected result_ |
## Documentation
- [ ] Field description updated with business rule
- [ ] Any helper formulas or dependencies documented
- [ ] Decision recorded if formula replaced a stored field or vice versa
## Deploy Checks
- [ ] `<type>` is the return type (`Text` / `Number` / `Currency` / `Percent` / `Checkbox` / `Date`), never `Formula`
- [ ] `<formulaTreatBlanksAs>` written explicitly; `<precision>` and `<scale>` present for numeric return types
- [ ] `&`, `<`, `"` escaped inside `<formula>`; the file parses as XML
- [ ] `package.xml` lists the field as `Object.Field__c` (no `*` wildcard for `CustomField`)
- [ ] `python3 scripts/check_formula_fields.py --manifest-dir <objects dir>` clean, or every finding justified
- [ ] Validate-only deploy (`--dry-run`) passed before the real deploy
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |