在 Manus 中运行任何 Skill
一键导入
一键导入
一键在 Manus 中运行任何 Skill
开始使用$pwd:
scaffold-statistic
// Generate boilerplate for a new statistic following library conventions
$ git log --oneline --stat
stars:10
forks:0
updated:2026年2月21日 18:59
SKILL.md
// Generate boilerplate for a new statistic following library conventions
| name | scaffold-statistic |
| description | Generate boilerplate for a new statistic following library conventions |
| disable-model-invocation | true |
Generate the boilerplate code for adding a new statistic to qsv-stats, following established library conventions.
The user should provide:
coefficient_of_variation)unsorted, online, frequency, or minmax) — or suggest one based on the statistic's nature/// Brief description of the statistic.
///
/// This has time complexity `O(...)` and space complexity `O(...)`.
///
/// ## Example
///
/// ```
/// use stats;
///
/// let vals = vec![1, 2, 3, 4, 5];
/// let result = stats::statistic_name(vals.into_iter());
/// ```
pub fn statistic_name<I>(it: I, precalc_param: Option<f64>) -> Option<f64>
where
I: Iterator,
I::Item: PartialOrd + ToPrimitive,
{
let mut unsorted = Unsorted::new();
unsorted.extend(it);
unsorted.statistic_name(precalc_param)
}
pub fn statistic_name(&mut self, precalc_param: Option<f64>) -> Option<f64> {
// TODO: implement
todo!()
}
#[cfg(test)] block)Generate edge-case tests following the existing pattern:
#[test]
fn test_statistic_name_empty() {
let vals: Vec<f64> = vec![];
assert_eq!(statistic_name(vals.into_iter(), None), None);
}
#[test]
fn test_statistic_name_single() {
let vals = vec![42.0];
// TODO: expected value for single element
}
#[test]
fn test_statistic_name_basic() {
let vals = vec![1.0, 2.0, 3.0, 4.0, 5.0];
// TODO: expected value
}
#[test]
fn test_statistic_name_duplicates() {
let vals = vec![1.0, 1.0, 2.0, 2.0, 3.0];
// TODO: expected value
}
#[test]
fn test_statistic_name_negatives() {
let vals = vec![-3.0, -1.0, 0.0, 1.0, 3.0];
// TODO: expected value
}
#[test]
fn test_statistic_name_with_precalc() {
// Test that passing precalculated values produces same result
let vals = vec![1.0, 2.0, 3.0, 4.0, 5.0];
let without = statistic_name(vals.clone().into_iter(), None);
let with = statistic_name(vals.into_iter(), Some(precalc_value));
assert_eq!(without, with);
}
.mul_add() for any a * b + c arithmeticto_f64() via ToPrimitive for numeric conversionsunsafe { ... } with // SAFETY: comments#[inline] on small methodsPartial<T> wrapper when sorting PartialOrd types+ Sync to type bounds if rayon parallel operations are usedRemind the user to:
todo!() implementationlib.rs if it's a module-level functioncargo test to verify