Codegen is based on Anthropic’s Claude 4 Sonnet. You can prompt it similarly to
ChatGPT or other LLM-based assistants
The Core Principle: Specificity
Instead of “Fix the user service,” try:In theIf there are specific implementation details you want included, make sure to specify. For example:my-web-apprepo (PR #42), refactor theUserServiceclass insrc/services/user.tsto use theUserRepositorypattern shown inProductService/ProductRepository.
Ensure all tests intests/services/user.test.tspass and add new tests for the repository with 90%+ coverage. Update the diagram indocs/architecture/user-service.md.
Elements of a Strong Prompt
- 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)
Clear, detailed prompts empower Codegen agents to deliver accurate results
faster, significantly streamlining your workflow.