本文へ移動
cccskills
無料GitHub で公開

numerical-stability-auditor

当一个模拟跑出了结果、要判断它是物理还是数值假象时使用。查三件事:守恒量的漂移曲线、步长收敛阶、功率谱里可疑的高频内容。守恒量在哪一步开始漂,就指向哪个物理过程被离散化破坏。

结果随步长改变时,必须先做收敛性检查再解释现象。

インストール方法を見る

含まれるファイル(3)

  • SKILL.md9.2 KB
  • references/input-schema.md3.6 KB
  • scripts/audit_stability.py19.0 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Numerical Stability Auditor

Judge numerical credibility before explaining simulated behavior. Separate evidence of discretization failure from evidence about the modeled physics.

Boundaries

This skill audits numerical outputs; it does not prove that the governing equations, parameters, boundary conditions, or implementation represent reality. It does not replace method-specific stability theory, code review, experimental validation, or an exact solution when one exists.

Do not label every oscillation a numerical artifact. A suspicious feature remains a hypothesis until a refinement or method-change test distinguishes it from physical dynamics.

Inputs

Ask only for missing information that changes the audit:

  • governing quantity or invariant expected to be conserved, if any;
  • integrator/discretization and nominal order, when known;
  • timestep or mesh scale for at least three otherwise comparable runs;
  • identical initial/boundary conditions and comparison time or observable;
  • trajectory columns for time, invariant, and a representative signal;
  • known forcing, damping, discontinuities, events, or adaptive-step behavior;
  • acceptance tolerance or downstream decision, if one exists.

If only one run exists, perform a limited diagnostic and explicitly request refinement runs. Never infer convergence order from one or two resolutions.

Workflow

1. Establish the comparison contract

Write down what must stay fixed across runs: equations, parameters, initial and boundary conditions, solver family, stopping criterion, output sampling, random seed or ensemble definition, and comparison time. Note intentional differences.

Choose diagnostics that match the physics:

  • conservative system: relative energy, momentum, charge, mass, or norm drift;
  • dissipative system: deviation from the expected balance law, not “conservation”;
  • constrained system: constraint residual;
  • forced system: input-output balance;
  • chaotic or stochastic system: distributional or ensemble observables rather than long-horizon pointwise agreement.

2. Locate invariant or balance-law failure

For each run, report:

  • endpoint signed drift;
  • maximum absolute drift;
  • drift trend (bounded oscillation, monotone, episodic jump, or unresolved);
  • first time the tolerance is crossed;
  • the physical stage or numerical event at that time.

Normalize only by a physically meaningful scale. If the initial invariant is zero or near zero, use a declared reference scale and report absolute drift too.

A drift curve is also a process diagnostic: align the onset of drift with collisions, switching, contact, remeshing, boundary interaction, stiffness, or event handling. Do not hide cancellation by reporting endpoint drift alone.

3. Test refinement convergence

Use at least three step sizes or mesh scales with a common refinement ratio when practical. Compare the same scalar observable, norm, event time, or error against an exact/reference solution.

If errors e(h) are available, estimate observed order

p = log(e_coarse / e_fine) / log(h_coarse / h_fine).

If no exact solution exists, use successive-solution differences and state that the result is self-convergence, not accuracy proof. Interpolate onto common times or locations before comparison; do not compare mismatched samples as if aligned.

Pair each difference with the coarser step of the two runs it compares: three runs h1 > h2 > h3 give d1 = |u(h1) − u(h2)| on the row of h1 and d2 = |u(h2) − u(h3)| on the row of h2. Keep one refinement ratio r = h1/h2 = h2/h3; then d1/d2 = r^p and p = log(d1/d2) / log(r). With unequal ratios the pairwise orders are biased. Three runs give only two differences, hence one order estimate: the helper accepts them with a warning, and a fourth run is what shows whether the order is stable.

Classify the outcome:

  • convergent: error decreases consistently and observed order is plausible;
  • pre-asymptotic: error decreases but order is unstable;
  • stalled: refinement no longer improves the result;
  • divergent/unstable: error grows, values become non-finite, or constraints fail;
  • inconclusive: too few runs or comparison contract is broken.

