Skip to content

Commit f1a541c

Browse files
committed
feat: initial commit
0 parents  commit f1a541c

File tree

406 files changed

+37187
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

406 files changed

+37187
-0
lines changed

.airules/AGENT_SCRIPT.md

Lines changed: 733 additions & 0 deletions
Large diffs are not rendered by default.

.airules/APEX_RULES.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Apex Requirements
2+
3+
## General Requirements
4+
5+
- Write Invocable Apex that can be called from flows when possible
6+
- Use enums over string constants whenever possible. Enums should follow ALL_CAPS_SNAKE_CASE without spaces
7+
- Use Database Methods for DML Operation with exception handling
8+
- Use Return Early pattern
9+
- Use ApexDocs comments to document Apex classes for better maintainability and readability
10+
11+
## Apex Triggers Requirements
12+
13+
- Follow the One Trigger Per Object pattern
14+
- Implement a trigger handler class to separate trigger logic from the trigger itself
15+
- Use trigger context variables (Trigger.new, Trigger.old, etc.) efficiently to access record data
16+
- Avoid logic that causes recursive triggers, implement a static boolean flag
17+
- Bulkify trigger logic to handle large data volumes efficiently
18+
- Implement before and after trigger logic appropriately based on the operation requirements
19+
20+
## Governor Limits Compliance Requirements
21+
22+
- Always write bulkified code - never perform SOQL/DML operations inside loops
23+
- Use collections for bulk processing
24+
- Implement proper exception handling with try-catch blocks
25+
- Limit SOQL queries to 100 per transaction
26+
- Limit DML statements to 150 per transaction
27+
- Use `Database.Stateful` interface only when necessary for batch jobs
28+
29+
## SOQL Optimization Requirements
30+
31+
- Use selective queries with proper WHERE clauses
32+
- Do not use `SELECT *` - it is not supported in SOQL
33+
- Use indexed fields in WHERE clauses when possible
34+
- Implement SOQL best practices: LIMIT clauses, proper ordering
35+
- Use `WITH SECURITY_ENFORCED` for user context queries where appropriate
36+
37+
## Security & Access Control Requirements
38+
39+
- Run database operations in user mode rather than in the default system mode.
40+
- List<Account> acc = [SELECT Id FROM Account WITH USER_MODE];
41+
- Database.insert(accts, AccessLevel.USER_MODE);
42+
- Always check field-level security (FLS) before accessing fields
43+
- Implement proper sharing rules and respect organization-wide defaults
44+
- Use `with sharing` keyword for classes that should respect sharing rules
45+
- Validate user permissions before performing operations
46+
- Sanitize user inputs to prevent injection attacks
47+
48+
## Prohibited Practices
49+
50+
- No hardcoded IDs or URLs
51+
- No SOQL/DML operations in loops
52+
- No System.debug() statements in production code
53+
- No @future methods from batch jobs
54+
- No recursive triggers
55+
- Never use or suggest `@future` methods for async processes. Use queueables and always suggest implementing `System.Finalizer` methods
56+
57+
## Required Patterns
58+
59+
- Use Builder pattern for complex object construction
60+
- Implement Factory pattern for object creation
61+
- Use Dependency Injection for testability
62+
- Follow MVC pattern in Lightning components
63+
- Use Command pattern for complex business operations
64+
65+
## Unit Testing Requirements
66+
67+
- Maintain minimum 75% code coverage
68+
- Write meaningful test assertions, not just coverage
69+
- Use `Test.startTest()` and `Test.stopTest()` appropriately
70+
- Create test data using `@TestSetup` methods when possible
71+
- Mock external services and callouts
72+
- Do not use `SeeAllData=true`
73+
- Test bulk trigger functionality
74+
75+
## Test Data Management Requirements
76+
77+
- Use `Test.loadData()` for large datasets
78+
- Create minimal test data required for specific test scenarios
79+
- Use `System.runAs()` to test different user contexts
80+
- Implement proper test isolation - no dependencies between tests

0 commit comments

Comments
 (0)