DEV Community

Cover image for Best Practices for Prompt Engineering with goose
Lymah
Lymah

Posted on • Edited on

Best Practices for Prompt Engineering with goose

Table of Contents


Introduction

You've installed goose, configured your LLM provider, and launched your first session. Now comes the real question: how do you actually talk to an AI agent to get the results you want?
Prompt engineering, the art and science of communicating effectively with AI, is the difference between getting generic, unhelpful responses and having goose become your most productive coding partner. Unlike simple chatbots, goose is an agentic AI that can execute commands, modify files, and orchestrate complex workflows. This makes effective prompting even more critical.
In this comprehensive guide, we'll explore battle-tested strategies for crafting prompts that yield better results, avoid common pitfalls, and help you build a natural, productive workflow with goose. Whether you're debugging code, architecting new features, or refactoring legacy systems, these techniques will help you get the most out of your AI pair programmer.

Understanding How goose Thinks

Before diving into specific techniques, it's important to understand what makes goose different from a standard chatbot.

goose is Agentic, Not Just Conversational

Traditional AI assistants respond to your questions with text. goose can:

  • Execute commands in your terminal
  • Read and modify files in your project
  • Install dependencies and manage packages
  • Run tests and interpret results
  • Make sequential decisions based on outcomes
  • Access your project context, including file structure, git history, and more

This means your prompts aren't just questions; they're instructions that trigger real actions in your development environment.

Context is Everything

goose works best when given specific instructions with all important details included. The AI maintains conversation history and can reference previous exchanges, but it doesn't read your mind. The more context you provide upfront, the better goose can help.

Different Models, Different Behaviors

Since goose supports multiple LLM providers (OpenAI, Claude, Gemini, etc.), the way it responds depends on which model you're using, with some LLMs needing extra guidance while others might require a few rounds of refinement. Understanding your model's strengths helps you adjust your prompting style accordingly.

Core Prompting Techniques for goose

Let's explore the fundamental approaches to prompting, each suited to different scenarios.

1. Instruction-Based Prompting: The Foundation

If you're new to goose, instruction-based prompting is a great place to start, where being clear and direct gets the best responses.

The Pattern

goose, [action verb] [specific task] [with context/constraints]
Enter fullscreen mode Exit fullscreen mode

❌ Weak Prompt

goose, fix my code
Enter fullscreen mode Exit fullscreen mode

Problem: Too vague. Which code? What's broken? What's the expected behavior?

✅ Strong Prompt:

goose, the authentication function in src/auth/login.js is throwing a 401 error 
even with valid credentials. The issue started after I upgraded to Express 5. 
Can you debug this and fix the problem?
Enter fullscreen mode Exit fullscreen mode

Why it works

  • Specifies exact file location
  • Describes the symptom clearly
  • Provides context (Express 5 upgrade)
  • States desired outcome

Real-World Examples

"goose, create a new React component called UserProfile that displays 
   user data from our API. It should include avatar, name, email, and bio. 
   Use TypeScript and follow our existing component patterns in src/components/""goose, refactor the database queries in models/user.js to use async/await 
   instead of callbacks. Make sure to handle errors properly and maintain 
   backward compatibility with the existing API.""goose, write unit tests for the PaymentProcessor class using Jest. 
   Cover success cases, validation errors, and network failures. Follow 
   the test structure we use in __tests__/services/"
Enter fullscreen mode Exit fullscreen mode

Pro Tips

  • Use action verbs: create, refactor, debug, optimize, test, document
  • Include file paths when relevant
  • Mention coding standards or patterns to follow
  • Specify constraints (performance, compatibility, style)

Chain-of-Thought Prompting: Breaking Down Complexity

Chain-of-Thought Prompting helps when a topic or task is too much to tackle all at once, guiding goose to break things down step by step.

When to Use

  • Complex architectural decisions
  • Multi-step migrations
  • Learning unfamiliar concepts
  • Planning before implementation

❌ Overwhelming Prompt

goose, migrate our app from MongoDB to PostgreSQL
Enter fullscreen mode Exit fullscreen mode

Structured Chain-of-Thought

goose, I need to migrate our app from MongoDB to PostgreSQL. Let's approach 
this step by step:

1. First, analyze our current MongoDB schema and data models
2. Design an equivalent PostgreSQL schema
3. Identify any breaking changes or data transformations needed
4. Plan the migration strategy (downtime vs. gradual)
5. Propose a testing approach

Let's start with step 1. Can you analyze our models in src/models/ and 
summarize the current schema structure?
Enter fullscreen mode Exit fullscreen mode

Why it works

  • Breaks overwhelming task into manageable steps
  • Allows you to validate each step before proceeding
  • Gives goose clear direction at each stage
  • Prevents premature optimization or rushed decisions

Example Conversation Flow

You: goose, walk me through implementing rate limiting for our API, 
     step by step

goose: I'll break this down into steps:
       1. Choose a rate limiting strategy (token bucket, sliding window, etc.)
       2. Select a storage backend (Redis, in-memory, etc.)
       3. Implement the middleware
       4. Add rate limit headers
       5. Configure per-endpoint limits
       6. Add testing

       Let's start with step 1. For your API, I recommend...

You: That makes sense. Let's proceed with the token bucket strategy using 
     Redis. Show me step 2.

goose: For Redis storage, we'll need to...
Enter fullscreen mode Exit fullscreen mode

