Promptles
Constraints

Describe Type Contracts

When adding types to untyped code, describe the shape of each data structure and the signature of each function. Claude can infer basic types, but union types, optional fields, and generics need explicit guidance to match your team's conventions.

Where you'll practice this

One Promptles scenario teaches this principle directly.

  • Add Types

    Your team is migrating to TypeScript. The `api-client.js` module has three functions, `getUser`, `createPost`, and `deleteComment`, all currently untyped. Each function has clear parameter patterns from usage, and you need to rename the file to `.ts` and add proper TypeScript…

Other principles in Constraints