Prompt AI cho lập trình viên — Sao chép & dán

Prompt đã kiểm chứng cho những việc lập trình bạn làm hằng ngày — gỡ lỗi, review, viết test, refactor, SQL, commit message và tài liệu. Chỉ cần thiết lập ngôn ngữ và framework một lần, rồi sao chép.

Cập nhật
Giá trị của bạnMọi ví dụ bên dưới sẽ cập nhật khi bạn gõ

Hiểu code

3
Giải thích đoạn code này
Explain what this TypeScript code does, step by step. Then list:
1. Inputs and outputs
2. Side effects (network, files, state)
3. Edge cases it does not handle

```
[paste code]
```

Yêu cầu nêu side effect và các trường hợp biên bị bỏ sót sẽ biến một bản tóm tắt thành một bản review.

Tìm hiểu codebase lạ
I am new to this React project. Based on the file tree and the files below, explain the architecture: the main modules, how data flows from a request to the response, and where I should look to change [feature].

File tree:
[paste tree]

Key files:
[paste files]
Giải thích regex hoặc một dòng lệnh
Break this down token by token and give three example inputs that match and three that do not:

[paste regex or command]

Gỡ lỗi

4
Tìm lỗi
This TypeScript function should [expected behavior] but instead [actual behavior].

```
[paste code]
```

Find the root cause. Explain why it happens before proposing a fix, and show the smallest change that fixes it.

Mô tả kỳ vọng và thực tế là cách cải thiện prompt gỡ lỗi hiệu quả nhất.

Giải thích lỗi và stack trace
I get this error when [what you did]:

```
[paste error and stack trace]
```

Relevant code:
```
[paste code]
```

Explain what the error means, the most likely causes in order of probability, and how to confirm each one.
Tại sao đoạn này chậm?
This TypeScript code takes [time] for [input size]. Identify the bottlenecks, estimate their complexity, and suggest optimizations ordered by impact vs effort. Do not change behavior.

```
[paste code]
```
Trò chuyện như vịt cao su
I am stuck on [problem]. Do not give me the answer yet. Ask me one question at a time to help me find the cause myself.

Phù hợp khi bạn muốn tự hiểu vấn đề thay vì chỉ lấy bản sửa.

Viết code

5
Triển khai từ đặc tả
Write a TypeScript function that [does X].

Requirements:
- [requirement]
- [requirement]

Handle these edge cases: [empty input, invalid values, …]. Use no external libraries. Add brief comments only where the logic is not obvious, and include example usage.
Xây dựng component
Create a React component in TypeScript for [describe UI]. Props: [list]. It must be accessible (keyboard, ARIA where needed) and responsive. Keep styling minimal and separate from logic.
Viết câu truy vấn SQL
Write a PostgreSQL query that [goal].

Schema:
```sql
[paste CREATE TABLE statements]
```

Explain the query, mention which indexes it needs, and point out anything that could be slow on large tables.
Chuyển đổi giữa các ngôn ngữ
Convert this code from [source language] to TypeScript. Keep the same behavior, use idiomatic TypeScript rather than a line-by-line translation, and list any behavior that cannot be preserved exactly.

```
[paste code]
```
Viết shell script
Write a bash script that [goal]. It must: exit on errors (set -euo pipefail), print what it is doing, accept [arguments] with a --help message, and be safe to run twice.

Review & refactor

4
Review code
Review this code as a senior TypeScript engineer. Group findings by severity (bug, security, performance, readability). For each, quote the line, explain the problem and suggest a fix. Skip praise and nitpicks about formatting.

```
[paste diff or code]
```
Refactor an toàn
Refactor this code for readability and maintainability without changing its behavior or public API. Explain each change in one line. Point out anything you were unsure was behavior-preserving.

```
[paste code]
```
Review bảo mật
Audit this code for security issues: injection, XSS, auth and access control, secrets, unsafe deserialization, SSRF and input validation. For each finding give a concrete exploit scenario and a fix.

```
[paste code]
```
Đơn giản hóa
This works but feels too complicated. Show a simpler version with fewer branches and less state, and explain what made the original complex.

