Draft a function and tests from written instructions and examples

A draft function with a table-driven test file from the supplied examples and a spec-ambiguity list, kept unmerged.

Choose one of three approaches. The steps for that option appear below.

Choose an option above. On a phone, swipe the tabs left or right to see all options →

GitHub Copilot: proposes rules first, then code

Copilot Chat proposes rules, then a function and tests. You control the rules and the local test run.

  1. You

    Gather spec

  2. GitHub Copilot

    Propose rules

  3. You

    Check the rules

  4. GitHub Copilot

    Draft code and tests

  5. You

    Run, record, stop

  1. Gather the spec, examples and test framework

    Use: You

    Have ready: spec text and examples. State the language, version and test framework.

    Check

    Paste only the spec, examples and your language choices into the editor chat.

  2. Ask for behaviour rules, no code

    Use: GitHub Copilot

    In Copilot Chat, paste the spec and examples with your language choices. Ask for numbered behaviour rules and unresolved readings, without code.

    Details

    What to paste into the tool

    Task: Proposed behavior rules and spec questions. Use the packet; preserve each example input and expected output; number behavior rules and cite their spec phrase; list ambiguous readings separately; do not choose missing behavior

  3. Check the rules against the original

    Use: You

    Check every rule and example against the original. Resolve or park each spec question and keep your language and framework choices.

    Check

    Pause until a developer accepts a rule set. Release the corrected sheet only after the developer accepts its scope.

  4. Request the function and a test file

    Use: GitHub Copilot

    From your confirmed rules, ask Copilot Chat for one function and a separate table-driven test file. List unresolved cases; disable agent commands.

    Details

    What to paste into the tool

    Task: Draft function source; Draft table-driven test file; Unresolved spec list. Use developer-confirmed rules over earlier proposals; write in the supplied language and framework; encode every supplied example as one input-expected table row; use only permitted dependencies; return files as text and do not run commands

  5. Run everything locally and stop before merge

    Use: You

    Read the source and tests, check each example is encoded, run tests in an isolated local environment, record failures and ambiguous behaviour, stop before merge.

    Check

    Treat generated files as review candidates only. Keep the files as an unmerged draft.

Before you paste into any AI tool, remove any confidential information. Put it back at the end.

Tools in this workflow

Deciding between Cursor and GitHub Copilot for this? See the comparison.

Final check

A developer validates the interpretation and each supplied example.

Local test results are checked before any later merge decision.

No workflow merges, pushes, deploys or spends credits as part of this authoring exercise.

Check the result against your original inputs. Approve it before sharing or acting.

What still needs checking
  • For sc-software-001, completion_test, essential_constraints and source_warnings were absent from the baseline and remain absent
  • Editor entitlement, permitted source handling, context limits and function-test behavior need developer validation before use

Share this page