Hardening
Skill này làm gì
Làm sắc hơn các bài test phần mềm bằng cách kiểm tra quy tắc tổng quát đằng sau các test ví dụ trên nhiều đầu vào được sinh ra. Skill dành cho nhà phát triển muốn tìm lỗi mà các ví dụ đã bỏ sót.
Khi nào nên dùng
- ✓Khi các test của bạn đều đạt nhưng bạn nghi ngờ chúng bỏ sót trường hợp biên.
- ✓Khi bạn muốn kiểm tra một quy tắc của hàm trên nhiều đầu vào ngẫu nhiên.
- ✓Khi một trường hợp lỗi cần được thu gọn thành ví dụ nhỏ nhất vẫn gây lỗi.
Liên kết skill
https://github.com/danielmiessler/LifeOS/blob/main/LifeOS/install/skills/Hardening/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Các test phân tích ngày của chúng tôi đều đạt, nhưng tôi nghĩ chúng bỏ sót trường hợp biên. Bạn có thể làm chúng chắc hơn bằng property test không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill nêu rõ khẳng định tổng quát đằng sau các test ví dụ của bạn và chạy nó trên nhiều đầu vào được sinh ra. Nếu có lỗi, skill thu gọn nó thành đầu vào nhỏ nhất vẫn gây lỗi, rồi sửa lỗi hoặc chính property.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Hardening Skill
Hardening sharpens tests that already exist without adding new functionality: it turns the universal claim behind a set of example tests into a fast-check property, runs it across generated inputs, and shrinks any failure to the minimal counterexample.
One intent ships. Mutation testing, complexity scoring, duplication scanning, and acceptance-test mutation were once listed here as planned; none is built, and this file no longer advertises them (external review of the v7.40.4 payload, 2026-09-03: a routing table that promises unbuilt intents is the "confidently documented, never existed" class).
Ideal State
- Every property written states the universal claim behind existing example tests, runs across generated inputs drawn from the function's real input domain, and keeps the examples it sharpens.
- Every failure ends shrunk to a minimal counterexample with its seed, and ends in either a fixed bug or a corrected property.
- What hardening lands is recorded where the system reads it: a
bun-propertyrow in the ISA's Test Strategy, and a C/R/L Learning entry when a counterexample taught something. - Functions that cannot carry a universal claim (impure, or no candidate shape) are left to example tests rather than forced into a property.
Intent Routing
| Intent | Trigger | File |
|---|---|---|
| PropertyTest | property test, property based testing, PBT, fast-check, universal quantified claim, shrink counterexample — pure functions, parsers, serializers, data transforms, invariants | Intents/PropertyTest.md |
Integration Points
- Testing Doctrine Rule #12 — names fast-check as the property-testing primitive (
LIFEOS/DOCUMENTATION/Testing/TestingDoctrine.md). - ISA format — the
bun-propertyISC type withproperty | generator | runscolumns (LIFEOS/DOCUMENTATION/ISA/ISAFormat.md§ ISC Type Vocabulary). Abun-propertyrow is a first-class assert: it counts toward every-ISC-an-assert coverage (H8) andbunker testruns it like any deterministic row. - Algorithm — hardening is elected during verification when a run's criteria warrant property depth; spend is discovered from the work.
- System prompt — Verification Is the Mechanism section at top (
LIFEOS/LIFEOS_SYSTEM_PROMPT.md).The Bunker CLI is maintainer-private and not in the public release; run code rows with
bun test ./<path>and suite rows withbun skills/Assay/Tools/EvalRunner.ts.
Gotchas
No skill-wide gotchas; the fast-check ones live in Intents/PropertyTest.md § Gotchas.
Examples
- "Property-test the slug parser" → PropertyTest → round-trip and idempotence properties in a
.property.test.tsfile at 1000 runs, abun-propertyrow in the ISA, and any failure shrunk with its seed pinned. - "What bugs are my example tests missing?" → PropertyTest → the pure functions (parsers, serializers, transforms) that have only example coverage, listed as property-test candidates.
Câu hỏi thường gặp
Nó có thay thế test ví dụ của tôi không?
Không. Nó giữ các ví dụ đã được làm chắc và thêm property test bên cạnh.
Những hàm nào có thể test theo cách này?
Các hàm có quy tắc tổng quát rõ ràng. Hàm không thuần túy hoặc không có cấu trúc đầu vào rõ ràng vẫn để cho test ví dụ.
Nó dùng công cụ nào?
Nó dùng fast-check, một thư viện property-based testing.
Chi tiết
Mô tả gốc của tác giả
Hardens LifeOS tests via property-based testing with fast-check. USE WHEN harden, hardening, property test, property based testing, PBT, fast-check, strengthen tests, find bugs example tests miss, universal quantified claim, shrink counterexample, what bugs am I missing, test the tests. NOT FOR new feature tests (bun test directly), grading agent output (Assay), UI verification (Interceptor), finding security vulnerabilities, or building new functionality.
repo: danielmiessler/LifeOS
Độ phổ biến
- Sao GitHub
- 20k
- Vị trí xếp hạng
- #10430
- Giấy phép
- MIT
- Cập nhật
- 28/10/2026
Bình luận
- …
Thêm skill từ kho mã này
LifeOS
20kGiúp agent của bạn thiết lập LifeOS, một hệ thống cá nhân ánh xạ trạng thái hiện tại tới trạng thái lý tưởng qua một cuộc phỏng vấn và một bảng điều khiển.
AnnualReports
20kGiúp agent của bạn tìm và so sánh báo cáo an ninh mạng thường niên từ các nhà cung cấp lớn, như xu hướng vi phạm và ransomware, có nguồn cho mọi số liệu.
ApertureOscillation
20kDạy agent của bạn kiểm tra một câu hỏi thiết kế ở phạm vi hẹp và phạm vi rộng, rồi chỉ ra chỗ hai câu trả lời mâu thuẫn trước khi bạn xây dựng.
Aphorisms
20kCho phép agent của bạn tìm, ghép và theo dõi các câu trích dẫn có ghi tác giả từ một bộ sưu tập được chọn lọc, tránh những câu vừa được dùng trong bản tin.
Skill tương tự
test-driven-development
311kDạy agent của bạn viết kiểm thử thất bại trước, xem nó thất bại, rồi viết đoạn mã ngắn nhất để vượt qua trước khi làm bất kỳ tính năng hay bản sửa nào.
verification-before-completion
311kDạy agent của bạn chạy kiểm tra thực tế và đọc kết quả đầu ra trước khi khẳng định một việc, bản sửa hoặc bản build đã hoàn thành hay vượt qua.
migrate-to-shoehorn
310kThay các ép kiểu rủi ro trong tệp kiểm thử bằng thư viện shoehorn, để các bài kiểm thử dùng dữ liệu một phần vẫn qua được kiểm tra kiểu.