| title | Effective Prompting |
|---|---|
| sidebarTitle | Prompting |
| icon | lightbulb |
| iconType | solid |
To get the best results from Codegen, treat it like a skilled teammate: provide clear, specific instructions and sufficient context. Vague requests lead to ambiguous outcomes.
Codegen is based on Anthropic's Claude 4 Sonnet. You can prompt it similarly to ChatGPT or other LLM-based assistantsInstead of "Fix the user service," try:
In the
my-web-apprepo (PR #42), refactor theUserServiceclass insrc/services/user.tsto use theUserRepositorypattern shown inProductService/ProductRepository.
If there are specific implementation details you want included, make sure to specify. For example:
Ensure all tests in
tests/services/user.test.tspass and add new tests for the repository with 90%+ coverage. Update the diagram indocs/architecture/user-service.md.
- Scope: What repository, branch, or files are involved? (e.g.,
my-web-apprepo,PR #42,src/services/user.ts) - Goal: What is the high-level objective? (e.g., Refactor
UserService, improve testability) - Tasks: What specific actions should the agent take? Use a numbered or bulleted list for clarity. (e.g., Extract logic to
UserRepository, use dependency injection, update tests, update diagram) - Context/Patterns: Are there existing patterns, examples, or documentation to reference? (e.g.,
ProductService,ProductRepository) - Success Criteria: How will you know the task is done correctly? (e.g., Tests pass, 90%+ coverage, diagram updated)