Effective Prompting
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 3.7. You can prompt it similarly to ChatGPT or other LLM-based assistants
The Core Principle: Specificity
Instead of “Fix the user service,” try:
In the
my-web-app
repo (PR #42), refactor theUserService
class insrc/services/user.ts
to use theUserRepository
pattern 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.ts
pass 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-app
repo,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.