```
[paste code]
```

Test

3
Viết unit test
Write Vitest unit tests for this TypeScript code. Cover the happy path, edge cases and error handling. Use descriptive test names, no shared mutable state, and mock only external dependencies.

```
[paste code]
```
Tìm các test case còn thiếu
Here is a function and its tests. List the important cases the tests do not cover, then write tests for the three most valuable ones.

Code:
[paste code]

Tests:
[paste tests]
Tạo dữ liệu test
Generate [number] realistic test records as JSON for this schema. Include tricky values: unicode names, very long strings, empty optional fields, boundary numbers and dates around DST changes.

[paste schema or type]

Tài liệu & giao tiếp

5
Commit message từ diff
Write a conventional commit message for this diff: a subject line under 72 characters in the imperative mood, a blank line, then a short body explaining why the change was made.

```diff
[paste git diff --staged]
```

Lấy diff bằng git diff --staged.

Mô tả pull request
Write a pull request description for these changes with sections: Summary, Why, How it works, How to test, Risks. Keep it concise.

[paste diff or list of changes]
Viết tài liệu cho hàm
Add TypeScript doc comments (JSDoc/TSDoc, docstrings or equivalent) to this code: purpose, parameters, return value, errors thrown and one example. Do not change the code.

```
[paste code]
```
Viết phần README
Write the "Getting started" section of a README for this project: prerequisites, installation, configuration (environment variables), running locally and running tests. Use copy-pasteable commands.

Project details:
[paste package.json / notes]
Giải thích cho người không chuyên kỹ thuật
Explain this technical issue to a non-technical stakeholder in under 120 words: what happened, the impact on users, and what we are doing about it. No jargon.

[paste incident notes]

Lập kế hoạch & thiết kế

4
So sánh các cách tiếp cận
I need to [goal] in a React app. Compare [option A], [option B] and [option C] in a table: complexity, performance, maintenance, cost and when each is the best choice. Then recommend one for my situation: [context].
Thiết kế schema cơ sở dữ liệu
Design a PostgreSQL schema for [domain]. Entities: [list]. Show CREATE TABLE statements with keys, constraints and indexes, and explain how it supports these queries: [queries].
Chia tính năng thành các task
Break this feature into small tasks of at most half a day each, in a sensible order, with acceptance criteria for each:

[describe feature]
Review thiết kế API
Review this REST API design for consistency, naming, status codes, pagination, error format, versioning and security. Suggest concrete improvements.

[paste endpoints or OpenAPI spec]

Dữ liệu của bạn không bao giờ rời khỏi máy tính. Mọi xử lý diễn ra 100% cục bộ trong trình duyệt của bạn.

Công cụ này có hữu ích không?0.0 0 lượt đánh giá
Bảng lệnh Git tương tácGiải thích ngắn gọn các lệnh branch, commit, merge, rebase, stash, undo và lịch sử.Bảng lệnh Git →

Cách dùng Prompt AI cho lập trình viên

  1. Thiết lập ngôn ngữ, framework, công cụ test và cơ sở dữ liệu ở phía trên — mọi prompt sẽ tự cập nhật.
  2. Chọn prompt phù hợp với việc bạn cần: hiểu code, gỡ lỗi, viết mới, review, test, viết tài liệu hoặc lên kế hoạch.
  3. Nhấn Copy prompt, dán vào ChatGPT, Claude, Gemini hoặc Copilot Chat, rồi thay các phần [trong ngoặc vuông] bằng code hoặc thông tin của bạn.
  4. Hỏi tiếp trong cùng cuộc trò chuyện để tinh chỉnh câu trả lời.

Prompt lập trình tốt có những gì

  • Ngữ cảnh — ngôn ngữ, framework và phiên bản. “React 19 với TypeScript” cho câu trả lời tốt hơn nhiều so với chỉ “JavaScript”.
  • Kỳ vọng và thực tế — với lỗi, hãy nói rõ điều gì nên xảy ra và điều gì đang xảy ra.
  • Đoạn code nhỏ nhất liên quan — dán hàm và các nơi nó được gọi, đừng dán cả repository.
  • Ràng buộc — không thêm dependency mới, giữ nguyên public API, phải chạy được trên Node 20…
  • Định dạng đầu ra — diff, bảng, chỉ test, hoặc giải thích trước khi đưa code.

