🚀 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.