warren-githut/personal-os-automation/lusine-sql-pipeline-discipline
Claude Code and agent skill by warren-githut/personal-os-automation
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Discipline cho mọi parser/script/cron query IKKO SQL (iikoAPI) trong L'Usine vault — firewall read-only, công thức chuẩn, month constraint, post-build review. Trigger: viết/ sửa SQL parser, revenue pipeline, best-seller query.
Install
npx vskill@latest install warren-githut/personal-os-automation/lusine-sql-pipeline-disciplineSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as warren-githut/personal-os-automation/lusine-sql-pipeline-discipline.
L'Usine SQL Pipeline Discipline
Lessons từ session 2026-07-24 (build revenue_sql_parser.py + weekly-revenue-sql). Áp dụng cho MỌI code query IKKO SQL.
🔴 HARD RULE 1: SQL Firewall (CRITICAL)
Mọi parser/script query SQL PHẢI qua `sqlclient.run_query()` — KHÔNG connect thẳng `pyodbc.connect()`.
vault/.scripts/sqlserver_client/sqlclient.pycó firewallis_readonly()chặn INSERT/UPDATE/DELETE.- Connect thẳng pyodbc = bypass firewall = violation ANCHORS read-only.
- Code-review MUST check: nếu file mở
pyodbc.connect()trực tiếp → flag CRITICAL, fix = lazy-loadsqlclientmodule, gọirun_query().
Bug thực tế (2026-07-24): revenue_sql_parser.py có _run_sql() tự mở pyodbc → review bắt C1. Fix:
🔢 HARD RULE 2: CÔNG THỨC CHUẨN (dùng MỌI khi query)
- Net Revenue =
SUM(AmountWithDiscount) × 0.882(trừ ~11.8% voucher/system fee) - Covers =
SUM(GuestCount) WHERE OrderType != 'Split Order'(loại bill chia bàn) - Tickets =
COUNT(*)(tổng hóa đơn) - Store filter:
DepartmentCode IN ('LSLTT','LU5','LU7') AND OrderDeleted='NOT_DELETED' AND Storned='FALSE' - Khớp OCR PowerBI 99.7% (verified W29 2026-07-24)
🟡 HARD RULE 3: Month Constraint
Target Achv / monthly budget CHỈ tính tháng 5-12. File Budget_vs_Actual.md CHỈ có cột May-Dec.
- Bug đã fix:
month_idx = m - 5không guard → tháng 1-4 lấy sai cell (âm index). - Fix:
if m < 5: return {}→ tháng 1-4 trả—(không lỗi, không crash).
🧹 HARD RULE 4: Post-Build Review (Warren explicit)
Sau MỌI build feature/parser/script → CHẠY:
code-review-and-quality(5-axis: correctness, readability, architecture, security, performance)improve-codebase-architecture(deep module check, YAGNI)code-simplification(dedup, remove dead code)
Warren: "dùng code review và improve-codebase-architecture và code simplification (sub) từng task/slice".
Verify behavior không đổi sau simplify: chạy --dry so sánh số với bản cũ (W29 reference: ALL=683.7M, Covers=2,590, Target Achv 82/77/87/83%).
🔄 HARD RULE 5: Resume Rule (Warren 2026-07-24)
"tiếp tục nào" / "tiếp tục" sau API retry/interrupt = RESUME trực tiếp.
- KHÔNG re-explain context, KHÔNG hỏi lại "Bố muốn làm gì?".
- Đọc lại file đích, tiếp tục bước dở dang. Autonomous continuation expected.
Pitfalls
- VPN required: SQL chỉ accessible qua DrayTek TLG VPN (10.28.15.63:9433)
- `.env` MSSQL_DATABASE=iikoAPI — file từng trống, gây connect sai DB (master)
- stdout rebind: SQL parser import OCR parser → save/restore
sys.stdouttrước/sau import - Dry run first: Always
--drytrước live run - 🔴 HARDCODED WEEK TRAP (2026-07-27): Script regen mà hardcode
WEEKS=[W26,W27,W28,W29]→ cron chạy mỗi tuần → regen y nguyên tuần cũ mãi, KHÔNG lấy W mới → automation vô nghĩa. Phát hiện thực tế:_regen_all_hourly.pyhardcode W26-W29, HANDOFF ghi "script KHÔNG đổi" nhưng thực tế PHẢI đổi thành dynamic. → FIX: tính 4 tuần gần nhất ĐỘNG từdatetime.date.today()(xemcron-job-ops§12.5 cho codecompute_last_4_weeks). Test:compute_last_4_weeks(date(2026,7,27))→[W30,W29,W28,W27].
Verification
- [ ] Query qua
sqlclient.run_query()(không pyodbc trực tiếp) - [ ] Công thức ×0.882 + filter Split Order
- [ ] Month < 5 → return {} (không crash)
- [ ] Code-review + simplify đã chạy, behavior không đổi
- [ ] VPN + .env checked
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingpersonal_vault/_skills/data-science/lusine-sql-pipeline-discipline/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/warren-githut/personal-os-automation/lusine-sql-pipeline-discipline)