Convert an Excel rating workbook (.xls/.xlsx) into a Swallow pricing engine configuration. Reads formulas, traces dependencies, and rebuilds as Swallow JSON.
How this skill is triggered — by the user, by Claude, or both
Slash command
/swallow-pricing-engine:excel-to-swallowThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
The user wants to convert an Excel rating workbook into a Swallow pricing engine configuration.
The user wants to convert an Excel rating workbook into a Swallow pricing engine configuration.
The user will provide:
.xls or .xlsx file containing pricing/rating logic"Sheet1!C45" or "premium!H12")If no result cell is supplied, auto-detect it (see Step 2). Only ask the user as a last resort.
Read the Excel file. For each sheet, map out:
:::result, :::input, or :::valid flags)Find the result cell using this priority:
:::result flag — scan all cell comments for :::resultAlso look for:
:::valid in comments — the validity/exclusion check cell:::input in comments — explicitly marked input cellsStarting from the result cell, recursively trace every cell reference in its formula:
Build a dependency map:
result_cell
├── calc_cell_1 (formula: =A1 * B1)
│ ├── input_cell_A1 (static value: 500)
│ └── input_cell_B1 (static value: 1.2)
├── calc_cell_2 (formula: =VLOOKUP(...))
│ ├── lookup_table (range of static data)
│ └── input_cell_C3 (static value: "SW1")
└── ...
For every cell in the dependency tree, classify it as:
| Classification | Criteria | Swallow mapping |
|---|---|---|
| Input | Leaf cell, no formula, value would change per quote | input.format field |
| Constant | Leaf cell, no formula, value is fixed (rates, thresholds) | input.format field with static: true |
| Lookup table | Range of static data used by VLOOKUP/INDEX/MATCH | collection step |
| Calculation | Cell with arithmetic formula | calculation step or transform step |
| Conditional | Cell with IF/AND/OR that determines validity | exclusion or refer step |
| Result | The final price cell | output.result |
| Valid | The validity check cell | output.valid |
When classifying, consider:
Arrange the cells into an ordered pipeline. Use the dependency depth:
Translate Excel formulas to Swallow syntax:
| Excel | Swallow |
|---|---|
=A1 * B1 | ({{input_a}} * {{input_b}}) |
=ROUND(A1, 2) | round({{input_a}}, 2) |
=IF(A1>50, 1.5, 1.0) | ({{age}} > 50 ? 1.5 : 1.0) |
=VLOOKUP(A1, Sheet2!A:C, 3, TRUE) | Collection step: collection.items.filter(key <= {{lookup_val}}).map(value).last() |
=SUM(A1:A10) | _.sum([{{a1}}, {{a2}}, ...]) or collection collection.items.map(value).sum() |
=INDEX(MATCH(...)) | Collection step with filter/map |
=CONCATENATE(A1, B1) | String template or code step |
=AND(A1>18, A1<80) | Exclusion: ({{age}} < 18 || {{age}} > 80) (inverted — exclusion triggers on FAIL) |
Key rules:
{{swallow_property_name}}snake_case for all property names (derived from cell labels, sheet names, or column headers)id and key must be the same within each stepdef (default value) — use the cell's current value. Multiplicative factor defaults must be 1.0 not 0result uses formula, valid uses expformula fields: use and/or not &&/|| (MathJS syntax)min()/max() not supported in transform exp — use calculation stepskey as a data column name in collectionsfactors, modular, batch, links, label, code stepsEvery input field MUST have key, exp, label, sub_label (min 20 chars, broker-facing), type, and def. Without key and exp, the engine ignores quote overrides.
Every step MUST have id, step, name, key, and description.
Collection data MUST be in compressed format: [[headers], [row1], [row2], ...].
Assemble the complete project:
{
"meta": { "name": "...", "description": "Converted from [filename]" },
"input": { "format": { ... } },
"steps": [ ... ],
"output": {
"result": { "key": "result", "formula": "...", "type": "decimal", "def": 0 },
"valid": { "key": "output", "exp": "{{exclusions.count()}} == 0", "type": "boolean", "def": true },
"format": { ... }
},
"tests": [ ... ]
}
The Excel file's current cell values are a built-in test case. Create a test using:
Add 2-3 more test cases by varying key inputs.
validate_swallow_project — fix any schema errorstest_swallow_project — check the pricing matches the ExcelSave the final Swallow JSON to a file and report:
Excel: =VLOOKUP(age, rate_table, 2, FALSE)
Swallow: collection step with filter(key == {{age}}).map(rate).first()
Excel: =VLOOKUP(age, rate_table, 2, TRUE)
Swallow: collection step with filter(min_age <= {{age}}).filter(max_age >= {{age}}).map(rate).first()
Note: You may need to restructure the lookup table to have min/max columns
Excel: =INDEX(rates, MATCH(postcode, postcodes, 0))
Swallow: collection step with filter(postcode == {{postcode}}).map(rate).first()
Excel: =IF(age<25, 1.5, IF(age<50, 1.0, IF(age<65, 0.9, 1.2)))
Swallow: Either a transform with ternary chain, or better — a collection lookup table:
[{"min":0,"max":24,"factor":1.5}, {"min":25,"max":49,"factor":1.0}, ...]
Excel: =SUMPRODUCT(weights, values)
Swallow: Multiple calculation steps, or a code step for complex array operations
driver_age not sheet1_c5)code step with JavaScriptProvides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
npx claudepluginhub llow-group/swallow-claude-plugin --plugin swallow-pricing-engine