.agent/skills/prompt-improver/SKILL.md
Skill cai thien va toi uu hoa prompt cho AI Agent. Phan tich prompt hien tai, xac dinh van de, de xuat cai thien, cung cap templates. Su dung khi: (1) prompt khong ro rang, (2) AI hieu sai yeu cau, (3) can toi uu prompt phuc tap, (4) can tao prompt moi chat luong cao. Trigger: /prompt, improve prompt, fix prompt, optimize prompt, prompt khong hieu qua.
npx skillsauth add vuthuonghai-steve/KLTN-By_Thuong_Hai-Steve prompt-improverInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Skill tu dong phan tich va cai thien prompt de AI Agent hieu va thuc hien dung yeu cau.
[INPUT: Prompt can cai thien]
|
v
[PHASE 1: Phan Tich Prompt]
- Xac dinh cau truc hien tai
- Tim cac van de
- Danh gia muc do ro rang
|
v
[PHASE 2: Xac Dinh Van De]
- Problem Categories
- Severity Assessment
- Root Cause Analysis
|
v
[PHASE 3: De Xuat Cai Thien]
- Ap dung Prompt Framework
- Them context can thiet
- Cau truc lai noi dung
|
v
[PHASE 4: Tao Prompt Moi]
- Viet prompt cai thien
- Them examples neu can
- Validate voi checklist
|
v
[OUTPUT: Prompt toi uu]
Khi nhan prompt tu nguoi dung, phan tich theo cac yeu to:
| Yeu To | Cau Hoi | Ghi Chu | |--------|---------|---------| | Muc tieu | Nguoi dung muon gi? | Xac dinh outcome mong doi | | Context | Thong tin nen la gi? | Project, domain, constraints | | Doi tuong | AI nao se xu ly? | Claude, GPT, Gemini, etc. | | Do phuc tap | Don gian hay phuc tap? | 1 buoc vs nhieu buoc | | Output | Ket qua mong doi dang gi? | Code, text, analysis, etc. |
Kiem tra prompt co cac thanh phan:
[ ] Identity/Role - Vai tro cua AI
[ ] Context - Thong tin nen
[ ] Task - Nhiem vu cu the
[ ] Instructions - Huong dan thuc hien
[ ] Examples - Vi du input/output
[ ] Output Format - Dinh dang ket qua
[ ] Constraints - Rang buoc/gioi han
| Category | Mo Ta | Vi Du | |----------|-------|-------| | Ambiguity | Mo ho, khong ro rang | "Fix the bug" (bug nao?) | | Missing Context | Thieu thong tin nen | Khong biet project, tech stack | | Overload | Qua nhieu thong tin | 10 yeu cau trong 1 prompt | | No Structure | Khong co cau truc | Text lien tuc, khong phan chia | | Conflicting Requirements | Mau thuan | "Nhanh" + "Chi tiet" | | Implicit Assumptions | Gia dinh ngam | User biet nhung AI khong | | No Examples | Thieu vi du | AI khong biet output mong doi | | Wrong Scope | Sai pham vi | Qua rong hoac qua hep |
| Muc Do | Anh Huong | Hanh Dong | |--------|-----------|-----------| | Critical | AI khong hieu duoc | Can rewrite hoan toan | | Major | AI hieu sai 1 phan | Can sua doi nhieu | | Minor | AI hieu nhung chua toi uu | Tinh chinh nho | | Suggestion | Co the tot hon | Optional improvements |
Hoi cac cau hoi:
C - Capacity/Role: Vai tro AI (You are a senior developer...)
R - Request: Yeu cau cu the (Create a function that...)
I - Instructions: Huong dan chi tiet (Step 1... Step 2...)
S - Style: Phong cach output (Professional, concise...)
P - Persona: Doi tuong (Explain like I'm a beginner...)
E - Examples: Vi du input/output
Layer 1: Environment
- OS, platform, runtime
- Working directory
- Date/time neu can
Layer 2: Project
- Tech stack
- Architecture
- Conventions
Layer 3: Domain
- Business rules
- Terminology
- Constraints
Layer 4: Task-specific
- Files lien quan
- Previous context
- Related issues
| Ky Thuat | Ap Dung Khi | Vi Du | |----------|-------------|-------| | Specificity | Qua chung chung | "Fix bug" -> "Fix null pointer in auth.ts:42" | | Structure | Text lon, phuc tap | Chia thanh sections voi headers | | Examples | Output khong dung | Them input/output mau | | Constraints | Scope qua rong | Them "Chi thay doi file X" | | Step-by-step | Task phuc tap | Chia thanh cac buoc nho | | Negative Examples | Hay lam sai | Them "KHONG lam..." |
## Context
[Thong tin ve project, environment, background]
## Task
[Yeu cau cu the, ro rang]
## Requirements
- [Yeu cau 1]
- [Yeu cau 2]
- [Rang buoc]
## Expected Output
[Mo ta ket qua mong doi, format]
## Example (neu can)
Input: [vi du input]
Output: [vi du output]
## Role
You are [vai tro] with expertise in [chuyen mon].
## Context
### Environment
- Project: [ten project]
- Tech Stack: [technologies]
- Current State: [trang thai hien tai]
### Background
[Thong tin nen can thiet]
## Task
[Nhiem vu chinh]
## Instructions
1. [Buoc 1]
2. [Buoc 2]
3. [Buoc 3]
## Constraints
- DO: [Nen lam]
- DON'T: [Khong nen lam]
## Output Format
[Dinh dang ket qua]
## Examples
<example>
Input: [input mau]
Output: [output mau]
</example>
## Success Criteria
- [ ] [Tieu chi 1]
- [ ] [Tieu chi 2]
Truoc khi finalize prompt, kiem tra:
CLARITY (Ro rang)
[ ] Muc tieu duoc neu ro
[ ] Khong co tu mo ho (it, some, maybe)
[ ] Scope duoc gioi han
COMPLETENESS (Day du)
[ ] Co du context
[ ] Co instructions
[ ] Co output format
STRUCTURE (Cau truc)
[ ] Su dung headers/sections
[ ] Co bullet points cho lists
[ ] Logical flow
ACTIONABLE (Thuc hien duoc)
[ ] AI co tools can thiet
[ ] Khong yeu cau bat kha thi
[ ] Co the verify ket qua
EXAMPLES (Vi du)
[ ] Co examples neu task phuc tap
[ ] Examples representative
[ ] Edge cases duoc cover
Prompt goc:
Fix the authentication bug
Van de:
Prompt cai thien:
## Context
- Project: Agent-skill API (Next.js 15 + PayloadCMS)
- File: src/app/api/v1/auth/login/route.ts
## Problem
Login endpoint returns 500 error when user enters wrong password.
Expected: Return 401 with message "Sai mat khau"
Actual: Server crash with "Cannot read property 'id' of null"
## Task
Fix the authentication bug so that wrong password returns proper 401 error.
## Constraints
- DO NOT change the response format
- Keep existing validation logic
- Use `errorResponse` helper from @/lib/api-response
## Success Criteria
- [ ] Wrong password returns 401
- [ ] Correct password still works
- [ ] No server crash
Prompt goc:
I need you to create a new product page with a gallery, reviews section,
add to cart button, related products, and make sure it's responsive and
has good SEO and loads fast and follows our design system and handles
errors properly and has loading states
Van de:
Prompt cai thien:
## Context
- Project: Agent-skill Frontend (Next.js 15 + React 19)
- Design System: @Agent-skill-web/src/components/ui/
- Location: Create at src/screens/product/ProductDetailScreen.tsx
## Task
Create Product Detail Page with the following sections:
## Requirements (Priority Order)
### P0 - Must Have
1. **Product Gallery** - Image carousel with zoom
2. **Product Info** - Name, price, description
3. **Add to Cart** - Button with quantity selector
4. **Responsive** - Mobile-first design
### P1 - Should Have
5. **Reviews Section** - List of reviews with ratings
6. **Related Products** - Grid of 4 similar products
7. **Loading States** - Skeleton components
### P2 - Nice to Have
8. **SEO Optimization** - Meta tags, structured data
9. **Error Boundaries** - Graceful error handling
## Technical Constraints
- Use existing UI components from src/components/ui/
- Follow screen pattern: business logic in Screen, thin wrapper in app/
- Use SWR for data fetching
## Output
- ProductDetailScreen.tsx with all P0 requirements
- List of follow-up tasks for P1, P2
| Van De | Fix | |--------|-----| | "AI lam qua nhieu" | Them constraint: "CHI lam X" | | "AI bo sot" | Them checklist: "Dam bao cover: A, B, C" | | "Output sai format" | Them template: "Tra ve theo format sau: ..." | | "AI hoi lai qua nhieu" | Them: "Gia dinh X neu khong chac chan" | | "Qua chung chung" | Them specific: files, line numbers, names |
<context>...</context> <!-- Thong tin nen -->
<task>...</task> <!-- Nhiem vu chinh -->
<constraints>...</constraints> <!-- Rang buoc -->
<example>...</example> <!-- Vi du -->
<output>...</output> <!-- Dinh dang output -->
Skill nay duoc kich hoat khi nguoi dung:
tools
Automates end-to-end drawing of UI screens in Pencil canvas from module spec files. Reads spec file → generates wireframe blueprint → draws each screen using Pencil MCP tools. Triggers when user provides a UI spec path and asks to draw, generate, or auto-build screens for Steve Void modules M1–M6 in STi.pen.
testing
Extracts UI Screen Specs by analyzing Schema and Diagrams. Use when you need to bridge database logic and flow diagrams into intermediate UI component specifications for a given module. Trigger when user says "analyze UI for module X", "generate ui spec", "phân tích UI module", or invokes "ui-architecture-analyst --module M[X]".
development
Giải thích lỗi TypeScript một cách dễ hiểu bằng tiếng Việt. Sử dụng khi gặp lỗi type, generic, inference, hoặc bất kỳ lỗi TS nào cần được giải thích rõ ràng.
development
Skill phan tach yeu cau/tinh nang thanh cac phase, task va subtask cu the. Tao bo tai lieu planning clean, khong chua code mau, tap trung mo ta logic va nghiep vu. Su dung khi: (1) nhan yeu cau tinh nang moi can lap ke hoach, (2) co tai lieu nghien cuu can chuyen thanh task plan, (3) nguoi dung yeu cau phan tach cong viec, (4) can tao roadmap trien khai cho du an/tinh nang. Trigger: /task-planner, /plan-tasks, "phan tach task", "lap ke hoach", "tao plan", "chia phase".