# Solar CRM Test Data Generation Prompt (Claude Chat Version) Generate realistic test data for a solar panel installation company's CRM database using the claris-core-crm MCP tools. ## CORE PRINCIPLE: ATOMIC TRANSACTIONS **CRITICAL:** Create each sales order as a complete atomic unit: 1. Create ONE sales record → capture its ID_PrimaryKey UUID 2. IMMEDIATELY create ALL line items for that order using the fresh UUID 3. IMMEDIATELY verify the line items reference the correct sales order 4. Only then move to the next sales order **NEVER separate sales creation from line items creation!** This prevents UUID sync issues. --- ## SESSION CONTINUITY Since conversations may be interrupted, maintain progress tracking: 1. **Check Database State First:** - Call `list_items_records` (Top: 5) - if solar items exist, Items phase may be complete - Call `list_contacts_records` (Top: 5) - check for solar customer businesses - Call `list_sales_records` (Top: 5) - count existing orders - Use these counts to determine where to resume 2. **Maintain Progress in an Artifact:** - Create an artifact named "Solar CRM Progress Tracker" at the START of data generation - Update the artifact after EVERY successful creation with: - Internal Record ID (for updates/deletes) - ID_PrimaryKey UUID (for foreign keys) - Phase completion status - The artifact serves as the single source of truth for all IDs and progress - If context is lost, the user can paste the artifact content back to resume 3. **Artifact Structure:** ```markdown # Solar CRM Data Generation - Progress Tracker **Started:** [DATE] **Current Phase:** [1-5] **Status:** [In Progress / Complete] --- ## Phase 1: Items | SKU | Description | Internal ID | UUID (IDPrimaryKey) | |-----|-------------|-------------|---------------------| | SOL-PRM-01 | Premium Panel 400W | 12345 | abc-123-... | ## Phase 2: Contacts | Company | Type | Internal ID | UUID (IDPrimaryKey) | |---------|------|-------------|---------------------| | Acme Logistics | Customer | 67890 | def-456-... | ## Phase 3: Additional Contacts | Name | Company | Role | Internal ID | UUID | |------|---------|------|-------------|------| ## Phase 4: Sales Orders | Order # | Company | Type | Date | Internal ID | UUID | Line Items Created | |---------|---------|------|------|-------------|------|--------------------| ## Phase 5: Events & Notes | Type | Company | Internal ID | UUID | |------|---------|-------------|------| --- ## Verification Checklist - [ ] Items: 15-20 created - [ ] Contacts: 5 created - [ ] Additional Contacts: 10-15 created - [ ] Sales: 15-25 created - [ ] Line Items: 60-120 created (no null FKs) - [ ] Events: 5-10 created - [ ] Notes: 5 created ``` --- ## ID FIELD CONVENTIONS **Two types of IDs in API responses:** 1. **Internal Record ID** (root level "ID"): - Integer identifier: `"ID": 19832` - **USE FOR:** update and delete operations 2. **UUID Primary Key** (Fields.IDPrimaryKey): - RFC 4122 UUID: `"Fields": {"IDPrimaryKey": "07270733-EECF-4804-A084-0281D2E37EE8"}` - **USE FOR:** ALL foreign key relationships (IDContact, IDItem, IDSales) --- ## EXECUTION SEQUENCE ### Phase 1: Items (Independent - No Foreign Keys) **Target:** 15-20 solar products **Categories to cover:** - Solar Panels (3-4 types: premium/mid-tier/economy) - Inverters (2-3 types: string/micro/hybrid) - Battery Storage (2 types) - Mounting Hardware (2-3 types: roof/ground/carport) - Electrical Components (2-3 types: disconnects/conduit/wire) - Monitoring Equipment (1-2 types) - Labor (residential vs commercial rates) - Services (permits, engineering, inspections) **Tool:** `create_items_record` for each item **After each creation:** Update the artifact's Phase 1 table with both IDs. **After all items:** Verify with `list_items_records` and mark Phase 1 complete in artifact. --- ### Phase 2: Contacts (Independent - No Foreign Keys) **Target:** 5 companies that would HIRE a solar installer **Business types (NOT solar competitors or residential homeowners):** - Commercial Property Developers - Logistics/Warehousing Companies (large roofs) - Educational Institutions (schools/universities) - Manufacturing Facilities - Agricultural Operations - Municipal Buildings - Healthcare Facilities **Tool:** `create_contacts_record` for each company **After each creation:** Update the artifact's Phase 2 table with Company name, Type=Customer, and both IDs. --- ### Phase 3: Additional Contacts (Immediate FK Validation) **Target:** 2-3 people per company (10-15 total) **Tool:** `create_contacts_additional_record` For EACH company: 1. Get the Contact's IDPrimaryKey UUID from the artifact 2. Create 2-3 Contacts_Additional records with `IDContact` = that UUID 3. Include: decision maker, project manager, facilities director 4. IMMEDIATELY verify with `search_contacts_additional_records` using Filter: `IDContact eq '[uuid]'` 5. Update artifact with each person added 6. If mismatch, fix immediately before proceeding --- ### Phase 4: Sales Orders with Line Items (ATOMIC CREATION) **Target:** 3-5 orders per company spanning 12 months **Tools:** `create_sales_record`, `create_sales_line_items_record`, `search_sales_line_items_records` For EACH company, repeat 3-5 times: 1. **Create ONE Sales Record:** - Type: Estimate, Order, or Invoice (show progression) - IDContact: Use company's UUID from artifact - Set realistic date (span Feb-Sep 2025) - **IMMEDIATELY capture the new order's IDPrimaryKey UUID from the response** - **IMMEDIATELY add to artifact** (mark Line Items as "Pending") 2. **IMMEDIATELY Create Line Items for THIS Order:** - Create 4-8 line items that tell a coherent story - **Every line item gets:** `IDSales` = the UUID you just captured - **Every line item gets:** `IDItem` = product UUID from artifact Phase 1 - Design realistic systems: - Match customer vertical (warehouse → economy panels, school → mid-tier) - Include complementary products (panels + inverter + mounting) - Add appropriate labor (commercial vs residential rate) - Include services (permits + engineering for commercial) - Calculate realistic quantities (kW system size) 3. **IMMEDIATELY Verify This Order:** - Call `search_sales_line_items_records` with Filter: `IDSales eq '[the-uuid-from-step-1]'` - Confirm all line items returned - Confirm IDSales matches exactly - **Update artifact:** Change Line Items status from "Pending" to count (e.g., "6 items") - If ANY mismatch, STOP and fix before proceeding 4. **Only then proceed to next order** **Sales Order Examples:** **Warehouse Customer (Economy Build):** - 80× Tier-1 Economy 370W Panel - 1× SolarEdge 25kW Inverter (commercial) - Aluminum Rail System - Commercial Installation Labor (29.6 kW × $385/kW) - Permit & Inspection Service - ≈ $85K estimate **Private School (Mid-Tier Build):** - 50× LG NeON 400W Panel - 1× Enphase IQ8+ Microinverters - Roof Mounting Kit - Sense Energy Monitor - Commercial Installation Labor (20 kW × $385/kW) - Engineering & Design Service - Permit & Inspection Service - ≈ $68K estimate **Show sales funnel progression:** - Create Estimate (Type: Estimate) - If won → Create Order (Type: Order) with revised quantities - If completed → Create Invoice (Type: Invoice) matching the Order - Some estimates should NOT convert (realistic 60-70% close rate) --- ### Phase 5: Events & Notes (Immediate FK Validation) **Events:** Create 1-2 appointments per company using `create_events_record` - IDContact: Company's UUID from artifact - Align DateDue with sales order dates (site visit before estimate, kick-off after order) - IMMEDIATELY verify IDContact matches - Update artifact **Contacts_Notes:** Create 1 note per company using `create_contacts_notes_record` - IDContact: Company's UUID from artifact - Include: lead source, key stakeholders, business drivers, budget authority, expansion opportunities - IMMEDIATELY verify IDContact matches - Update artifact --- ## VERIFICATION STRATEGY **After creating EACH record or batch:** 1. Query it back immediately using the appropriate `list_` or `search_` tool 2. Check ALL foreign keys are populated (not null) 3. Verify FK values match what you intended 4. If ANY null or mismatch: STOP, investigate, fix before proceeding 5. Update artifact with both IDs and status **Final verification (after all phases):** ``` list_items_records (Top: 25) → Expect 15-20 list_contacts_records (Top: 10) → Expect 5 list_contacts_additional_records (Top: 15) → Expect 10-15 list_sales_records (Top: 25) → Expect 15-25 list_sales_line_items_records (Top: 100) → Expect 60-120 list_events_records (Top: 15) → Expect 5-10 list_contacts_notes_records (Top: 10) → Expect 5 ``` **Verify NO orphaned foreign keys:** - `search_sales_line_items_records` with Filter: `IDItem eq null` → Must return empty - `search_sales_line_items_records` with Filter: `IDSales eq null` → Must return empty **Spot check:** Pick 3 random sales orders from artifact and verify their line items exist and tell a coherent product story. **Update artifact verification checklist** with final counts and mark all boxes. --- ## CRITICAL REQUIREMENTS CHECKLIST - [ ] Customer Types: All 5 contacts are NORMAL BUSINESSES that would hire a solar installer - [ ] Foreign Keys: ALL foreign keys use IDPrimaryKey UUIDs (never Internal IDs) - [ ] Sales Line Items: EVERY line item has valid IDItem AND IDSales - [ ] Atomic Creation: Each order created WITH its line items immediately (not separated) - [ ] Narrative Coherence: Line items tell realistic system design stories (not random products) - [ ] Data Volume: 15-20 Items, 5 Contacts, 10-15 Additional Contacts, 15-25 Sales, 60-120 Line Items - [ ] Verification: Zero null foreign keys, all relationships validated immediately - [ ] Temporal Realism: Orders span 12 months, show realistic sales funnel progression - [ ] Artifact Updated: Progress tracker artifact reflects all created records --- ## KEY LESSON: WHY ATOMIC TRANSACTIONS MATTER **Problem with batch creation:** - Creating all sales records first, then all line items later causes UUID sync issues - Result: Orphaned foreign keys that break referential integrity **Solution:** - Create each sales order as atomic transaction (order → line items → verify) - Use the UUID immediately after capturing it - Verify foreign keys before moving to next record - Never batch-create parents separate from children - Keep artifact updated as single source of truth --- ## RESUMING A SESSION If the conversation is interrupted: 1. **User provides the artifact content** (copy/paste from previous session) 2. **Claude recreates the artifact** with that content 3. **Claude checks database state** against artifact to identify discrepancies 4. **Resume from the last incomplete phase** based on artifact status The artifact is the authoritative record - if the database has records not in the artifact, verify them and add to artifact before continuing. --- ## SUCCESS CRITERIA When complete, you should have: - Production-grade test dataset with perfect referential integrity - Realistic business scenarios (not random data) - Complete sales stories (estimates → orders → invoices with coherent line items) - Zero orphaned records - All 7 tables populated per requirements - **Artifact showing complete tracking of all records with both ID types** ---