| name | validate-impex |
| description | Validate SFCC impex XML files for syntax, structure, and common errors. Checks services, site preferences, custom objects, and installation/uninstallation pairs. Use this skill immediately before importing impex files to Business Manager or submitting any commerce app. Don't wait for import failures - run validation proactively whenever impex files are created or modified to catch errors early and save debugging time. |
Validate Impex Files
Validate SFCC impex XML files to catch errors before import.
Cross-tool note: References to /skill-name (e.g., /validate-app) are Claude Code invocation syntax. If using another assistant, read and follow the corresponding .claude/skills/<skill-name>/SKILL.md file instead.
When to use this skill
Use proactively:
- Before importing impex files to Business Manager
- After generating or modifying any impex files
- Before running
/validate-app or /submit-app
- When debugging import failures
- As part of any impex workflow
Step 1: Quick validation
Run the automated validation script:
bash scripts/validate-impex.sh impex/
This checks:
- Directory structure (install/ and uninstall/)
- XML syntax (all .xml files)
- Services (namespace, delete mode, install/uninstall pairs)
- Site preferences (attribute definitions, groups)
Step 2: XML syntax validation
Validate all XML files are well-formed:
find impex/ -name "*.xml" -exec xmllint --noout {} \;
Common XML errors:
- Missing closing tags
- Unescaped special characters (
& → &, < → <)
- Missing XML declaration
- Invalid attribute quotes
XSD schema validation (preferred)
Validate against the bundled SFCC XSD schemas — this catches namespace, structural, and type errors that plain well-formedness misses. The b2c CLI ships the schemas; use npx @salesforce/b2c-cli if it's not installed globally.
b2c docs schema --list
xmllint --schema "$(b2c docs schema metadata --path)" \
impex/install/meta/system-objecttype-extensions.xml --noout
xmllint --schema "$(b2c docs schema metadata --path)" \
impex/install/meta/custom-objecttype-definitions.xml --noout
xmllint --schema "$(b2c docs schema services --path)" impex/install/services.xml --noout
xmllint --schema "$(b2c docs schema services --path)" impex/uninstall/services.xml --noout
xmllint --schema "$(b2c docs schema preferences --path)" impex/install/preferences.xml --noout
Step 3: Validate services.xml
Installation file (impex/install/services.xml)
Check:
Uninstallation file (impex/uninstall/services.xml)
Check:
Verify pairs match:
grep 'service-id=' impex/install/services.xml | sed 's/.*service-id="\([^"]*\)".*/\1/' | sort > /tmp/install.txt
grep 'service-id=' impex/uninstall/services.xml | sed 's/.*service-id="\([^"]*\)".*/\1/' | sort > /tmp/uninstall.txt
diff /tmp/install.txt /tmp/uninstall.txt
Step 4: Validate site preferences
system-objecttype-extensions.xml
Check:
preferences.xml
Check:
Step 5: Validate custom objects
If present (impex/install/meta/custom-objecttype-definitions.xml):
Check:
Step 6: Cross-file validation
Ensure install/uninstall pairs match:
grep 'service-id=' impex/install/services.xml | sort > /tmp/install-ids.txt
grep 'service-id=' impex/uninstall/services.xml | sort > /tmp/uninstall-ids.txt
diff /tmp/install-ids.txt /tmp/uninstall-ids.txt
Step 7: Common errors
| Error | Fix |
|---|
parser error: Opening and ending tag mismatch | Add closing tag |
Namespace prefix dwre ... is not defined | Use correct SFCC namespace |
Service with ID already exists | Use unique IDs |
Attribute not defined in group | Add to group-definitions |
Invalid value for type | Match default value to type |
Cannot delete service, profile in use | Delete in order: service → profile → credential |
SITEID not found | Use SITEID placeholder |
Step 8: Pre-import checklist
Quick validation command
find impex/ -name "*.xml" | while read f; do
echo "Checking $f...";
xmllint --noout "$f" && echo "✓" || echo "✗ ERROR";
done
Testing after import
- Services: Administration > Operations > Services
- Site Preferences: Merchant Tools > Site Preferences > Custom Preferences
- Custom Objects: Administration > Site Development > System Object Types
Automation
Use the validation script in CI/CD:
#!/bin/bash
bash .claude/skills/validate-impex/scripts/validate-impex.sh impex/ || exit 1