DEV Community

yangchunhong
yangchunhong

Posted on

10 AI Prompts That Make You Look Like a Senior Developer

I've been using AI for coding daily for 6 months. These 10 prompts consistently make me look more competent than I am.

They're from a larger pack I put together — 50 templates spanning marketing, writing, coding, data, and translation. But here are the 10 coding-specific ones, for free.


1. The Bug Fixer (My Most-Used Prompt)

The following [LANGUAGE] code has a bug: [DESCRIBE SYMPTOM].
Analyze the code, identify the root cause, explain WHY it happens,
provide the corrected code, and explain how your fix works.
Include a test case that would have caught this bug.
Enter fullscreen mode Exit fullscreen mode

Why it works: Forces the AI to explain causation, not just patch symptoms. The test case requirement catches regressions.

2. The Refactoring Request

Refactor this [LANGUAGE] code for readability and maintainability.
Apply: meaningful variable names, extract helper functions,
reduce nesting, add docstrings. Preserve all functionality.
Show before/after with explanation of each change.
Enter fullscreen mode Exit fullscreen mode

3. Function From Spec

Write a [LANGUAGE] function that [DESCRIPTION].
Handle edge cases: [LIST]. Return type: [TYPE].
Time complexity target: O([N]).
Include type hints, input validation, error handling,
and 3 usage examples. Use only standard library.
Enter fullscreen mode Exit fullscreen mode

4. The SQL Query You Can't Quite Write

Write a SQL query for [DB] that [REQUIREMENT].
Tables: [NAMES]. Include JOINs, WHERE, GROUP BY, ORDER BY, LIMIT.
Add EXPLAIN annotation comments. Optimize for the indexes: [INDEXES].
Enter fullscreen mode Exit fullscreen mode

5. Unit Tests (So You Can Ship Friday)

Write comprehensive unit tests for this [LANGUAGE] function
using [FRAMEWORK]. Cover: happy path, edge cases, error conditions,
and boundary values. Include setup/teardown. Aim for 90%+ coverage.
Enter fullscreen mode Exit fullscreen mode

6. The API Endpoint You've Written 100 Times

Generate a [FRAMEWORK] API endpoint for [OPERATION] on [RESOURCE].
Include: route, validation, auth check, business logic placeholder,
DB query, response formatting, error handling.
Add rate limiting and logging middleware. Use [DATABASE].
Enter fullscreen mode Exit fullscreen mode

7. Code Review (Before Your Team Does It)

Review this code for: security vulnerabilities, performance issues,
code smells, and style violations. Rate severity (Critical/Med/Low).
Suggest specific improvements with code snippets.
Enter fullscreen mode Exit fullscreen mode

8. The Regex You'll Never Memorize

Write a regex that matches: [PATTERN].
Should match: [POSITIVE CASES]. Should NOT match: [NEGATIVE CASES].
Break down each part with comments. Include a test function.
Enter fullscreen mode Exit fullscreen mode

9. Shell Script That Actually Handles Errors

Write a bash/PowerShell script that [TASK].
Include: error handling for each step, colored output,
--help flag, dry-run mode, and logging to file.
Enter fullscreen mode Exit fullscreen mode

10. Docker Compose (Production-Ready, Not Tutorial-Ready)

Create a docker-compose.yml for [STACK].
Services: [LIST]. Include: health checks, env vars from .env,
named volumes, network config, resource limits, restart policies.
Add a README with setup and troubleshooting.
Enter fullscreen mode Exit fullscreen mode

These 10 are from a pack of 50 templates covering marketing, writing, data analysis, and translation too.

If you want all 50 (formatted, with expected output for each): \$4.99 →


What's your most-used AI prompt for coding? Drop it in the comments.

Top comments (0)