$npx -y skills add anhtester/codex-testing-kit --skill fetch-jira-requirementsLấy Requirements / User Stories từ Jira ticket và lưu thành file markdown hoặc JSON.
| 1 | # Workflow: Fetch Jira Requirements |
| 2 | |
| 3 | > **BẮT BUỘC (MANDATORY SKILL):** Bạn PHẢI nạp và đọc kỹ nội dung của skill **`$jira-integration`** (tại `.agents/skills/jira-integration/SKILL.md`) để biết cách sử dụng scripts trước khi bắt đầu. |
| 4 | |
| 5 | Workflow này giúp lấy requirements, user stories, hoặc issues từ Jira và chuyển thành tài liệu phục vụ test automation. |
| 6 | |
| 7 | ## Các bước thực hiện: |
| 8 | |
| 9 | 1. **Kiểm tra prerequisites:** |
| 10 | - Đọc skill `$jira-integration` để nắm cấu trúc scripts. |
| 11 | - Kiểm tra file `.env` đã tồn tại và được cấu hình đúng. |
| 12 | - Kiểm tra dependencies đã được cài đặt (`scripts/integrations/node_modules/`). |
| 13 | - Nếu chưa cài, chạy: `cd scripts/integrations && npm install` |
| 14 | |
| 15 | 2. **Xác định thông tin cần lấy:** |
| 16 | - Hỏi user cung cấp thông tin: |
| 17 | - **Issue key** cụ thể (VD: `PROJ-123`) → dùng `--issue` |
| 18 | - **Project key + Issue type** (VD: `PROJ`, `Story`) → dùng `--project --type` |
| 19 | - **JQL query** tùy chỉnh → dùng `--jql` |
| 20 | - **Epic key** (lấy children) → dùng `--epic` |
| 21 | - Xác định format output: `json` (default) hoặc `md` (markdown requirement) |
| 22 | |
| 23 | 3. **Thực thi script:** |
| 24 | - Chạy lệnh phù hợp: |
| 25 | ```bash |
| 26 | # Lấy 1 issue cụ thể |
| 27 | node scripts/integrations/jira/jira_fetcher.js --issue <ISSUE_KEY> |
| 28 | |
| 29 | # Lấy issues theo project |
| 30 | node scripts/integrations/jira/jira_fetcher.js --project <PROJECT_KEY> --type <TYPE> --max <N> |
| 31 | |
| 32 | # Tìm theo JQL |
| 33 | node scripts/integrations/jira/jira_fetcher.js --jql "<JQL_QUERY>" |
| 34 | |
| 35 | # Xuất Markdown |
| 36 | node scripts/integrations/jira/jira_fetcher.js --issue <KEY> --format md --output ./requirements/jira |
| 37 | ``` |
| 38 | |
| 39 | 4. **Xử lý kết quả:** |
| 40 | - Kiểm tra output file được tạo trong `requirements/jira/` (hoặc `--output` chỉ định). |
| 41 | - Nếu format `json`: Đọc và hiển thị tóm tắt issues cho user. |
| 42 | - Nếu format `md`: Hiển thị nội dung markdown requirement cho user review. |
| 43 | - Nếu gặp lỗi: Đọc log, phân tích nguyên nhân theo bảng Troubleshooting trong skill. |
| 44 | |
| 45 | 5. **Xử lý lỗi thường gặp:** |
| 46 | - **HTTP 401**: Token sai → hướng dẫn user kiểm tra `JIRA_API_TOKEN` hoặc `JIRA_PAT` |
| 47 | - **HTTP 404**: Issue không tồn tại hoặc `JIRA_BASE_URL` sai |
| 48 | - **File .env not found**: Hướng dẫn user copy `.env.example` → `.env` |
| 49 | - **Module not found**: Chạy `npm install` trong `scripts/integrations/` |
| 50 | |
| 51 | 6. **Delivery:** |
| 52 | - Trình bày kết quả bằng Tiếng Việt. |
| 53 | - Nếu user yêu cầu chuyển thành requirement document, sử dụng skill `$requirements-analyzer` để format lại. |
| 54 | - Lưu file output vào thư mục phù hợp (`requirements/jira/`). |