sf-agent-framework
Version:
AI Agent Orchestration Framework for Salesforce Development - Two-phase architecture with 70% context reduction
367 lines (276 loc) • 6.91 kB
Markdown
# Metrics Tracker Utility - Agent Instructions
## Purpose
This utility provides instructions for AI agents to generate comprehensive
metrics tracking solutions for Salesforce implementations, enabling
organizations to monitor KPIs, track performance, and measure business outcomes
effectively.
## Agent Instructions
### When to Generate Metrics Tracking
Generate metrics tracking components when:
- Organizations need KPI monitoring
- Performance metrics require tracking
- Business outcomes need measurement
- Center of Excellence needs metrics
- Adoption tracking is required
- ROI calculation is needed
- Compliance metrics need monitoring
### Core Components to Generate
#### 1. Metrics Collection Framework
Generate collection components that:
- Automate metric data gathering
- Schedule periodic collections
- Handle real-time metric events
- Process batch calculations
- Store historical data
- Manage metric snapshots
Key collection patterns:
- Scheduled batch collection
- Real-time event tracking
- API-based collection
- User activity monitoring
- System performance capture
- Business process metrics
#### 2. Metric Calculation Engine
Create calculation components for:
- Complex formula processing
- Statistical calculations
- Trend analysis
- Predictive modeling
- Aggregation logic
- Weighted scoring
#### 3. Metrics Storage Architecture
Implement storage for:
- Current metric values
- Historical data retention
- Trend information
- Benchmark data
- Target tracking
- Alert thresholds
### Configuration Requirements
#### Custom Objects
```yaml
Metric_Definition__c:
- Name (Text)
- Category__c (Picklist)
- Description__c (Text Area)
- Formula__c (Long Text Area)
- Unit__c (Picklist)
- Frequency__c (Picklist)
- Target__c (Number)
- Threshold__c (Number)
- Owner__c (Lookup to User)
- Data_Source__c (Text)
- Active__c (Checkbox)
Metric_Value__c:
- Metric_Definition__c (Master-Detail)
- Value__c (Number)
- Date__c (Date)
- Period__c (Text)
- Trend__c (Number)
- Status__c (Picklist)
- Notes__c (Text Area)
Metric_Alert_Rule__c:
- Metric_Definition__c (Lookup)
- Operator__c (Picklist)
- Threshold_Value__c (Number)
- Alert_Recipients__c (Text)
- Alert_Message__c (Text Area)
- Active__c (Checkbox)
```
### Metric Categories to Support
#### Operational Metrics
- System performance indicators
- User adoption rates
- Data quality scores
- Process efficiency metrics
- Support effectiveness
#### Business Metrics
- Revenue impact
- Cost savings
- Productivity gains
- Customer satisfaction
- Time to market
#### Technical Metrics
- Code quality scores
- Test coverage percentages
- API performance
- Governor limit usage
- Security compliance
#### CoE Metrics
- Service delivery rates
- Innovation index
- Knowledge sharing metrics
- Standardization rates
- Platform maturity
### Calculation Formulas to Implement
#### User Adoption Rate
```
Adoption Rate = (Active Users / Total Users) × 100
Where Active Users = Users logged in within period
```
#### Data Quality Score
```
Quality Score = ((Total Records - Quality Issues) / Total Records) × 100
Where Quality Issues = Duplicates + Incomplete + Invalid
```
#### ROI Calculation
```
ROI = ((Benefits - Costs) / Costs) × 100
```
#### Platform Efficiency
```
Efficiency = Weighted Average of:
- API Usage (% of limit)
- Storage Usage (% of limit)
- License Utilization (% used)
```
### Implementation Patterns
#### Scheduled Collection Pattern
1. Define collection schedule
2. Query metric data sources
3. Apply calculations
4. Store metric values
5. Check alert conditions
6. Update dashboards
#### Real-time Event Pattern
1. Capture platform events
2. Process metric updates
3. Calculate running totals
4. Update live dashboards
5. Trigger instant alerts
#### Historical Analysis Pattern
1. Retrieve historical data
2. Calculate trends
3. Perform regression analysis
4. Generate predictions
5. Identify patterns
### Dashboard Components to Generate
#### Executive Metrics View
Display:
- Key metric cards
- Trend indicators
- Target vs actual
- Period comparisons
- Alert status
- Quick insights
#### Operational Dashboard
Show:
- Real-time metrics
- Process indicators
- Team performance
- System health
- Queue metrics
- SLA tracking
#### Analytical View
Include:
- Historical trends
- Correlation analysis
- Predictive models
- What-if scenarios
- Comparative analysis
- Export capabilities
### Alert Configuration
#### Alert Rules Engine
Generate alerts for:
- Threshold breaches
- Trend deviations
- Target misses
- Anomaly detection
- SLA violations
- Compliance issues
#### Notification Channels
- Email alerts
- Chatter posts
- Mobile push
- Slack integration
- Teams notifications
- SMS for critical
### Reporting Templates
#### Executive Report
```
Platform Health Score: [Score]% [Trend]
User Adoption: [Value]% [Status]
Data Quality: [Value]% [Status]
Cost per Transaction: $[Value] [Trend]
ROI: [Value]% [Period]
```
#### Detailed Metrics Report
Include sections for:
- Executive summary
- Metric categories
- Trend analysis
- Alert summary
- Recommendations
- Action items
### Best Practices to Implement
1. **Metric Design**
- Use SMART criteria
- Make metrics actionable
- Balance leading/lagging
- Automate collection
- Enable visualization
2. **Data Collection**
- Minimize manual entry
- Validate data quality
- Handle missing data
- Implement error handling
- Monitor performance
3. **Calculation Accuracy**
- Document formulas
- Test edge cases
- Handle nulls/zeros
- Version calculations
- Validate results
4. **Stakeholder Management**
- Define ownership
- Regular reviews
- Clear communication
- Training programs
- Feedback loops
### Advanced Features to Consider
1. **Machine Learning Integration**
- Anomaly detection
- Trend prediction
- Pattern recognition
- Auto-categorization
- Smart alerts
2. **Predictive Analytics**
- Forecast modeling
- What-if analysis
- Risk prediction
- Capacity planning
- Performance forecasting
3. **Integration Capabilities**
- External data sources
- BI tool connectivity
- API endpoints
- Real-time streaming
- Data export
### Error Handling Instructions
Handle these scenarios:
1. Data source unavailable
2. Calculation errors
3. Storage limits
4. Performance issues
5. Permission errors
Recovery strategies:
- Retry mechanisms
- Fallback values
- Error logging
- Manual override
- Alert notifications
### Testing Requirements
Generate test classes for:
1. Metric calculations
2. Collection processes
3. Alert rules
4. Dashboard components
5. Integration points
### Success Metrics
Track and measure:
- Collection reliability
- Calculation accuracy
- Dashboard performance
- Alert effectiveness
- User adoption
- Business impact