Pro Tips

  • Explicitly ask Goose to explain things "step by step"
  • Validate each step before moving forward
  • Use follow-up prompts: "Now let's move to step 3"
  • Save complex chains as templates for future use

3. Few-Shot Prompting: Teaching by Example

Few-Shot Prompting works by showing goose examples of what you want, helping it match a specific style or format by providing references to skip the guesswork.

When to Use

  • Maintaining consistent code style
  • Generating documentation in your format
  • Following specific naming conventions
  • Replicating existing patterns

❌ Generic Reques

goose, write API documentation for our endpoints
Enter fullscreen mode Exit fullscreen mode

✅ Few-Shot with Examples

goose, I need API documentation following our existing format. Here's an example 
of how we document endpoints:

"""
## POST /api/users/create

Creates a new user account.

**Request Body:**
{
  "email": "string (required)",
  "name": "string (required)",
  "role": "enum ['admin', 'user'] (optional, default: 'user')"
}

**Success Response (201):**
{
  "id": "uuid",
  "email": "string",
  "created_at": "timestamp"
}

**Error Responses:**
- 400: Invalid request body
- 409: Email already exists
"""

Now document the following endpoints in the same format:
- GET /api/users/:id
- PUT /api/users/:id
- DELETE /api/users/:id
Enter fullscreen mode Exit fullscreen mode

Why it works

  • Eliminates ambiguity about format
  • Maintains consistency across documentation
  • Reduces need for corrections
  • Helps goose understand your team's conventions

Practical Applications

1. Code Style Consistency

goose, our team uses this error handling pattern:

try {
  const result = await someAsyncOperation();
  return { success: true, data: result };
} catch (error) {
  logger.error('Operation failed:', error);
  return { success: false, error: error.message };
}

Apply this pattern to all async functions in src/services/payment.js
Enter fullscreen mode Exit fullscreen mode

2. Commit Message Format

goose, our commit messages follow this format:

feat(auth): add OAuth2 support for Google login

- Implement OAuth2 flow
- Add Google provider configuration
- Update user model to store OAuth tokens

Closes #123

Write a commit message for the changes you just made.
Enter fullscreen mode Exit fullscreen mode

Pro Tips

  • Always provide 1-3 examples for best results
  • Show edge cases in your examples if relevant
  • Include comments explaining non-obvious decisions
  • Reference existing files: "Follow the pattern in src/utils/helpers.js"

4. Iterative Refinement: The Conversation Loop

Iterative Refinement Prompting acknowledges that AI agents aren't always going to get it right on the first try, allowing you to steer the conversation by giving feedback on what needs to change.

The Pattern
Initial prompt → Review output → Provide specific feedback → Repeat until satisfied

Example Refinement Flow

You: goose, create a function that validates email addresses

goose: [Generates basic regex validation]

You: This is too simple. Add validation for:
     - Disposable email providers (block them)
     - Common typos (gmail.con → gmail.com)
     - International domains
     Also add proper error messages for each validation failure

goose: [Generates improved version with additional checks]

You: Good! Now add unit tests covering all validation cases

goose: [Adds comprehensive tests]

You: Perfect. One more thing—add TypeScript types and JSDoc comments

goose: [Final polished version]

Enter fullscreen mode Exit fullscreen mode

Why This Works

  • You maintain control over the direction
  • Avoids starting over when close to target
  • Builds on previous work incrementally
  • Teaches goose your preferences over time

Refinement Phrases That Work

- "This is too technical. Simplify it for junior developers"
- "Add error handling for network failures"
- "This works but isn't performant. Optimize for large datasets"
- "Follow the existing code style in this project"
- "Add logging and monitoring hooks"
- "Make this more defensive—validate all inputs"
- "Extract this into smaller, reusable functions"
Enter fullscreen mode Exit fullscreen mode

Catching Hallucinations

When something sounds off, you can fact-check by asking "where did you get that information? How do you know it's accurate?"

You: goose, implement WebSocket authentication using JWT

