Automated framework for Salesforce org analysis, designed for merger/acquisition due diligence and technical health assessments. This kit combines metadata extraction with AI-driven analysis to identify technical debt, automation conflicts, and migration blockers.
Merging Salesforce orgs requires deep visibility into what exists, what is used, and what is broken. This toolkit provides the raw data and structured AI prompts to turn a black-box org into a clear migration plan.
| Feature | Description |
|---|---|
| Data Inventory | Catalog record counts, identify empty tables, and calculate field usage statistics (population %). |
| Metadata Analysis | Detect "ghost metadata" (fields in XML but 0% usage), hard-coded IDs, and dormant automations. |
| Security Audit | Analyze Profile complexity, Permission Sets, and Sharing Models to assess access risks. |
| Process Mapping | Reverse-engineer sales and delivery processes based on Record Types and Stage history. |
| Risk Assessment | Flag critical migration blockers: Validation Rules, cross-object formulas, and dependencies. |
graph LR
A[Setup Project] --> B[Retrieve Metadata]
B --> C[Export Data & Stats]
C --> D[AI Analysis]
D --> E[Final Reports]
style A fill:#f9f9f9,stroke:#333,stroke-width:2px
style B fill:#f9f9f9,stroke:#333,stroke-width:2px
style C fill:#f9f9f9,stroke:#333,stroke-width:2px
style D fill:#e1f5fe,stroke:#01579b,stroke-width:2px
style E fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px
- Retrieve: Pull XML metadata using the Salesforce CLI.
- Export: Run Python scripts to sample data and calculate field population stats.
- Analyze: Feed the metadata and stats into an AI assistant using the provided prompts.
-
Clone the repository
git clone https://github.com/designthynk/salesforce-org-analysis-kit.git cd salesforce-org-analysis-kit -
Initialize the Project Run the setup script with your target org alias (from
sf org list)../setup.sh [ORG_ALIAS] # Example: ./setup.sh my-org-prodCreates directory structure, installs Python requirements, and generates custom scripts.
Pull the specific metadata needed for analysis. The included package manifest focuses on high-value components.
sf project retrieve start --manifest templates/package.xml --target-org [ORG_ALIAS] --output-dir force-app/[ORG_ALIAS]Run the generated Python script to export samples and calculate field usage.
- Input: Org connection
- Output: CSV samples and
field_stats.csvinscripts/data/
python scripts/export_[ORG_ALIAS].pyOpen docs/PROMPTS.md. This file contains a sequence of prompts to feed into your AI assistant (ChatGPT, Claude, Cursor).
Analysis Sequence:
- Setup: Contextualize the AI with
Prompt 0. - Task 1: Data Summary: Inventory records and overall health.
- Task 1.5: Security: Analyze profiles and sharing rules.
- Task 2: Data Model: Map objects and business processes.
- Task 3: Automation: Audit flows, triggers, and validations.
- Task 4: Tech Debt: Identify unused fields and integrations.
- Task 5: Final Report: Generate the executive summary.
.
├── docs/
│ ├── PROMPTS.md # Structured prompts for AI analysis
│ └── ai-instructions.md # System context for the AI
├── templates/
│ ├── export_data.py # Python script for data export & stats
│ ├── extract_metadata.py # XML parsing utility
│ └── package.xml # Retrieval manifest
├── force-app/ # (Created) Storage for retrieved metadata
├── scripts/ # (Created) Storage for generated scripts & data
├── setup.sh # Initialization script
└── requirements.txt # Python dependencies
This project is licensed under the MIT License - see the LICENSE file for details.