Files
solution-erp/.claude/skills
pqhuy1987 92d8215a62 [CLAUDE] PurchaseEvaluation: YC-028 sự cố prod A/059 — FE tách "404 thật ⟂ lỗi hệ thống" 5 site ×2 app + guard disk/orphan vào runbook+cicd-monitor
Sự cố 2 tầng (đã giải trọn trong phiên, chi tiết runs/2026-08-10-S189-bookstart-open/run.md + WAL):
- T1: ổ C VPS 0 byte (gitea repo-archive 16,49GB + npm-cache SYSTEM 12,76GB) → SQL Error -2
  → "ko duyệt được" rồi FE vẽ mọi lỗi thành "Không tìm thấy phiếu" (#44). Dọn ~30GB cache
  + AUTO_CLOSE OFF ×3 DB + gỡ nén NTFS 4 file template (#88 tái phát).
- T2: 3 sshd mồ côi (lệnh đo ssh bị cắt output) bão hòa 3/3 core → mọi GET detail 5-47s,
  A/059 (5 NCC) vượt trần hủy ~30s của FE. Kill orphan → A/059 47s→0,38s · phiếu bé 0,17s.

Code (5 site cùng lớp, SHA-mirror 4 cặp MATCH, build ×2 xanh):
- lib/apiError.ts +isNotFound(err) — chỉ 404 mới được nói "không tìm thấy"
- PurchaseEvaluationsListPage (inline + overlay + fullpage) + KhkkListPage + KhkkCreatePage:
  detail.isError && !404 → "Hệ thống đang chậm hoặc lỗi khi tải phiếu — thử lại (refetch)"

Ops-guard (YC-028 (4)): cicd-monitor persona +bước 1b server-health (fsutil free <5GB = FAIL,
CPU-delta tìm orphan) · iis-deploy-runbook +§"Disk-free + orphan guard" + sửa path log Serilog
sai (Logs\log-*.txt → logs\solution-erp-*.log, đo thật). (6) đóng: log 10/08 mất do đợt "giải
phóng dung lượng" hôm qua (retention 30 file config đúng). (3B) cron archive_cleanup Gitea +
decompress Vietreport_Master = chờ ngoài giờ (restart service dùng chung VIETREPORT).

Sổ: +YC-028 (nguyên văn + 2 tầng đã xử). Squash wal: trailing theo §5.0.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-11 11:25:51 +07:00
..

Skill Library — SOLUTION_ERP

Skill này là tài liệu chuyên biệt để Claude (và developer khác) dùng khi cần deep-dive 1 domain area. Claude tự động invoke qua Skill tool dựa trên semantic matching với description trong từng SKILL.md.

Skills hiện có

Domain skills (logic nghiệp vụ)

Skill Mục đích Trigger ví dụ Trạng thái
contract-workflow State machine 9 phase + versioned workflow per ContractType + role × phase guard + SLA + auto-gen mã HĐ RG-001 "approve contract", "chuyển phase", "versioned workflow", "HĐ cũ giữ cũ" Tier 3 + Phase 6 cross-ref PE workflow
form-engine Render template docx/xlsx + FieldSpec JSON + DynamicForm + PDF export LibreOffice "export contract as word", "điền form", "render template", "PDF export" Active
permission-matrix Role × MenuKey × CRUD + seed + 3-layer resolution + inherit Contracts/Workflows/PurchaseEvaluations "permission denied", "gán role", "menu không hiện", "inherit permission" Active (Phase 6 +Pe_/PeWf_)

Ops/infra skills (devops + security + schema)

Skill Mục đích Trigger ví dụ Trạng thái
dependency-audit-erp Scan CVE NuGet + npm 2 FE, respect pin constraint (MediatR 12.4.1, Swashbuckle 6.9.0) "npm audit", "dotnet vulnerable", "deps scan", "nâng cấp package" New Tier 3
ef-core-migration Tạo/revert EF Core 10 migration, 3-file rule, DesignTimeDbContextFactory, migration history (mới nhất → row cuối bảng skill; số → docs/STATUS.md) "thêm migration", "EF migration", "schema update", "snapshot lỗi" Updated S168 (ff7f655) · nội-dung tới row Mig cuối hiện hành — soát @S172; số bảng + số Mig → docs/STATUS.md (B1, KHÔNG neo số ở ô này)
iis-deploy-runbook 3 IIS site + win-acme cert + gitea-runner + LibreOffice + debug 500/502/SignalR prod + G-084 IPv4/IPv6 hardening "prod 500", "IIS fail", "cert hết hạn", "restart app pool", "deploy IIS", "port hijack" Updated (G-084)

Format chuẩn 1 skill

Mỗi skill là 1 folder với ít nhất SKILL.md + optional examples/ + references/:

.claude/skills/<skill-name>/
├── SKILL.md                  ← Entry point: description, when-to-use, workflow
├── examples/                 ← Code snippets mẫu (optional)
│   └── *.cs | *.tsx
└── references/               ← Link đến file code thật, docs (optional)

Frontmatter SKILL.md (BẮT BUỘC when-to-use để skill auto-trigger):

---
name: skill-name-kebab-case
description: 1-3 câu mô tả skill làm gì + stack specificity (để embedding match chính xác)
when-to-use:
  - "trigger phrase 1"
  - "trigger phrase 2"
  - "keyword tiếng Việt"
---

# Skill Name

## Context
...

## Workflow / Commands
...

## Pitfalls
...

## Code pointers
- `path/to/file.cs`

Tạo skill mới — checklist

  1. Tạo folder .claude/skills/<kebab-case-name>/
  2. Viết SKILL.md với frontmatter + sections: Context / Workflow / Code pointers / Common pitfalls
  3. Add row vào bảng "Skills hiện có" phía trên
  4. Update docs/CLAUDE.md (dòng skill count)
  5. Commit [CLAUDE] Skill: add <name>

Nguyên tắc design skill

PROJECT-SPECIFIC, không clone generic:

  • Skill user-level global đã có sẵn (code-reviewer, sql-database-assistant, focused-fix, ...)
  • Skill project-level phải encode kiến thức SOLUTION_ERP-only mà generic không có:
    • Commit convention [CLAUDE] <scope>: ...
    • Path pattern src/Backend/SolutionErp.*/...
    • Pin constraint (MediatR 12.4.1, Swashbuckle 6.9.0, TypeScript 6 erasableSyntaxOnly)
    • Gotcha-referenced (dẫn chiếu docs/gotchas.md#N)
    • Workflow Vietnamese-first

Keep it actionable:

  • Commands copy-pastable (không pseudocode)
  • Paths đầy đủ (không src/...)
  • Version pinned (không "latest")
  • Dẫn chiếu gotcha/migration # cụ thể
  • docs/CLAUDE.md — quick rules + full stack context
  • docs/gotchas.md — bẫy đã gặp (số + các mục mới nhất → docs/STATUS.md — B1, KHÔNG chép digest ở đây: bản sao thối im lặng, gỡ @S172 sau khi đo lệch 7 mục)
  • docs/changelog/migration-todos.md — roadmap 5 phase + Tier 3