One-click install
npx skills add https://github.com/watmin/datamancy.dev --skill temperare
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: temperare
Source: https://github.com/watmin/datamancy.dev/tree/main/temperare
Command: npx skills add https://github.com/watmin/datamancy.dev --skill temperare

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Reduce wasteful computation in code by identifying and eliminating redundant work, such as repeated pure calls, loop-invariant calculations, and premature recomputation, to improve performance without changing behavior.

Core Features & Use Cases

  • Detects redundant pure calls and hoists results to avoid repeated work.
  • Identifies loop-invariant computations and proposes hoisting or caching strategies.
  • Flags cache-like constructs that recompute on every access and suggests proper memoization or lazy evaluation.
  • Works across languages with guidance to translate patterns (Rust examples provided).

Quick Start

Identify redundant computations in your Rust code and refactor to remove them while preserving determinism.

Frequently Asked Questions about temperare

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I identify and eliminate redundant computations in my code?

To identify redundant computations, analyze code for repeated pure calls, loop-invariant calculations, and premature recomputation. You can eliminate this redundant work by hoisting invariants, memoizing results, or applying safe lazy evaluation to improve performance without changing behavior.

What is loop-invariant code motion and when should I apply it?

Loop-invariant code motion is an optimization technique that hoists calculations yielding the same result out of a loop. You should apply it when a computation inside a loop depends only on invariant data, preventing redundant recomputation on every iteration while preserving determinism.

How do I refactor repeated pure function calls to improve code efficiency?

Refactor repeated pure function calls by caching their results through memoization or hoisting the return value to a variable. This prevents redundant computation across multiple invocations, safely improving code efficiency while maintaining verifiable outcomes.

Does this redundant computation detection work with languages other than Rust?

Yes, redundant computation detection works across languages by providing guidance to translate optimization patterns. While Rust examples are provided for identifying hoisting invariants and memoization, the detection criteria for pure calls and loop-invariants apply universally.

When should I not use memoization for cache-like constructs?

You should not use memoization when a function relies on mutable state or external side effects, as caching assumes deterministic pure calls. Avoid it if the underlying data changes frequently, since stale cached results would break the expected behavior.

What's the best way to safely implement lazy evaluation for invariant data?

The best way to safely implement lazy evaluation for invariant data is to establish clear guardrails that defer computation until the value is actually needed. This cuts wasted computation on premature recomputation while ensuring verifiable, deterministic outcomes.