DEV Community

Cover image for 10 ChatGPT Prompts Every Software Developer Should Try
Md. Saddam Hossain
Md. Saddam Hossain

Posted on

10 ChatGPT Prompts Every Software Developer Should Try

10 ChatGPT Prompts Every Software Developer Should Try

AI is becoming part of everyday software development.

Developers are using AI for debugging, architecture, code reviews, testing, SQL optimization, documentation, learning, and building new applications.

But there is one thing I've learned:

Better prompts usually lead to better results.

If you simply tell AI:

"Fix this code."

You're asking it to guess the problem.

Instead, give it context, explain the expected behavior, and tell it what you want.

Here are 10 practical ChatGPT prompts you can use in your development workflow.


1. Debugging Code

❌ Instead of

Fix this code.
Enter fullscreen mode Exit fullscreen mode

✅ Try this

I'm working on an ASP.NET Core Web API using .NET 10 and Entity Framework Core.

This endpoint should return orders belonging only to the currently
authenticated user, but it is returning orders from other users.

Here is the current implementation:

[paste code]

Please:

1. Identify the root cause.
2. Explain why the problem happens.
3. Provide a corrected implementation.
4. Explain any security implications.
5. Write a test that verifies one user cannot access another user's orders.
Enter fullscreen mode Exit fullscreen mode

The better prompt provides the technology, context, problem, expected behavior, and desired output.


2. Designing Software Architecture

❌ Instead of

Give me a good architecture for my application.
Enter fullscreen mode Exit fullscreen mode

✅ Try this

I'm building a multi-tenant SaaS application using:

- ASP.NET Core
- Blazor
- SQL Server
- Entity Framework Core

The application will have:

- Authentication
- Subscription management
- Background jobs
- Admin dashboard
- Multiple business modules

Compare:

1. Clean Architecture
2. Vertical Slice Architecture
3. Traditional Layered Architecture

Evaluate them based on:

- Maintainability
- Testability
- Complexity
- Development speed
- Scalability

Then recommend one approach and provide a suggested solution structure.
Enter fullscreen mode Exit fullscreen mode

Instead of asking AI to randomly choose an architecture, give it the requirements and criteria you care about.


3. Code Review

❌ Instead of

Review my code.
Enter fullscreen mode Exit fullscreen mode

✅ Try this

Review the following C# service as a senior .NET engineer.

Focus specifically on:

1. Bugs and incorrect behavior
2. Security problems
3. Unnecessary database queries
4. EF Core performance
5. Maintainability
6. Separation of responsibilities

Don't suggest changes just for formatting or personal style.

For each important issue, explain:

- What is wrong
- Why it matters
- How to improve it

Here is the code:

[paste code]
Enter fullscreen mode Exit fullscreen mode

This keeps the review focused on the things that actually matter.


4. Writing Better Unit Tests

❌ Instead of

Write unit tests for this class.
Enter fullscreen mode Exit fullscreen mode

✅ Try this

Create unit tests for this C# calculation service using xUnit.

The service calculates the final price after applying discounts.

Cover:

- Normal discount
- Zero discount
- Maximum allowed discount
- Negative values
- Null input
- Boundary values
- Invalid discount percentages

Use the Arrange-Act-Assert pattern.

Focus on testing behavior rather than implementation details.
Use clear and descriptive test names.
Enter fullscreen mode Exit fullscreen mode

The important part is that you're giving AI a list of behaviors that must be tested.


5. Optimizing a SQL Server Query

❌ Instead of

Optimize this SQL query.
Enter fullscreen mode Exit fullscreen mode

✅ Try this

I'm using SQL Server in a production application.

The Orders table contains approximately 2 million rows.

This query currently takes around 4 seconds:

[paste query]

Relevant indexes:

[paste indexes]

The query should return the most recent orders for a specific user.

Please:

1. Identify potential performance problems.
2. Explain why they may be occurring.
3. Suggest a better query if appropriate.
4. Recommend indexes if necessary.
5. Explain the trade-offs of those indexes.
Enter fullscreen mode Exit fullscreen mode

SQL performance depends on context, so give AI enough information to reason about the actual problem.


6. Learning a New Technology

❌ Instead of

Teach me Docker.
Enter fullscreen mode Exit fullscreen mode

✅ Try this

I'm a senior .NET developer and already understand:

- ASP.NET Core
- REST APIs
- SQL Server
- Application deployment

I want to learn Docker specifically for deploying ASP.NET Core applications.

Teach me through a practical project.

Cover:

1. Dockerfile
2. Building an image
3. Running the application
4. Environment variables
5. SQL Server containers
6. Docker Compose
7. Production considerations

Explain each topic briefly and give me a small practical task before moving to the next topic.
Enter fullscreen mode Exit fullscreen mode

Tell AI what you already know.

That way, you can spend more time learning what you actually need.


7. Refactoring Legacy Code

❌ Instead of

Refactor this code.
Enter fullscreen mode Exit fullscreen mode

✅ Try this

I have a legacy C# service that works correctly but is difficult to maintain.

Refactor it while preserving its existing behavior.

Focus on:

- Removing duplicated logic
- Reducing method complexity
- Improving naming
- Separating responsibilities
- Making the code easier to test

Do not introduce unnecessary design patterns.

First:

1. Explain the main problems.
2. Show the refactored implementation.
3. Explain what changed.
4. Explain why each change improves the code.
Enter fullscreen mode Exit fullscreen mode

