From qa-apimapadd
Generate Karate API mapping feature files from PSAM CSV files. Handles product mappings, country mappings, and transmission rate lookups across Stage/UAT/Prod environments. Primarily used in RemotePricing2 (RP2).
How this skill is triggered — by the user, by Claude, or both
Slash command
/qa-apimapadd:qa-apimapaddThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are creating a new Karate API mapping feature file for testing provider product and country mappings.
You are creating a new Karate API mapping feature file for testing provider product and country mappings.
Ask the user the following questions (use the AskUserQuestion tool with multiple questions):
Folder Location (header: "Folder")
Feature File Name (header: "File Name")
PSAM File (header: "PSAM File")
Transmission Rate Source (header: "TR Source")
Country Mapping (header: "Countries")
Based on the folder response:
src/test/resources/features/mappings/From the PSAM file, read the provider_name column to determine the provider name for the feature file.
Using features/mappings/Retail_Platform/ACC_Mapping.feature as the template:
~/DownloadsBEFORE generating any scenarios, read an existing mapping feature file (e.g., features/mappings/AT&T/AT&T_HSIA_E_Mapping.feature) to see the exact format used.
The scenario name format is: {Provider} - {sub_product_name} - {speed}
Speed format rules by product type:
Broadband products: Always use {download}/{upload} format (for both symmetric AND asymmetric speeds)
AT&T HSIA-E - Broadband - 768k/384k (asymmetric)AT&T HSIA-E - Broadband - 100M/100M (symmetric)All other products: Use single speed format (symmetric format)
Comcast - Ethernet Fiber - 100MComcast - Internet Fiber - 1G (DIA where upload is null)Speed unit format:
{speed}M (e.g., 100 -> "100M")= 1000 && < 10000:
{speed}Mor{speed/1000}G(e.g., 1000 -> "1000M" or "1G")
= 10000:
{speed/1000}G(e.g., 10000 -> "10G")
What NOT to include in scenario names:
Example correct scenarios:
| AT&T HSIA-E - Broadband - 768k/384k | 7 | Broadband | ...
| Comcast - Ethernet Fiber - 100M | 11 | Comcast Ethernet Fiber | ...
| Comcast - Internet Fiber - 1G | 6 | Comcast Internet Fiber | ...
Example INCORRECT scenarios (do NOT use):
| Comcast - Ethernet Fiber - 100/100 - Fiber | ... ← Wrong: access medium at end, no unit
| Comcast - Internet Fiber - 100/null | ... ← Wrong: shows "null"
| Comcast - Ethernet Fiber - 100M/100M | ... ← Wrong: non-Broadband using download/upload format
Based on the user's TR Source selection:
Required: MySQL environment variables configured in shell:
MYSQL_USER — MySQL usernameMYSQL_HOST_STAGE, MYSQL_PASSWORD_STAGE — Stage connectionMYSQL_HOST_UAT, MYSQL_PASSWORD_UAT — UAT connectionMYSQL_HOST_PROD, MYSQL_PASSWORD_PROD — Production connectionIMPORTANT: UAT/Prod passwords contain special characters (*, ,). Use single-quoted literal password with -p'<password>' syntax instead of MYSQL_PWD environment variable. Stage password has no special chars so env var works. See ~/.zshrc for actual credentials.
Process:
# Stage (no special chars in password - env var works)
MYSQL_PWD=$MYSQL_PASSWORD_STAGE mysql -h $MYSQL_HOST_STAGE -u $MYSQL_USER -D connected2fiber -N -e "
SELECT psam.sub_product_name, psam.access_medium_id,
psam.provider_download_speed, psam.provider_upload_speed,
psam.transmission_rate_id, fs.transmissionrate
FROM product_service_api_mapping psam
LEFT JOIN fiberspeed fs ON psam.transmission_rate_id = fs.transmissionrateid
WHERE psam.provider_name = 'PROVIDER_NAME' AND psam.is_active = 1"
# UAT (special chars - use single-quoted literal password from ~/.zshrc)
mysql -h mysqlmaster-uat.connectbase.dev -u u_dond -p'<UAT_PASSWORD>' -D connected2fiber -N -e "..."
# Prod (special chars - use single-quoted literal password from ~/.zshrc)
mysql -h mysqlmaster-prod.connectbase.dev -u u_dond -p'<PROD_PASSWORD>' -D connected2fiber -N -e "..."
For each PSAM entry, find the matching transmission_rate_id from each environment by matching on:
If transmission_rate_ids differ between environments, use environment-specific columns in the Examples table:
transmission_rate_id_stage, transmission_rate_id_uat, transmission_rate_id_prodIf all environments have the same transmission_rate_id, use a single transmission_rate_ids column
Fallback: If environment variables are not configured, inform the user and offer to use the CSV file option instead.
When "CSV files" is selected:
When "No TR data" is selected:
The PSAM document is the authoritative source for product mappings. When a PSAM entry does NOT have a matching transmission rate entry:
Alert the user with a clear warning listing the scenario name, sub_product_name, access_medium_id, and speeds that had no TR match
Still create the test with blank transmission_rate_ids
Ask the user (using AskUserQuestion tool):
If "Comment out": Prefix rows with # and add # TODO: Missing TR entry - add transmission_rate_id when available
Based on country mapping option:
IMPORTANT: The external_api_id (supplier ID) differs between environments. Query each environment separately.
Same credential handling as Step 6 — Stage uses env var, UAT/Prod use single-quoted literal passwords from ~/.zshrc.
Process:
# Stage
MYSQL_PWD=$MYSQL_PASSWORD_STAGE mysql -h $MYSQL_HOST_STAGE -u $MYSQL_USER -D connected2fiber -N -e "
SELECT * FROM remote_price_supplier WHERE supplier LIKE 'PROVIDER_NAME'"
# Stage (e.g., external_api_id = 444)
MYSQL_PWD=$MYSQL_PASSWORD_STAGE mysql -h $MYSQL_HOST_STAGE -u $MYSQL_USER -D connected2fiber -N -e "
SELECT c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3
FROM remote_price_api_country rpac
INNER JOIN country c ON rpac.country_id = c.countries_id
WHERE rpac.external_api_id = 444
ORDER BY c.countries_name"
Compare results across environments and identify differences:
environments to stage,uat,prodenvironments accordinglyExample of handling differences:
| Space Hellas - 121 - Libyan Arab Jamahiriya | 121 | Libyan Arab Jamahiriya | LY | LBY | stage |
| Space Hellas - 121 - Libya | 121 | Libya | LY | LBY | uat,prod |
Add only USA (223, United States, US, USA)
Leave Examples table empty
Apply consistent spacing/alignment to both product and country mapping tables:
features/mappings/Retail_Platform/ACC_Mapping.feature) to ensure consistent formatting# Stage
cd tests/integration/karate
./gradlew test '-Dkarate.options=--tags @{provider_tag} --tags @mapping --tags ~@bug --tags ~@uat --tags ~@prod' -Dkarate.mock.callback=false
# UAT
./gradlew test '-Dkarate.options=--tags @{provider_tag} --tags @mapping --tags ~@bug --tags ~@stage --tags ~@prod' \
-Dkarate.env=uat -Dkarate.scenario.env=uat -Dkarate.mock.callback=false
No runner updates needed — the @provider_tag in the feature file determines which tests run.
Provide a summary showing:
If any differences were found between environments, include a detailed summary:
Transmission Rate Differences:
| Product | Speed | Stage TR | UAT TR | Prod TR |
|----------------------------------|----------|----------|--------|---------|
| Broadband - Fiber | 180/10 | 2070 | 2127 | 2163 |
Country Mapping Differences:
| Country ID | Stage Name | UAT/Prod Name | Environments Affected |
|------------|-------------------------|---------------|----------------------|
| 121 | Libyan Arab Jamahiriya | Libya | Stage vs UAT/Prod |
If no differences were found, state: "No environment differences found — all transmission rates and country mappings are consistent across Stage, UAT, and Prod."
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub connected2fiberteam/cb-qa-claude-plugins --plugin qa-apimapadd