Skip to main content

The Role of Context

AI performs best when context is explicit.

Poor prompt:

Create a login form.

Good prompt:

Create a login form.

Requirements:
- React
- TypeScript
- Atomic Design
- Use existing Input atom
- Use existing Button atom
- Form validation with Zod
- React Context for state
- Storybook story
- Vitest tests

The second prompt dramatically reduces variation.

info

Exercise: Execute and compare the results of the two prompts above. What is different? What is missing?


Mini Exercise​

Write the minimum context an AI needs to build one feature correctly in your codebase.

Example​

Useful context may include:

  • domain name
  • architecture rules
  • component hierarchy
  • naming conventions
  • testing requirements