Skip to content

Instantly share code, notes, and snippets.

@CHatmaker
Created September 3, 2026 20:42
Show Gist options
  • Select an option

  • Save CHatmaker/2c7b00b6c7e7e43e21489e67ee9d8add to your computer and use it in GitHub Desktop.

Select an option

Save CHatmaker/2c7b00b6c7e7e43e21489e67ee9d8add to your computer and use it in GitHub Desktop.
BXL's Copilot Skill to test 5g functions
---
name: function-test
description: Tests a custom Excel function by randomizing input arguments and verifying its spilled output produces identical results to a reference formula.
---
metadata:
version: 1.0.0
tags:
- excel
- lambda
- afe
- excel labs
- named functions
- documentation
- 5g modeling
triggers:
- test
- test function
- function test
rules:
- Work step-by-step.
- After completing each step, pause and show results including the affected sheet/range and key values before continuing.
- When randomizing a timeline, randomize the timeline's start, periods, and interval arguments and display these arguments in the results table, not the resulting dates in the timeline.
- When running the tests, if any fail for any reason stop the tests, record all tests in the table including the failed test.
workflow:
- step 1:
display "SKILL: function-test VERSION: BXL 2026-09-02" then continue.
- step 2:
name: gather_information
If a named range "Language" does not exist:
prompt: "Which language would you prefer to use?" in the regional setting's likely language.
- Display options as a numbered list:
1 English
2 Español
3 Français
4 Deutsch
5 Italiano
6 Português
7 中文
8 日本語
9 한국어
10 Other — type the language you want to use.
- Switch to the language and use it for the remaining steps and worksheet entries.
- step: 3
name: get_function_cell
action: prompt_user
prompt: "Select the cell containing the function to test. When selected type C and press ENTER to continue"
output: function_cell
- step: 4
name: get_comparison_cell
action: prompt_user
prompt: "Select the cell containing the formula to compare against. When selected type C and press ENTER to continue"
output: comparison_cell
- step: 5
name: parse_function
action: extract_formula_info
input: function_cell
output:
function_name: function_name
argument_names: argument_names
argument_cells: argument_cells
- step: 6
name: get_test_parameters
action: prompt_user
prompt: "How many tests should I perform (enter a positive whole number)?"
output: test_count
- step: 7
name: run_tests
action: execute_test_loop
inputs:
function_cell: function_cell
comparison_cell: comparison_cell
argument_cells: argument_cells
test_count: test_count
process:
- for_each_iteration:
- randomize_arguments:
method: "generate random values based on inferred cell data types"
- wait_for_calculation
- get_spilled_range:
source: function_cell
output: function_results
- get_spilled_range:
source: comparison_cell
output: comparison_results
- compare_results:
method: element_wise
tolerance:
value: 0.0001
type: absolute
output: test_results
- step: 8
name: report_results
action: generate_report
input: test_results
format:
type: worksheet_table
destination: worksheet
columns:
- Test
- Pass
- {argument_names}
description: >
Create a table directly in the worksheet where each row represents one test iteration.
The table must include:
- “Test” column containing the test iteration number
- “Pass” column indicating whether the test passed or failed
- one column for each randomized function argument, using the argument names as headers
Each row should populate the argument columns with the exact values used during that iteration, so the full input set for each test is visible alongside its result.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment