uncertainty-and-units – skill Marketing & SEO cho agent AI
Theo dõi đơn vị vật lý và lan truyền độ không đảm bảo đo trong tính toán khoa học bằng pint và uncertainties. Dùng để chuyển đổi đơn vị và kiểm tra thứ nguyên, ngân sách độ không đảm bảo GUM, đánh giá Type A và Type B, hệ số phủ và độ không đảm bảo mở rộng, lan truyền Monte Carlo, chữ số có nghĩa và plus-m
Cài skill uncertainty-and-units bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/uncertainty-and-units-8e464.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /uncertainty-and-units – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/uncertainty-and-units-8e464.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $uncertainty-and-units – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/uncertainty-and-units-8e464.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /uncertainty-and-units – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/uncertainty-and-units-8e464.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /uncertainty-and-units – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
Uncertainty and units
Scope
Use this skill whenever a calculation carries physical units or a reported number needs
an uncertainty. Concretely:
- converting between units, including conversions that need a physical context
(wavelength to photon energy, mass to amount of substance, energy to temperature);
- propagating uncertainty through a measurement model, with or without correlated inputs;
- building a GUM uncertainty budget from calibration certificates, specifications, and
repeatability data;
- choosing a coverage factor and deciding whether
k = 2is defensible; - rounding and writing a result so a reader knows what the
±means; - extracting parameter uncertainties from a curve fit without discarding correlations;
- reviewing existing analysis code for silent unit and uncertainty defects;
- checking that a dimensionally consistent answer is also physically possible — the
order of magnitude, the dimensionless group, and the regime it implies.
This skill covers the metrology and the two libraries that implement it. It does not
cover statistical inference, model selection, or study design — see statistical-analysis,
statistical-power, and experimental-design.
Current release and installation
Verified 2026-10-01:
- pint 0.26.1, released 2026-09-10; requires Python 3.12+.
- uncertainties 3.2.3, released 2025-04-21; requires Python 3.8+.
- NumPy 2.5.3 and SciPy 1.18.1; both require Python 3.12+.
scipy.constantsin SciPy 1.18.1 serves CODATA 2022. SciPy 1.11 and earlier
served CODATA 2018; the switch to CODATA 2022 occurred in SciPy 1.15.
uv venv --python 3.13
source .venv/bin/activate
uv pip install "pint==0.26.1" "uncertainties==3.2.3" "numpy==2.5.3" "scipy==1.18.1"pint-pandas and pint-xarray add unit-aware columns and arrays and are separate
installs.
Non-negotiable workflow
1. Attach units at input and strip them only at output. Convert at function
boundaries with ureg.wraps or m_as("unit"), never mid-calculation.
2. Write the measurement model explicitly before computing anything, including
corrections whose estimated value is zero. A correction left out of the model leaves
its uncertainty out of the budget.
3. Give every input four things: an estimate, a standard uncertainty, the
distribution the uncertainty came from, and its degrees of freedom.
4. Convert Type B statements with the right divisor. A certificate's expanded
uncertainty divides by its stated k; rectangular limits divide by sqrt(3).
5. Identify correlations before combining. A shared calibration, instrument correction, or fit can induce correlation;
quantify shared components instead of assuming every pair is correlated.
6. Compute sensitivity coefficients, and read the budget from c_i * u(x_i) rather
than from the raw uncertainties.
7. Check the linearization. Compare propagated distributions with the GUM interval when in doubt.
Establish Monte Carlo numerical stability before a JCGM 101 clause 8 claim;
neither method validates the measurement model or the assigned input PDFs.
8. Justify coverage. A Student-t factor from effective degrees of freedom
is an approximation requiring suitable distributional assumptions.
9. Round the uncertainty first, then the value to the same decimal place.
10. State what the ± is — standard or expanded, with k, the coverage probability,
and the method.
11. Sanity-check the magnitude before reporting. A dimensionally consistent result can
still be impossible. Compare it against a known scale or a dimensionless group, and
confirm every assumption you relied on still holds in that regime.
The failures this skill exists to prevent
Each of the following runs without error and produces a plausible number.
A unit stripped at an unknown scale
length = (12.7 * ureg.mm).magnitude # 12.7 -- of what?
length = (12.7 * ureg.mm).m_as("m") # 0.0127 metres, stated.magnitude returns whatever the quantity happened to be carrying. Name the unit at the
point of extraction, every time.
Offset temperature arithmetic
Q(20, "degC") + Q(5, "degC") # OffsetUnitCalculusError -- correctly refused
Q(20, "degC") + Q(5, "delta_degC") # 25 degree_Celsius
Q(25, "degC") - Q(20, "degC") # 5 delta_degree_CelsiusCelsius and Fahrenheit are interval scales. An uncertainty on a temperature is always a
difference and belongs in a delta_ unit: converting 20 ± 0.5 degC to Fahrenheit
gives 68 degF ± 0.9 delta_degF, two different conversions on one line.
Logarithmic units that add by multiplying
Q(10, "dBm") + Q(10, "dBm") # 0.0001 kilogram**2 * meter**4 / second**6That is 10 mW × 10 mW, not 20 mW and not 13 dBm. Nothing raises. Convert to a linear
unit before any arithmetic.
A correlation destroyed by a round trip
x = ufloat(1.0, 0.1)
x - x # 0.0+/-0
x - ufloat(x.nominal_value, x.std_dev) # 0.00+/-0.14Rebuilding a variable from its nominal value and standard deviation creates an
independent variable. So does any serialization that passes through a pair of floats.
Use correlated_values(values, covariance_matrix) to rebuild a correlated set.
A covariance matrix silently rescaled
popt, pcov = curve_fit(f, x, y, sigma=sigma) # default
popt, pcov = curve_fit(f, x, y, sigma=sigma, absolute_sigma=True)The default rescales pcov by the reduced chi-square. Relative weights from sigma still affect the fit and covariance: equality with an unweighted fit holds for constant sigma, not generally for heteroscedastic inputs. On
one synthetic straight-line fit the two give [0.0364, 0.2154] and [0.0477, 0.2820] —
a 31% difference. Pass absolute_sigma=True whenever sigma holds real standard
uncertainties.
A linearization that was never checked
For y = x² with x = 1.0 ± 0.5, the GUM framework gives y = 1.0, u_c = 1.0, and a
95% interval of [-0.96, 2.96] — mostly negative, for a squared quantity. Monte Carlo
gives a mean of 1.25, u_c = 1.06, and a shortest 95% interval of [0, 3.32]. Nothing
in a linear-propagation library will tell you this happened.
Bundled local CLIs
All helpers run offline, reject URLs and symlinks, bound their inputs, write output
atomically with private permissions, and refuse to overwrite without --force.
python skills/uncertainty-and-units/scripts/propagate_uncertainty.py --help
python skills/uncertainty-and-units/scripts/uncertainty_budget.py --help
python skills/uncertainty-and-units/scripts/format_result.py --help
python skills/uncertainty-and-units/scripts/convert_units.py --help
python skills/uncertainty-and-units/scripts/audit_units.py --help
python skills/uncertainty-and-units/scripts/check_plausibility.py --helppropagate_uncertainty.py
Runs both propagation methods on the same numerical model and compares interval
endpoints. This fixed-trial diagnostic does not implement the adaptive stabilization
in JCGM 101 7.9/8.2 and never labels the GUM result fully validated.
python skills/uncertainty-and-units/scripts/propagate_uncertainty.py \
--expression "m / (pi * (d / 2) ** 2 * h)" \
--variable "m=250.0,0.05" \
--variable "d=2.0,0.002,rectangular" \
--variable "h=4.0,0.005,rectangular" \
--measurand density --unit "g/cm3" --format markdownEach --variable is name=value,standard_uncertainty[,distribution[,dof]], where the
distribution is normal, rectangular, triangular, arcsine, or exact and controls
Monte Carlo sampling only. Here mass is in g and lengths in cm: --unit is
a report label, not dimensional validation or conversion. JSON variable units are
also labels; convert inputs to a consistent numerical model first. Correlations go in as --correlation "a,b=0.9". A JSON
--spec file holds the same model for anything long-lived.
The joint normal sampler supports positive semidefinite correlation matrices, including
perfect correlations. Other joint distributions need a separate sampler. Correlated
finite-dof inputs are refused because independent-input Welch-Satterthwaite is invalid.
For independent finite-dof inputs the CLI's MC PDFs remain fixed: dof affects the
GUM factor only, not MC sampling. A small-sample t input needs a separate justified model.
The expression is parsed into an abstract syntax tree and reduced by an explicit walk
over + - * / ** and a fixed list of functions. It is never compiled or executed.
The report gives the estimate, u_c, sensitivity coefficients, the budget in percent,
effective degrees of freedom, k, U, both Monte Carlo coverage intervals, and the
endpoint-agreement diagnostic. Repeat/increase sampling and verify model/PDF
assumptions before deciding what to report.
uncertainty_budget.py
Combines components stated
… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- referral-program – Khi người dùng muốn thiết kế, triển khai hoặc tối ưu chương trình giới thiệu hoặc tiếp…
- esl-price-sync – Đồng bộ giá bán lẻ giữa hệ thống ERP/POS và nhãn kệ điện tử (ESL) (SES-imagotag, ZKONG…
- etsy-shop-sales-history – Đọc bộ đếm doanh số shop Etsy, chênh lệch và cờ breakout từ Apify Actor…
- event-staffing-ordering – Đặt nhân sự sự kiện tạm thời tuân thủ W-2 cho hội nghị, triển lãm thương mại, lễ hội…
- revenue-operations – Phân tích sức khỏe pipeline bán hàng, độ chính xác dự báo doanh thu và các chỉ số hiệu…
- fal-platform – API nền tảng để quản lý mô hình, xem giá và theo dõi mức sử dụng
- sales-engineer – Phân tích phản hồi RFP/RFI để tìm lỗ hổng phạm vi, lập ma trận so sánh tính năng với đối…
- form-cro – Tối ưu hóa mọi biểu mẫu KHÔNG phải đăng ký hoặc tạo tài khoản, bao gồm biểu mẫu thu thập…