Do not demand textbook order across discontinuities, limiters, event times, chaotic divergence, or mixed temporal/spatial error. Explain the expected order reduction.

4. Hunt discretization ghost frequencies

For uniformly sampled signals, remove the mean (and preferably trend), inspect the spectrum, and compare refined runs. Flag, but do not automatically condemn:

  • a peak that moves in proportion to the Nyquist frequency as timestep changes;
  • large power concentrated near Nyquist;
  • odd-even or checkerboard modes;
  • a frequency absent after method, timestep, or mesh refinement;
  • new high-frequency power appearing when invariant drift begins.

A physical peak should normally remain at a stable physical frequency under refinement. Account for forcing frequencies, natural modes, aliasing, output downsampling, and nonuniform sampling. Use Lomb–Scargle or resampling for nonuniform data rather than a plain FFT.

5. Cross-check causality

For each suspicious feature, propose the cheapest discriminating test:

  1. halve timestep or mesh spacing;
  2. change solver/order while holding the model fixed;
  3. tighten nonlinear/linear solver tolerances;
  4. increase output sampling without changing integration;
  5. isolate the stage where drift starts;
  6. compare against an exact benchmark or manufactured solution.

State what outcome would support “physical” versus “numerical.”

6. Issue a verdict

Use one of:

  • credible within tested range;
  • credible only for specified observables/timescales;
  • numerically suspect;
  • not auditable with supplied evidence.

Never say “stable” without naming the diagnostic, tested range, and tolerance.

Deterministic helper

Use scripts/audit_stability.py for CSV-based invariant drift, uniform-sampling spectral indicators, and convergence estimates from three or more error rows, or from the two successive differences of three runs (accepted with a warning). Uniform sampling is judged against the printed precision of the time column, so times rounded to 4 decimals still get the spectral check. The script uses only the Python standard library; --selftest runs its regression cases.

Read references/input-schema.md before invoking it. Treat its output as measurements, not a verdict: thresholds are user-supplied or context-dependent, and spectral flags require refinement evidence. Report every entry of the convergence warnings list in Limitations.

Output format

Return:

  1. Verdict and scope — one sentence with tested range.
  2. Comparison contract — fixed and changed fields.
  3. Evidence table — invariant/balance drift, convergence, spectral signs.
  4. Failure onset — time/stage where credibility first degrades.
  5. Physical vs numerical hypotheses — evidence for each.
  6. Next discriminating test — cheapest test and expected outcomes.
  7. Limitations — missing runs, assumptions, and untested dimensions.

Quality gate

Before finishing, verify that:

  • at least three resolutions support any convergence-order claim;
  • compared runs differ only in declared numerical controls;
  • sample grids were aligned or interpolation was disclosed;
  • near-zero invariants use an explicit normalization scale;
  • spectral claims account for sampling and Nyquist frequency;
  • physical oscillations are not called artifacts without a refinement test;
  • the verdict names observable, timespan, range, and tolerance;
  • numerical credibility is not confused with model validity.

References

  • references/input-schema.md — CSV columns, invocations, difference-to-step pairing, uniformity tolerance and exit behavior of the helper
  • ../_shared/physics-evidence-contract.md — §4 academic-integrity boundary shared by all physics skills (no invented runs or convergence results)

变更记录 / Changelog

版本日期变更类型
0.1.12026-09-26写明自收敛时差值与步长的配对(差值记在较粗步长那一行、保持同一加密比);脚本接受三次运行得到的两个差值并给警告,加密比不一致时也给警告;均匀采样容差改按时间列的打印精度计算,时间四舍五入到 4 位小数不再跳过鬼频检查;加 --selftest;补 _shared 证据契约 §4 引用;示例命令改用 python3(macOS 自带的只有 python3)patch
0.1.02026-09-05初始版本minor

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