Kiểm tra trước khi đưa lên production

Trợ lý AI có thể viết code nghe hợp lý nhưng sai ở chi tiết: API bịa ra, bỏ sót trường hợp biên, cú pháp lỗi thời hoặc mẫu code không an toàn. Hãy chạy thử code, đọc kỹ như khi review pull request của đồng nghiệp, và yêu cầu trợ lý viết test cho chính đầu ra của nó. Tuyệt đối không dán secret, thông tin đăng nhập hay dữ liệu khách hàng.

Định dạng code trước khi dán bằng JSON formatter hoặc SQL formatter, và kiểm tra các biểu thức chính quy do AI tạo trong regex tester.

Cũng được tìm dưới tên: prompt chatgpt cho lập trình, prompt claude, prompt lập trình, prompt cho developer, prompt review code, prompt copilot, thư viện prompt ai.

Các công cụ dùng kèm tốt với Prompt AI cho lập trình viên

  • Bảng lệnh Git — Mọi lệnh Git bạn dùng hằng ngày, và cả những lệnh cần khi có sự cố, được giải thích trong một dòng.
  • Cheat sheet lệnh Linux — Các lệnh Linux và bash mà lập trình viên dùng trên máy chủ và laptop: tệp, tìm kiếm, phân quyền, tiến trình, log, mạng và SSH.
  • Bảng lệnh Docker — Các lệnh Docker và Docker Compose bạn dùng mỗi tuần, giải thích trong một dòng.
  • Bảng lệnh PowerShell — Các lệnh PowerShell mà lập trình viên và quản trị viên dùng hằng ngày trên Windows, và trong PowerShell 7 trên macOS và Linux, được giải thích ngắn gọn trong một dòng mỗi lệnh.

Câu hỏi thường gặp

Các prompt này có dùng được với ChatGPT, Claude, Gemini và Copilot không?
Có. Đây là các prompt viết bằng ngôn ngữ tự nhiên, hoạt động với mọi trợ lý AI đủ mạnh, bao gồm ChatGPT, Claude, Gemini và GitHub Copilot Chat.
Dán code vào trợ lý AI có an toàn không?
Hãy kiểm tra chính sách của công ty trước. Xóa secret, API key, dữ liệu khách hàng và URL nội bộ trước khi dán, và ưu tiên các gói business hoặc enterprise không dùng dữ liệu của bạn để huấn luyện.
Làm sao để có câu trả lời tốt hơn?
Cung cấp ngữ cảnh (ngôn ngữ, framework, phiên bản), nói rõ kỳ vọng so với thực tế, dán đoạn code nhỏ nhất thể hiện vấn đề, và yêu cầu giải thích lập luận trước khi đưa bản sửa. Hãy hỏi tiếp thay vì bắt đầu lại từ đầu.
Tôi có thể cài Prompt AI cho lập trình viên như một ứng dụng web và dùng khi không có mạng không?
Có. Prompt AI cho lập trình viên là một ứng dụng web (PWA) có thể cài đặt — cài trực tiếp từ trình duyệt, không cần tải từ cửa hàng ứng dụng. Trên Chrome hoặc Edge (Windows, macOS, Linux, ChromeOS) hoặc Android, bấm Cài đặt ứng dụng ở đầu trang này; trên iPhone và iPad, dùng Chia sẻ → Thêm vào Màn hình chính; trên Mac, dùng File → Add to Dock trong Safari 17 trở lên. Sau đó ứng dụng mở trong cửa sổ riêng với biểu tượng riêng, và vì chạy hoàn toàn trên trình duyệt nên vẫn hoạt động khi không có mạng. Firefox trên máy tính không thể cài ứng dụng web. Cách cài đặt hoạt động thế nào.

Công cụ liên quan