This is particularly useful when working with legacy code.

And remember:

More abstractions don't automatically mean better code.


8. Writing API Documentation

❌ Instead of

Write documentation for this API.
Enter fullscreen mode Exit fullscreen mode

✅ Try this

Create developer documentation for the following ASP.NET Core Web API endpoint.

The audience is backend developers integrating with this API.

Include:

- Endpoint
- HTTP method
- Authentication requirements
- Request parameters
- Request example
- Successful response
- Error responses
- Validation rules
- curl example

Use Markdown.

Keep the documentation concise and practical.

Here is the endpoint:

[paste code]
Enter fullscreen mode Exit fullscreen mode

This gives AI both the audience and the structure you expect.


9. Making a Technology Decision

❌ Instead of

Should I use Redis?
Enter fullscreen mode Exit fullscreen mode

✅ Try this

I'm building a SaaS application using ASP.NET Core and SQL Server.

The application currently handles approximately 50 requests per second.

Most requests read relatively static configuration and reference data.

I'm considering Redis to reduce database queries.

Compare:

1. SQL Server only
2. In-memory caching
3. Distributed Redis caching

Evaluate them based on:

- Complexity
- Cost
- Scalability
- Cache invalidation
- Failure scenarios
- Operational overhead

Then recommend the most appropriate option for the current scale.

Also explain when I should reconsider the decision as traffic increases.
Enter fullscreen mode Exit fullscreen mode

Don't just ask AI which technology to use.

Give it the information needed to make a meaningful trade-off.


10. Building an Application With AI

❌ Instead of

Build me a SaaS application.
Enter fullscreen mode Exit fullscreen mode

✅ Try this

I want to build a small SaaS application for developers.

The application will provide .NET developer tools and generators.

Technology:

- ASP.NET Core
- Blazor
- SQL Server
- Entity Framework Core

Core requirements:

- User registration and login
- User dashboard
- Free and paid usage limits
- Admin dashboard
- Usage tracking
- Subscription management

The architecture should support adding more developer tools later.

Before writing any code:

1. Identify the major requirements.
2. Identify missing decisions.
3. Propose the architecture.
4. Define the solution structure.
5. Define the main entities.
6. Break development into implementation phases.

Do not start implementing until the architecture and development plan are clear.
Enter fullscreen mode Exit fullscreen mode

This is especially important when using AI to build larger applications.

Don't ask AI to build the entire application in one shot.

A better workflow is:

Understand → Plan → Design → Implement → Test → Review


A Simple Formula for Better Prompts

Most useful developer prompts contain some combination of these elements:

Context

What are you building?

I'm building an ASP.NET Core SaaS application.
Enter fullscreen mode Exit fullscreen mode

Goal

What are you trying to achieve?

I want to reduce unnecessary database queries.
Enter fullscreen mode Exit fullscreen mode

Current Situation

What is happening now?

The endpoint currently takes 3 seconds.
Enter fullscreen mode Exit fullscreen mode

Constraints

What limitations should AI consider?

Don't introduce unnecessary dependencies.
Enter fullscreen mode Exit fullscreen mode

Input

Give AI the information it needs.

Here is the code...
Enter fullscreen mode Exit fullscreen mode

Expected Output

Tell AI what you want back.

Explain the root cause and provide a corrected implementation.
Enter fullscreen mode Exit fullscreen mode

Success Criteria

What does a successful solution look like?

The solution must prevent users from accessing another user's data.
Enter fullscreen mode Exit fullscreen mode

You don't need every section for every prompt.

Use what is relevant to the problem.


My Simple Prompt Template

When I'm not sure how to structure a prompt, I start with something like this:

I'm trying to [GOAL].

Context:
[WHAT I'M BUILDING]

Current situation:
[WHAT IS HAPPENING]

Expected result:
[WHAT I WANT]

Constraints:
[IMPORTANT LIMITATIONS]

Input:
[CODE / DATA / REQUIREMENTS]

Please:
[SPECIFIC TASK]

Output:
[HOW I WANT THE ANSWER]
Enter fullscreen mode Exit fullscreen mode

You can adapt this to debugging, architecture, testing, documentation, learning, and many other development tasks.


Don't Confuse Better Prompts With Longer Prompts

A better prompt doesn't necessarily need to be a long prompt.

The goal isn't:

Write more.

The goal is:

Remove ambiguity.

For a simple question, two sentences might be enough.

For a complex architecture decision, you may need several paragraphs.

The prompt should contain enough information for AI to understand the problem without unnecessary noise.


Final Thoughts

AI is becoming a normal part of software development.

But getting better results isn't only about choosing the right AI tool.

It's also about learning how to communicate problems clearly.

Instead of:

Fix this.
Enter fullscreen mode Exit fullscreen mode

Try:

Here is what I'm building.

Here is what I expected.

Here is what actually happened.

Here is the relevant code.

Find the root cause, explain it, and provide the safest fix.
Enter fullscreen mode Exit fullscreen mode

That small difference can completely change the quality of the response.

So when an AI answer feels generic, don't immediately blame the model.

Ask yourself:

Did I give it enough context to solve the actual problem?

Better context.

Better instructions.

Better results.

And in the age of AI-assisted software development, knowing how to communicate with AI is becoming another important developer skill.

Top comments (0)