ai-docs/docs/ai/crossplatform/prompting-patterns.md
Matt Bruce 3586f39e8e More refactoring
Signed-off-by: Matt Bruce <matt.bruce1@toyota.com>
2026-02-22 15:02:58 -06:00

1.5 KiB

Prompting Patterns

You are here: AI Docs Home > Cross-Platform AI Usage > Prompting Patterns

Contents

  • Why Prompt Patterns Matter
  • Prompt Template
  • Common Prompt Patterns
  • Next Steps

Why Prompt Patterns Matter

Good prompt patterns reduce rework. They tell the assistant exactly what to change, what not to change, and what output you expect.

Prompt Template

Use this structure for most requests:

  1. Goal: The specific outcome you want.
  2. Scope: The file or function to change.
  3. Constraints: What must stay the same.
  4. Output: What you want returned (code only, bullets, tests, and so on).

Example prompt:

Goal: Refactor validation logic for readability.
Scope: Only ValidationService.swift.
Constraints: Keep behavior and public API unchanged.
Output: Return code changes and a short list of tests to update.

Common Prompt Patterns

  • Refactor safely: Example prompt:
Refactor this file to improve readability without changing behavior.
  • Add tests: Example prompt:
Add unit tests for this service. Keep the existing public API.
  • Debug: Example prompt:
Explain this error and list likely fixes in priority order.
  • Understand code: Example prompt:
Summarize what this module does and call out the top 3 risks.

Next Steps