๐ New in Agentforce for Developers: Custom AI Code Generation Rules
๐ง ๐ป
One of the most common pieces of feedback we've heard from you is:
Starting today, you can fix that. โจ Weโre excited to introduce
AI Customization Rules in Agentforce for Developers - a new way to tailor how the Dev Assistant generates Apex and LWC code based on yourprojectโs standards and preferences.
๐งฉ Whatโs new?
You can now define coding patterns, architectural guidance, or file-specific preferences in a version-controlled rules.md file, located at: .sfdx/a4d/rules/yourRules.md
Each rule lets you:
- Describe when and why it applies
- Specify what file types it should affect (like .cls, .js, or .html)
- Give detailed instructions the AI should follow when generating code
๐ง Why it matters
You get:
- More relevant, customized AI code suggestions
- Better alignment with your team's architecture and naming conventions
- Less manual rework of generated code
๐ก Example Use Cases
- Want to enforce consistent test scaffolding in LWC? Add a rule.
- Have naming or structure conventions for JS files? You're covered.
# Rule: Apex Naming Conventions
**Description:** Enforce naming guidelines for Apex classes and methods.
**Applies to:** `**/*.cls`
**Guidelines:**
- Class names must be in PascalCase
๐
How to get started- Create the .sfdx/a4d/rules/yourRules.md file in your project
- Add one or more rules using the format above
- Thatโs it! The AI will automatically use matching rules whenever it generates code
๐ For now, rules are managed manually - but stay tuned: weโre working on further UX to help you create rules more easily right inside VS Code.