mirror of
https://github.com/forcedotcom/afv-library.git
synced 2026-08-03 13:44:09 +08:00
Updated rules file to incliude new Context API MCP server, removed extraneous instructions
1.6 KiB
1.6 KiB
Rule: Salesforce Metadata Generation
Constraints
- Never write without both: metadata type skill loaded AND context tools from
salesforce-api-contextMCP server called for that type. - One type at a time - finish one type before starting the next
- One type per API call - do not batch types when calling MCP tools
- Child types need their own context - if adding any child metadata inside a parent metadata's file, treat the child metadata seperately; don't rely on the parent's schema for creating child metadata
- Max one clarifying question before starting
Workflow
Step 1: Metadata Loop - Execute for Each Type
For each type, execute loop below
a. Load Skill
- Load the metadata type skill once (not per record)
b. Get entity context
- Use these tools from
salesforce-api-contextMCP server for entity context.get_metadata_type_sectionsget_metadata_type_contextget_metadata_type_fieldsget_metadata_type_fields_propertiessearch_metadata_types
Step 2. Verify deployment
sf project deploy start --dry-run -d "force-app/main/default" --target-org <alias> --test-level NoTestRun --wait 10 --json
On failure: attempt to fix the errors and re-run, retrying up to a maximum of 3 times until it succeeds.
Anti-Patterns
| Don't | Why | Do |
|---|---|---|
| Reload skill per record | Wastes tokens | Load once per type |
| Skip metadata skills | Missing platform constraints | Load skill for every type |
| Ask 3+ questions | Token waste | Max 1 question |
| Batch types in calls to MCP tools | Violates constraint | One type per call |