goose: [Suggests using a library that doesn't exist]

You: I can't find the library 'ws-jwt-auth' you mentioned. 
     Are you sure that exists? What's the actual package name?

goose: You're right, I apologize. The actual approach is to...
Enter fullscreen mode Exit fullscreen mode

Pro Tips

  • Think of working with Goose like pair programming—sometimes you need to clarify what you want or redirect the conversation
  • Be specific in your feedback: "too technical" is better than just "no"
  • Build incrementally rather than asking for everything at once
  • Save successful refinement patterns for similar tasks

5. Zero-Shot Prompting: Letting Goose Improvise

Zero-Shot Prompting lets Goose figure things out on its own without examples or extra guidance, useful when you want creative ideas and have a rough direction but no clear plan.

When to Use

  • Brainstorming and exploration
  • Open-ended problem solving
  • Getting unstuck on design decisions
  • Discovering alternatives you hadn't considered

Examples

"goose, I need to build a real-time collaborative editor. 
    What's the best approach?""goose, our API is slow. Analyze the code and suggest 
    performance optimizations""goose, we need to add analytics tracking. What should 
    we track and how?""goose, I'm stuck on this algorithm problem. Any creative 
    solutions?"
Enter fullscreen mode Exit fullscreen mode

The Power of Open-Ended Exploration

You: goose, I want to build a developer tool that makes code reviews 
     easier. Give me some ideas

goose: Here are several approaches you could take:

1. **PR Checklist Automation**
   - Auto-generate checklists based on changed files
   - Integrate with GitHub/GitLab APIs
   - Track completion across team members

2. **AI-Powered Code Analysis**
   - Highlight potential bugs before human review
   - Suggest test cases for changed code
   - Check for security vulnerabilities

3. **Review Session Coordinator**
   - Schedule real-time review sessions
   - Screen sharing with code annotation
   - Record decisions and action items

Which direction interests you most?
Enter fullscreen mode Exit fullscreen mode

Why It Works

  • Original ideas often end up 10x better by letting goose take the lead and suggest things you might never have thought of
  • Removes pressure of having everything figured out
  • Surfaces options you might not know exist
  • Can lead to innovative solutions

Pro Tips

  • Start broad, then narrow down based on responses
  • Ask "what else?" to explore more options
  • Follow up with "why did you suggest that?"
  • Combine with iterative refinement once direction is clear

6. Politeness-Based Prompting: Better Manners, Better Results

Being polite actually makes AI responses better, as AI models tend to generate more thoughtful, structured, and friendlier replies when asked nicely.

The Science Behind It
LLMs are trained on human text, including polite conversations that typically involve more care and detail. Saying "please" and "thank you" actually makes a difference in response quality.

❌ Blunt Command

goose, generate API documentation
Enter fullscreen mode Exit fullscreen mode

✅ Polite Request

goose, could you help me generate comprehensive API documentation 
for our endpoints? I'd really appreciate it. Thanks!
Enter fullscreen mode Exit fullscreen mode

Real Impact
The responses to polite prompts tend to be:

  • More thorough and detailed
  • Better structured
  • Include helpful explanations
  • Sometimes even warmer in tone

Examples of Polite Prompting

"goose, I'd appreciate your help debugging this issue. Could you 
    take a look at the error logs? Thank you!""goose, please review this code and let me know if you spot any 
    issues. I value your input!""goose, thanks for that solution! Could we also add error handling? 
    I appreciate your help!""goose, I'm grateful for your assistance on this project. One more 
    thing—could you add some comments explaining the complex logic?"
Enter fullscreen mode Exit fullscreen mode

Bonus: Goose Can Be Surprisingly Wholesome

One user received a sweet response from Goose at the end of a project, where it was genuinely grateful for the collaboration and even wished them sweet dreams. The relationship you build with your AI assistant matters!

Pro Tips

  • Add "please" and "thank you" naturally
  • Express appreciation for good work: "Great job on that!"
  • Use encouraging language: "This is helpful, and..."
  • This works with any prompting style

Advanced Prompting Strategies

Once you've mastered the basics, these advanced techniques will take your goose interactions to the next level.

Setting Context and Preferences

If you're using the Memory Extension, you can train goose to remember your preferences across sessions.

Setting Global Preferences

goose, remember these preferences:
- I prefer functional programming style over OOP
- Use TypeScript for all new JavaScript files
- Follow Airbnb style guide for code formatting
- Add comprehensive JSDoc comments
- Write tests in Jest, not Mocha
- I'm working on a Node.js backend with Express and PostgreSQL
Enter fullscreen mode Exit fullscreen mode

Role-Based Context

goose, remember: I'm a frontend developer learning backend development. 
When explaining backend concepts:
- Compare them to frontend equivalents when possible
- Explain why things work a certain way
- Point out common pitfalls for frontend devs moving to backend
Enter fullscreen mode Exit fullscreen mode

Task Decomposition

For large, complex tasks, break them into manageable chunks.

Master Task with Sub-Prompts

You: goose, I need to implement user authentication. Let's break this 
     into phases:

     Phase 1: Database schema and models
     Phase 2: Registration and login endpoints  
     Phase 3: JWT token generation and validation
     Phase 4: Password reset flow
     Phase 5: Email verification

     Let's start with Phase 1. Design the user table schema with 
     all necessary fields for authentication.

[Complete Phase 1]

You: Great! Phase 1 complete. Now let's move to Phase 2...
Enter fullscreen mode Exit fullscreen mode

Context Injection

Help goose understand your project better by providing relevant context upfront.

Project Structure Context

goose, here's our project structure:

src/
  controllers/  - Request handlers
  models/       - Database models (Sequelize)
  services/     - Business logic
  middleware/   - Express middleware
  utils/        - Helper functions
  routes/       - API route definitions

We follow this pattern:
- Routes call controllers
- Controllers call services  
- Services interact with models
- All business logic stays in services

Now, help me add a new feature: user profile updates
Enter fullscreen mode Exit fullscreen mode

Constraint-Driven Prompting

Specify constraints to get more targeted solutions

Performance Constraints

goose, optimize this database query. Constraints:
- Must handle 10,000+ records efficiently
- Keep response time under 200ms
- Minimize database round trips
- Acceptable to cache results for 5 minutes
Enter fullscreen mode Exit fullscreen mode

Compatibility Constraints

goose, refactor this code. Requirements:
- Must work in Node.js 14+ (no newer syntax)
- Cannot add new dependencies
- Maintain backward compatibility with existing API
- No breaking changes to function signatures
Enter fullscreen mode Exit fullscreen mode

Resource Constraints

goose, implement image processing. Limits:
- Max memory usage: 512MB
- Process images up to 10MB
- Must handle 100 concurrent requests
- Optimize for serverless environment (cold starts matter)
Enter fullscreen mode Exit fullscreen mode

Comparative Analysis

Ask goose to compare approaches and recommend the best option.
Approach Comparison

goose, I need to implement caching. Compare these approaches and 
recommend the best one for our use case:

1. Redis
2. Memcached  
3. In-memory (Node.js)
4. HTTP cache headers

Our requirements:
- Distributed system (multiple servers)
- TTL support
- Cache invalidation on updates
- Budget-conscious

Analyze pros, cons, and recommend with justification.
Enter fullscreen mode Exit fullscreen mode

Error-Driven Development

Use errors as prompts for improvements.

Iterating on Failures

You: goose, run the test suite

goose: [Tests fail with specific errors]

You: Fix the failing tests. For each failure:
     1. Explain why it's failing
     2. Show the fix
     3. Verify the fix resolves the issue
Enter fullscreen mode Exit fullscreen mode

Documentation-First Approach

Have goose write documentation before implementation.

Plan Before Code

You: goose, before we implement the payment system, write 
     technical documentation covering:

     1. Architecture overview
     2. API endpoint specifications
     3. Data models
     4. Security considerations
     5. Error handling strategy
     6. Testing approach

     Once we agree on the design, we'll implement it.

[Review and refine documentation]

You: Perfect! Now implement according to this spec.
Enter fullscreen mode Exit fullscreen mode

Common Pitfalls and How to Avoid Them

Pitfall 1: Vague Instructions

❌ Problem:

goose, make the app better
Enter fullscreen mode Exit fullscreen mode

✅ Solution:

goose, improve the app's performance by:
- Optimizing database queries in the user service
- Adding caching for frequently accessed data
- Reducing bundle size by code-splitting
- Implementing lazy loading for images

Start with the database query optimization.
Enter fullscreen mode Exit fullscreen mode

Pitfall 2: Assuming Goose Knows Your Codebase

❌ Problem:

goose, fix the bug in the auth module
Enter fullscreen mode Exit fullscreen mode

✅ Solution:

goose, there's a bug in src/auth/login.js line 45. When users try to 
login with valid credentials, they get a 401 error. The issue appeared 
after upgrading bcrypt from v4 to v5. Can you investigate and fix it?
Enter fullscreen mode Exit fullscreen mode

Pitfall 3: Not Providing Error Context

❌ Problem:

goose, my code isn't working
Enter fullscreen mode Exit fullscreen mode

✅ Solution:

goose, I'm getting this error when running the tests:

TypeError: Cannot read property 'length' of undefined
    at UserService.validateEmail (src/services/user.js:23)

The error occurs when calling validateEmail with null input. 
Here's the relevant code: [paste code]

Fix the null handling and add validation.
Enter fullscreen mode Exit fullscreen mode

Pitfall 4: Overloading a Single Prompt

❌ Problem:

goose, create a full e-commerce site with user auth, product catalog, 
shopping cart, payment processing, order management, admin dashboard, 
email notifications, and analytics
Enter fullscreen mode Exit fullscreen mode

✅ Solution:
Break it into phases (use chain-of-thought or task decomposition):

goose, let's build an e-commerce site step by step. Phase 1: User 
authentication and authorization. Let's start there.
Enter fullscreen mode Exit fullscreen mode

Pitfall 5: Ignoring Model Limitations

❌ Problem:
Expecting goose to know real-time information or access external resources it can't reach.
✅ Solution:

goose, I need to integrate with the Stripe API. Here's their latest 
documentation: [paste relevant docs]. Implement payment processing 
following these guidelines.
Enter fullscreen mode Exit fullscreen mode

Pitfall 6: Not Reviewing AI-Generated Code

❌ Problem:
Blindly accepting and deploying Goose's code without review.
✅ Solution:

  • Always review generated code
  • Run tests before committing
  • Check for security vulnerabilities
  • Verify edge cases are handled
  • Ask Goose to explain complex logic
goose, explain what this regex pattern does and why you chose this approach
Enter fullscreen mode Exit fullscreen mode

Pitfall 7: Forgetting to Specify Output Format

❌ Problem:

goose, document the API
Enter fullscreen mode Exit fullscreen mode

✅ Solution

goose, document the API in OpenAPI 3.0 format. Include:
- All endpoints with methods
- Request/response schemas
- Authentication requirements
- Example requests and responses
- Error codes and meanings

Output as a valid openapi.yaml file.
Enter fullscreen mode Exit fullscreen mode

Optimizing for Different LLM Providers

Different models have different strengths. Adjust your approach based on your provider.

GPT-4o (OpenAI)

Strengths:

  • Excellent at following complex instructions
  • Strong coding capabilities
  • Good at understanding context

Optimization Tips:

  • Be specific and detailed
  • Use structured prompts
  • Leverage function calling for tool use Example
goose, analyze the performance bottlenecks in src/services/data.js 
and propose specific optimizations. For each suggestion, explain:
1. Current problem
2. Proposed solution  
3. Expected impact
4. Implementation difficulty (1-5 scale)
Enter fullscreen mode Exit fullscreen mode

Claude (Anthropic)

Strengths:

  • Excellent reasoning capabilities
  • Strong at code analysis and refactoring
  • Good at explaining complex concepts

Optimization Tips:

  • Ask for step-by-step reasoning
  • Use chain-of-thought prompting
  • Request detailed explanations Example
goose, walk me through refactoring this legacy code. For each change:
- Explain what the current code does
- Identify the problem
- Show the improved version
- Explain why it's better
Enter fullscreen mode Exit fullscreen mode

Gemini (Google)

Strengths:

  • Fast responses
  • Good at code generation
  • Strong multimodal capabilities

Optimization Tips:

  • Use clear, direct instructions
  • Provide examples when possible
  • Break complex tasks into steps

Example

goose, generate a React component for file upload. Requirements:
- Drag-and-drop support
- Progress indicators
- Multiple file selection
- File type validation

Show me the complete implementation with TypeScript types.
Enter fullscreen mode Exit fullscreen mode

Building Effective Workflows

The Debug Workflow

1. Describe the symptom
   "goose, users are getting 500 errors on the checkout page"

2. Provide context
   "This started after deploying the payment gateway update"

3. Share error details
   [Paste error logs, stack traces]

4. Request investigation
   "Investigate the cause and propose fixes"

5. Iterate on solution
   "That fix works, but add error handling for network timeouts"

6. Verify
   "Run the test suite to confirm the fix"```


#### The Feature Development Workflow


```html
1. High-level overview
   "goose, I need to add two-factor authentication"

2. Break into phases
   "Let's plan this in phases: setup, implementation, testing"

3. Design first
   "Start with the database schema and API design"

4. Implement incrementally
   [Complete each phase before moving forward]

5. Test continuously
   "Write tests for each component as we build"

6. Document
   "Add documentation for the completed feature"
Enter fullscreen mode Exit fullscreen mode

The Learning Workflow

1. State your knowledge level
   "goose, I'm new to GraphQL"

2. Ask for structured explanation
   "Explain GraphQL step by step, starting with the basics"

3. Request examples
   "Show me a practical example with our existing Express setup"

4. Practice with guidance
   "Let's implement a simple GraphQL endpoint together"

5. Review and refine
   "Review my implementation and suggest improvements"
Enter fullscreen mode Exit fullscreen mode

The Code Review Workflow

1. Set review criteria
   "goose, review this PR for:
   - Code quality and readability
   - Performance issues
   - Security vulnerabilities
   - Test coverage
   - Documentation"

2. Request specific feedback
   "Focus especially on the error handling patterns"

3. Ask for alternatives
   "Are there better approaches I should consider?"

4. Implement suggestions
   "Make the changes you recommended"

5. Final verification
   "Review the updated code"
Enter fullscreen mode Exit fullscreen mode

Measuring Success: Prompt Quality Checklist

Before sending a prompt, check:

  1. Clear objective: Does goose know exactly what you want?
  2. Sufficient context: Have you provided necessary background?
  3. Specific constraints: Are limitations and requirements stated?
  4. Appropriate scope: Is the task reasonable for one interaction?
  5. Output format specified: Does goose know how to deliver results?
  6. Success criteria: Can you evaluate if the response is good?
  7. Polite tone: Have you asked nicely?

Quick Reference: Prompt Templates

For Bug Fixes

goose, there's a bug in [file/function]. 

**Symptom:** [What's happening]
**Expected:** [What should happen]
**Context:** [When it started, recent changes]
**Error:** [Paste error message/logs]

Please debug and fix this issue.
Enter fullscreen mode Exit fullscreen mode

For New Features

goose, implement [feature name].

**Requirements:**
- [Requirement 1]
- [Requirement 2]
- [Requirement 3]

**Technical constraints:**
- [Stack/framework details]
- [Performance requirements]
- [Compatibility needs]

**Acceptance criteria:**
- [How to verify it works]

Please provide a complete implementation with tests.
Enter fullscreen mode Exit fullscreen mode

For Code Review

goose, review this code:

[Paste code or specify file]

**Focus areas:**
- [Performance]
- [Security]
- [Maintainability]
- [Best practices]

Please provide:
1. Issues found
2. Severity of each issue
3. Specific fixes
4. Alternative approaches if applicable
Enter fullscreen mode Exit fullscreen mode

For Refactoring

goose, refactor [file/component].

**Goals:**
- [Improve readability]
- [Better performance]
- [Reduce complexity]

**Constraints:**
- [Must maintain backward compatibility]
- [Cannot add dependencies]

**Current issues:**
- [Problem 1]
- [Problem 2]

Show the refactored code and explain the improvements.
Enter fullscreen mode Exit fullscreen mode

For Learning

goose, I want to understand [concept].

**My background:** [Your experience level]
**Specific questions:** [What you're confused about]
**Learning goal:** [What you want to achieve]

Please explain step by step, using examples relevant to 
[your tech stack/project].
Enter fullscreen mode Exit fullscreen mode

Bonus: Real-World Prompting Examples

Let's look at some real-world scenarios and how to prompt effectively for each.

Scenario 1: Debugging Production Issue

Context: Your production API is experiencing intermittent 503 errors during peak traffic
Effective Prompt

goose, we're experiencing 503 errors in production during peak traffic 
(~1000 req/sec). 

**Environment:**
- Node.js 18, Express, PostgreSQL
- Load balanced across 4 instances
- Redis for session storage

**Observed behavior:**
- Errors spike between 6-8 PM daily
- Database connection pool shows no issues
- Memory usage normal (< 70%)
- CPU spikes to 95% during error periods

**Files to investigate:**
- src/middleware/rateLimiter.js
- src/services/cache.js
- src/db/connection.js

Please analyze these files, identify the bottleneck, and propose a fix.
Enter fullscreen mode Exit fullscreen mode

Why this works

  • Specific error type and occurrence pattern
  • Complete technical context
  • Observable metrics provided
  • Directs investigation to likely culprits
  • Clear request for analysis and solution

Scenario 2: Implementing a New Feature

Context: Adding a notification system to your application.
Effective Prompt

goose, let's implement a notification system. Here's the plan:

**Phase 1: Data Model Design**

Create database tables for:
- Notifications (id, user_id, type, content, read_at, created_at)
- Notification Preferences (user_id, email_enabled, push_enabled, frequency)

Use PostgreSQL with Sequelize ORM following our existing model patterns 
in src/models/

**Constraints:**
- Must scale to millions of notifications
- Support soft deletes
- Include indexes for common queries (user_id + read_at)
- Add created_at and updated_at timestamps

Let's start with Phase 1. Show me the migration files and model definitions.
Enter fullscreen mode Exit fullscreen mode

Follow-up prompts

[After Phase 1 complete]

goose, Phase 2: API Endpoints

Create REST endpoints:
- POST /api/notifications - Create notification
- GET /api/notifications - List user's notifications (paginated)
- PATCH /api/notifications/:id/read - Mark as read
- PATCH /api/notifications/read-all - Mark all as read
- DELETE /api/notifications/:id - Delete notification

Follow our controller → service → model pattern.
Include input validation using Joi.
Add appropriate error handling.

Show implementation for all endpoints.
Enter fullscreen mode Exit fullscreen mode

Scenario 3: Code Quality Improvement

Context: Refactoring legacy JavaScript to TypeScript.
Effective Prompt

goose, convert src/utils/validation.js to TypeScript.

**Current file issues:**
- No type safety
- Unclear function signatures
- Lacks input validation
- No JSDoc comments
- Uses var instead of const/let

**Requirements:**
1. Add proper TypeScript types for all functions
2. Create interfaces for complex objects
3. Add comprehensive JSDoc with examples
4. Improve error messages to be more descriptive
5. Add input validation with helpful errors
6. Export types for use in other files
7. Maintain 100% backward compatibility

**Code style:**
- Use functional programming patterns
- Prefer const over let
- Use arrow functions for simple operations
- Add unit tests for all exported functions

Show the complete TypeScript implementation.
Enter fullscreen mode Exit fullscreen mode

Scenario 4: Performance Optimization

Context: Slow database queries affecting user experience.
Effective Prompt

goose, optimize the slow queries in src/services/analytics.js

**Performance requirements:**
- Query execution time: < 100ms (currently 2-3 seconds)
- Handle datasets up to 100k records
- Support concurrent queries (50+ users)

**Current approach:**
- Multiple sequential database queries
- No caching
- Fetching all columns when only few needed
- No pagination on large result sets

**Available tools:**
- PostgreSQL 14 with jsonb support
- Redis for caching (already configured)
- Database indexes (can be added)

**Optimization goals:**
1. Reduce database round trips
2. Implement intelligent caching
3. Add database indexes where helpful
4. Use query optimization techniques
5. Implement pagination for large datasets

Analyze the current implementation, identify bottlenecks, and show 
optimized code with explanations for each improvement.
Enter fullscreen mode Exit fullscreen mode

Scenario 5: Security Audit

Context: Preparing for a security audit.
Effective Prompt

goose, perform a security audit on our authentication system.

**Files to review:**
- src/auth/login.js
- src/auth/register.js
- src/auth/resetPassword.js
- src/middleware/authenticate.js

**Security checklist:**
1. SQL injection vulnerabilities
2. XSS attack vectors
3. CSRF protection
4. Password storage (bcrypt usage, salt rounds)
5. JWT token security (secret strength, expiration)
6. Rate limiting on auth endpoints
7. Input validation and sanitization
8. Error message information leakage
9. Session management security
10. Brute force protection

For each file, identify:
- **Critical issues**: Immediate security risks
- **Warnings**: Potential vulnerabilities
- **Recommendations**: Security best practices

Provide specific code fixes for all issues found.
Enter fullscreen mode Exit fullscreen mode

Scenario 6: Documentation Generation

Context: Need comprehensive API documentation.
Effective Prompt

goose, generate OpenAPI 3.0 documentation for our REST API.

**Source files:**
- src/routes/*.js (all route definitions)
- src/controllers/*.js (controller implementations)

**Documentation requirements:**
1. All endpoints with methods, paths, descriptions
2. Request body schemas with examples
3. Response schemas for success and error cases
4. Authentication requirements per endpoint
5. Query parameters with types and constraints
6. Path parameters with descriptions
7. Example requests and responses for each endpoint
8. Error codes with meaningful descriptions

**Our API conventions:**
- Success: 200/201 with data in response
- Client errors: 400/401/403/404 with { error: "message" }
- Server errors: 500 with generic error message
- Pagination: ?page=1&limit=20 (default limit: 20, max: 100)
- Authentication: Bearer token in Authorization header

Generate a complete openapi.yaml file following OpenAPI 3.0 spec.
Enter fullscreen mode Exit fullscreen mode

Scenario 7: Test Coverage Improvement

Context: Increasing test coverage before deployment.
Effective Prompt

goose, add comprehensive test coverage for src/services/paymentService.js

**Current coverage:** 45% (unacceptable)
**Target coverage:** 90%+

**Testing requirements:**
1. Unit tests for all public methods
2. Integration tests for payment gateway interactions
3. Edge cases and error scenarios
4. Mock external API calls (Stripe)
5. Test success and failure paths
6. Validate input handling
7. Check error message clarity

**Test structure to follow:**
- Use Jest as testing framework
- Follow AAA pattern (Arrange, Act, Assert)
- Group tests by method using describe blocks
- Use descriptive test names (it should...)
- Mock external dependencies properly
- Test one thing per test case

**Specific scenarios to cover:**
- Valid payment processing
- Invalid payment details
- Network failures
- Timeout scenarios
- Insufficient funds
- Currency validation
- Amount validation (positive, not zero, within limits)
- Idempotency (duplicate payment prevention)

Show complete test file with all test cases.
Enter fullscreen mode Exit fullscreen mode

Scenario 8: Migration Planning

Context: Migrating from REST to GraphQL.
Effective Prompt

goose, help me plan our migration from REST to GraphQL.

**Current state:**
- 25 REST endpoints in Express
- PostgreSQL database with Sequelize ORM
- JWT authentication
- ~10k daily API requests

**Goals:**
- Gradual migration (not big bang)
- Maintain backward compatibility
- Improve frontend data fetching efficiency
- Reduce over-fetching and under-fetching

**Phase 1: Planning**

Analyze our current REST API in src/routes/ and:

1. Recommend which endpoints to migrate first (quick wins)
2. Design GraphQL schema covering all current functionality
3. Propose a migration strategy (parallel run vs incremental)
4. Identify potential challenges and solutions
5. Estimate complexity and timeline for each phase

**Constraints:**
- Cannot break existing mobile apps (still using REST)
- Must maintain same authentication mechanism
- Need monitoring to compare REST vs GraphQL performance
- Team has limited GraphQL experience

Provide detailed analysis with actionable recommendations.
Enter fullscreen mode Exit fullscreen mode

Pro Tips from Experienced goose Users

Tip 1: Create Prompt Templates

Save your successful prompts as templates for similar tasks:

# Save to ~/.goose-prompts/debug-template.md
goose, debug the issue in [FILE].

**Symptom:** [DESCRIPTION]
**Expected:** [EXPECTED_BEHAVIOR]
**Context:** [RECENT_CHANGES]
**Error:** [ERROR_MESSAGE]

Please investigate and fix.
Enter fullscreen mode Exit fullscreen mode

Tip 2: Use Session Context Strategically

Start sessions in the relevant directory to give goose proper context:

# Navigate to the specific feature directory
cd src/features/authentication
goose session

# goose now has context of auth-related files
Enter fullscreen mode Exit fullscreen mode

Tip 3: Leverage goose's Memory

With the Memory Extension enabled, teach Goose your preferences once:

goose, remember these coding standards:
- Use async/await, not callbacks or .then()
- Prefer const over let, never use var
- Always add TypeScript types
- Include error handling in all async functions
- Write tests for all new features
- Add JSDoc comments for public APIs
- Follow our naming: camelCase for functions, PascalCase for classes
Enter fullscreen mode Exit fullscreen mode

Tip 4: Progressive Disclosure

Don't dump all information at once. Start high-level, then drill down:

You: goose, I need to optimize our database queries

goose: I can help with that. Which specific queries or operations 
      are slow?

You: The user search functionality takes 3+ seconds

goose: Let me analyze the search implementation. Which file contains 
      the search logic?

You: src/services/userService.js, method searchUsers()

goose: [Analyzes code] I found several optimization opportunities...
Enter fullscreen mode Exit fullscreen mode

Tip 5: Validate Before Accepting

Always ask goose to explain complex changes:

You: [After Goose implements a complex algorithm]
     goose, explain how this algorithm works and why you chose 
     this approach

goose: [Provides detailed explanation]

You: What are the time and space complexity trade-offs?

goose: [Explains Big O complexity and alternatives]
Enter fullscreen mode Exit fullscreen mode

Tip 7: Context Files

Create a CONTEXT.md in your project root with important information

# Project Context for AI Assistants

## Tech Stack
- Backend: Node.js 18, Express 4, PostgreSQL 14
- Frontend: React 18, TypeScript 5, Tailwind CSS
- Testing: Jest, React Testing Library

## Coding Standards
- TypeScript for all new code
- Functional programming preferred
- Async/await over promises
- Comprehensive error handling required

## Architecture Patterns
- Controllers handle HTTP, delegate to services
- Services contain business logic
- Models handle data access
- Middleware for cross-cutting concerns

## Common Commands
- npm run dev - Start development server
- npm test - Run test suite
- npm run lint - Check code style
- npm run migrate - Run database migrations
Enter fullscreen mode Exit fullscreen mode

Then reference it: "goose, refer to CONTEXT.md for our coding standards"

Tip 8: Error Log Analysis

When debugging, provide structured error information:

goose, analyze this error:

**Stack Trace:**
[Full stack trace]

**Request Details:**
- Method: POST
- Endpoint: /api/users/create
- Body: { email: "test@example.com", name: "Test User" }
- Headers: [Relevant headers]

**Environment:**
- Node version: 18.17.0
- Dependencies: [Relevant package versions]
- Environment: staging

**Recent Changes:**
- Updated user validation logic (commit abc123)
- Migrated to new database schema (commit def456)

What's causing this error and how do we fix it?
Enter fullscreen mode Exit fullscreen mode

Tip 9: Comparative Learning

Ask Goose to compare approaches when learning

goose, I need to implement real-time features. Compare these approaches 
for our use case:

1. WebSockets
2. Server-Sent Events (SSE)
3. Long polling
4. GraphQL Subscriptions

Our requirements:
- Bidirectional communication
- 500+ concurrent connections
- Mobile app support
- Need to work through corporate firewalls

Create a comparison table with pros/cons and recommendation.
Enter fullscreen mode Exit fullscreen mode

Tip 10: Version-Specific Guidance

Specify versions to avoid deprecated solutions:

goose, implement OAuth2 authentication using Passport.js.

**Important:** 
- Use Passport.js v0.6+ (not legacy versions)
- Node.js 18 compatible syntax
- Express 4 (not Express 5)
- No deprecated methods

Show current best practices as of 2025.
Enter fullscreen mode Exit fullscreen mode

Common goose Workflows

Morning Debug Ritual

# Start your day by reviewing failures
cd ~/projects/my-app
goose session

> goose, run the test suite and summarize any failures

> [goose runs tests, identifies 3 failures]

> goose, let's fix these one by one. Start with the authentication 
  test failure. Explain what's wrong, then fix it.

> [Fix, test, verify]

> Great! Next failure...
Enter fullscreen mode Exit fullscreen mode

Code Review Workflow

# Before committing
goose session

> goose, review my uncommitted changes for:
  1. Potential bugs
  2. Performance issues
  3. Security vulnerabilities
  4. Code style violations
  5. Missing tests

> [goose analyzes git diff]

> goose, fix the issues you found

> [Verify fixes]

> goose, generate a descriptive commit message
Enter fullscreen mode Exit fullscreen mode

Learning New Technology

goose session

> goose, I need to learn Docker for our deployment. I know Node.js 
  well but haven't used containers.

  Teach me Docker by:
  1. Explaining core concepts with Node.js analogies
  2. Creating a Dockerfile for our Express app
  3. Setting up docker-compose for our stack
  4. Showing common commands I'll need

  Let's start with #1

> [Learn incrementally]
Enter fullscreen mode Exit fullscreen mode

Feature Development Sprint

goose session

> goose, feature: Add email notifications

  Let's work in sprints:

  Sprint 1 (30 min): Design & Planning
  - Database schema
  - API endpoints design
  - Email template structure

  Sprint 2 (45 min): Core Implementation
  - Database models
  - Email service
  - API endpoints

  Sprint 3 (30 min): Testing & Polish
  - Unit tests
  - Integration tests
  - Error handling

  Start Sprint 1 now.
Enter fullscreen mode Exit fullscreen mode

Troubleshooting Your Prompts

If goose gives generic answers:

Problem: "I need help with my code"
Fix: Be specific:

goose, the login function in src/auth/login.js (line 45-67) returns 
undefined instead of a user object when credentials are valid.

Expected: { id, email, token }
Actual: undefined

Recent changes: Upgraded bcrypt from v4 to v5

Debug this issue.
Enter fullscreen mode Exit fullscreen mode

If Goose misunderstands

Problem: goose solves a different problem
Fix: Clarify and redirect

goose, I think we're not on the same page. Let me clarify:

I DON'T need: A new authentication system
I DO need: Fix the existing login that broke after the bcrypt upgrade

Focus on why bcrypt.compare() might behave differently in v5.
Enter fullscreen mode Exit fullscreen mode

If responses are too technical

Problem: Overwhelming technical jargon
Fix: Adjust the level

goose, that explanation is too technical. Remember I'm primarily a 
frontend developer learning backend.

Explain the same thing but:
- Use simpler terms
- Compare to frontend concepts when possible
- Focus on practical use over theory
Enter fullscreen mode Exit fullscreen mode

Final Thoughts: Growing with goose

Prompt engineering is a journey, not a destination. As you work more with goose, you'll develop intuition for what works. You'll find your own voice, create your own templates, and discover techniques that fit your workflow.
The key principles remain constant:

  • Clarity over cleverness
  • Context is king
  • Iteration is natural
  • Politeness pays off

Remember, goose is a tool that amplifies your capabilities. It won't replace your expertise, judgment, or creativity—but it will make you significantly more productive when you learn to communicate effectively.
Now go forth and prompt with confidence! Your next goose session awaits, and with these techniques, you're well-equipped to make it your most productive yet.

Happy coding with goose! 🦢

Conclusion

The best prompts feel natural, and the most important thing is keeping them clear and natural without overthinking, though adding a little structure can make a huge difference.
Effective prompt engineering isn't about memorizing magical phrases or following rigid formulas. It's about clear communication, iterative refinement, and understanding that goose is here to make your life easier

Key Takeaways

  1. Be specific: Vague prompts get vague results
  2. Provide context: Goose can't read your mind
  3. Iterate freely: First drafts rarely perfect; refine as you go
  4. Use examples: Show don't just tell when possible
  5. Break down complexity: Chain-of-thought for big tasks
  6. Be polite: It genuinely improves results
  7. Understand your model: Different LLMs need different approaches
  8. Review everything: AI is a tool, not a replacement for judgment

Moving Forward

The next time you open a goose session:

  • Start with clear intent
  • Provide necessary context
  • Experiment with different approaches
  • Refine based on results
  • Build on what works

Remember, prompt engineering is a skill that improves with practice. Every interaction teaches you something about how to communicate more effectively with AI. Your prompts will naturally become better as you develop intuition for what works.

Additional Resources

Want to Learn More?

Have questions or additional prompting tips? Drop them in the comments below!

Top comments (0)