Promptles
Constraints

Define Inputs and Outputs

When extracting a function, tell Claude exactly what it should accept and return. Without clear input/output contracts, Claude will guess at the interface, and you may end up refactoring the refactor.

Where you'll practice this

3 Promptles scenarios teach this principle directly. Each one drops you into a real engineering ticket and asks you to write the prompt you'd send to Claude Code.

  • Inputs and Outputs

    You have a `converter.js` file with a function `celsiusToFahrenheit` that converts temperatures. Now the team wants a second function, `fahrenheitToCelsius`, that does the reverse. It should take a Fahrenheit temperature as input and return the Celsius equivalent.

  • Extract the Helper

    You've noticed that both `signup.ts` and `profile.ts` contain nearly identical email validation logic: a regex test, a length check, and a domain blocklist check. Each file implements it slightly differently, which has already caused a bug where the signup form accepts emails…

  • The Data Merger

    You have two CSV files. `crm_contacts.csv` has columns: `email`, `name`, `company`, `signup_date`. `marketing_clicks.csv` has columns: `email`, `campaign`, `clicks`, `last_click_date`. You want a Python script called `merge.py` that performs a left join on `email`: keeping all…

Other principles in Constraints