当学生说"Common App 活动栏写不下"、"这段活动描述超字数了"、"帮我把这几条压到限制内"时使用。先按官方申请表核对当季字符限额,再逐条检查;一次把所有条目量完并直接给出压缩版,只在需要砍掉实质内容时才用选择题问该保哪部分。每改一版都用工具重新数一遍字符,绝不凭感觉说"这样应该够了"。只压缩,不代写空白。

日本語の概要は準備中です。原文の説明を表示しています。

ChromiteCr/Skills42026年10月16日 更新

当学生说"我参加过一些活动但没整理过"、"帮我把经历录进去"、"我的活动档案是空的"时使用。让学生一口气把记得的活动说出来,直接把这段话拆成结构化的长期事项(角色、组织、起止时间、做了什么、结果、级别),说不清的字段留空标"待补"而不是编,再用一张选择题卡把级别判定与是否重复这类关键项一次问完,然后提案入库。只记录学生真正说出口的内容,级别按事实判定,绝不往高了写。

日本語の概要は準備中です。原文の説明を表示しています。

ChromiteCr/Skills42026年10月16日 更新

当学生问"招生官会怎么看我的档案"、"我的背景还差什么"、"帮我评估一下现在的申请竞争力"时使用。以顶尖大学招生官的视角通读学生的档案、长期活动与已写下的反思,不问任何前置问题直接产出一份指名道姓的坦诚点评:这份材料的亮点、招生官真实的解读方式、明显的短板与空白、以及接下来最值得做的一到两件事。只读不写,不修改学生的任何数据,也不代写任何申请材料。

日本語の概要は準備中です。原文の説明を表示しています。

ChromiteCr/Skills42026年10月16日 更新

当使用者说"帮我填词"、"按这个字数模板写歌词"、"用多Agent对抗式写词"、"这首副歌帮我想几句"时使用,前提是字数骨架和这首歌写什么都已经有了;只有主题、还没定写什么时先用 lyric-concept-builder。拿一份字数骨架和意象系统,派三个 sonnet 子代理按不同路子并行独立起草(场景派 / 口语派 / 意象派),再派一个红队子代理逐句挑毛病,主 Agent 按句裁决拼稿,最后统一辙口与意象。收敛判据卡死:字数用 lyric-doctor 的脚本对模板数、每段同辙、hook 不含陈词、主歌二对主歌一有推进。不抄现有歌词,不替使用者决定这首歌要说什么。

日本語の概要は準備中です。原文の説明を表示しています。

ChromiteCr/Skills42026年10月16日 更新

当想知道一段 AI 回答"哪些能直接用、哪些必须先验证、哪些只能当建议"时使用。按声明类型分四级——低风险草稿材料、观点与策略建议、可查证的事实声明、会改变状态的可执行指令——每级配一句默认处置动作;再按影响半径排序,给出最小的下一步检查。可执行类一律标"不能直接执行;先做代码审阅/沙箱测试/回滚准备",其中破坏性或提权的命令排在最前。教的是一套可复用的复查习惯,不是替使用者把所有内容都核实一遍:本 skill 只分级、排序、定处置,要逐条核实走 ai-output-fact-checker,整段代码要做入库体检走 ai-code-onboarding-checklist。

日本語の概要は準備中です。原文の説明を表示しています。

ChromiteCr/Skills42026年10月16日 更新

当拿到一段 AI 生成的代码,还没决定要不要信、要不要跑、要不要往上继续加东西时使用。先做一遍客观体检:行数与嵌套深度、有没有测试、有没有硬编码密钥或遗留 TODO、依赖是不是真实存在、有没有危险调用(eval/exec、shell=True、递归删除、反序列化、提权、外发网络,按正文给的 grep 模式逐类查);再给风险评级和下一步动作。老实写明它查不了算法正确性——体检通过不等于代码是对的。回答里文字、事实和代码混在一起时先用 ai-answer-triage 分级;只审相对已有代码的一份改动用 ai-diff-review-protocol。

日本語の概要は準備中です。原文の説明を表示しています。

ChromiteCr/Skills42026年10月16日 更新

ChromiteCr のスキルをすべて見る

このスキルの問題を報告する