Crm import

From aAAaqwq/AGI-Super-Team · View interactive version

Crm import is an AI agent skill from the GitHub repository aAAaqwq/AGI-Super-Team. Import data from staging to master CRM with validation

How to use this skill

Skill file

CRM Import

Import new data from staging to master CRM database with validation and approval.

When to use

Input

How to execute

Step 1: Run the agent

cd $AGENTS_PATH/crm-import

# Auto-detect table type
python3 crm-import_agent.py sales/crm/_staging/incoming/new_people.csv

# Or specify explicitly
python3 crm-import_agent.py data.csv --table companies

Modes:

Step 2: The agent will perform

  1. Schema validation (required fields, ID format, enums)
  2. Deduplication check (exact + fuzzy matching)
  3. Foreign key validation
  4. Business rules check
  5. ID generation (if missing)
  6. Git branch creation + commit
  7. Telegram notification

Step 3: You will receive a Telegram message

CRM Import Ready for Review

Table: people
New records: 5
Branch: crm-import-people-new_people-2026-02-12
Commit: a1b2c3d4

Next steps:
1. Review changes: git diff main..crm-import-people-new_people-2026-02-12
2. Approve: gh pr create (then merge)
3. Reject: git branch -D crm-import-people-new_people-2026-02-12

Step 4: Review changes

cd $PROJECT_ROOT
git diff main..crm-import-people-new_people-2026-02-12

Step 5: Approve or Reject

Approve:

gh pr create --base main --head crm-import-people-new_people-2026-02-12 \
  --title "Import new people records" \
  --body "Importing 5 new people from staging"

# Merge PR
gh pr merge --merge

Reject:

git branch -D crm-import-people-new_people-2026-02-12

Output

Validation Rules

Critical (stops the import)

High (flagged for review)

Info (log only)

ID Generation

If ID is missing, the agent generates it automatically:

| Table | Format | Example |

|-------|--------|---------|

| companies | comp-{slug} | comp-acme-corp |

| people | p-{company-slug}-{N} | p-acme-001 |

| clients | cli-{company-slug}-{N} | cli-acme-001 |

| partners | ptnr-{company-slug}-{N} | ptnr-acme-001 |

| leads | lead-{company-slug}-{N} | lead-acme-001 |

| deals | deal-{company-slug}-{N} | deal-acme-001 |

| products | prod-{slug} | prod-labeling |

| activities | act-{N} | act-042 |

Deduplication

Exact match (skip):

Fuzzy match (review):

Examples

Example 1: Import new people

# Create staging file
cat > sales/crm/_staging/incoming/new_people.csv << EOF
person_id,first_name,last_name,email,company_id,role,created_date,last_updated
,John,Smith,john@example.com,comp-acme,Engineer,,
,Jane,Doe,jane@example.com,comp-acme,Manager,,
EOF

# Import
python3 crm-import_agent.py sales/crm/_staging/incoming/new_people.csv

# Result:
# - ID: p-acme-001, p-acme-002
# - Branch: crm-import-people-new_people-2026-02-12
# - Telegram notification

Example 2: Dry-run before import

# Verify without commit
python3 crm-import_agent.py data.csv --dry-run

# If OK -> run
python3 crm-import_agent.py data.csv

Example 3: Show duplicates

python3 crm-import_agent.py data.csv --show-duplicates

Rollback

If you need to revert:

# Find merge commit
git log --oneline --grep="Import.*records"

# Revert
git revert <commit-sha>

Staging Directory

sales/crm/_staging/
├── incoming/     # New files for import
├── review/       # Duplicate review reports
└── archive/      # Processed files

Errors

"Cannot auto-detect table type"

-> Add --table people

"Foreign key violation"

-> Import the parent record first (e.g., company before people)

"Critical schema issues"

-> Fix required fields, ID format, enum values in the CSV

"Git commit failed"

-> Check git status, the working directory may be dirty

Related skills

Dependencies

Limitations

Future improvements

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.