Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add karsten-s-nielsen/mad-scientist-skills --skill measure-before-optimizegit clone --depth 1 https://github.com/karsten-s-nielsen/mad-scientist-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/karsten-s-nielsen/mad-scientist-skills/measure-before-optimize)<a href="https://agentmods.dev/skills/karsten-s-nielsen/mad-scientist-skills/measure-before-optimize"><img src="https://agentmods.dev/badge/skills/karsten-s-nielsen/mad-scientist-skills/measure-before-optimize/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/karsten-s-nielsen/mad-scientist-skills/measure-before-optimize"><img src="https://agentmods.dev/badge/skills/karsten-s-nielsen/mad-scientist-skills/measure-before-optimize.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00089 | $0.02103 |
| Opus 5 | $0.00044 | $0.01052 |
| Sonnet 5 | $0.00018 | $0.00421 |
| Haiku 4.5 | $0.00009 | $0.00210 |
Grade A, and why
measure-before-optimize scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 178 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Measure Before Optimize
A pre-change measurement discipline that captures a performance baseline, gates the change on a regression threshold, and reports the delta. Designed as a peer to optimization-audit: this skill is pre-change, that one is retrospective.
When to use this skill
- Before modifying a function that has a
pytest-benchmarktest. - Before modifying a function listed in the project's performance baselines file (commonly
docs/performance-baselines.mdordocs/benchmarks.md). - Before modifying a function flagged as a hot path in
CLAUDE.md,CONTRIBUTING.md, or a performance-related document. - When the user says "optimize X", "speed up Y", "this function is slow", or similar performance-intent phrases.
- When a task touches tracking-scale data, Spark UDFs with strict memory budgets, or any code in a documented hot loop.
What this skill is NOT for
- Retrospective performance audits — use
optimization-auditinstead. - First-time benchmark creation — if no benchmark exists for the function being modified, warn the user and offer to add one, but do not block. This skill gates CHANGES to measured functions, not the creation of new ones.
- Micro-benchmarks of framework internals that you do not own.
- Production profiling — this skill runs local micro-benchmarks only, not production traces.
Workflow
Phase 1: Identify the measurement surface
Read the project's baselines file (default: docs/performance-baselines.md). Extract the table of benchmarked functions. If the file is a JSON baselines file, parse it directly. If neither exists, grep for @pytest.mark.benchmark or benchmark( invocations in tests/ and src/tests/.
Build a set of "measured functions" — functions with known benchmarks. Cross-reference with the function being modified.
- If the function is in the measurement surface: proceed to Phase 2.
- If the function is NOT in the measurement surface: warn the user:
"The function
<name>is not currently benchmarked. I can add apytest-benchmarktest before modifying it, or you can proceed without a baseline. Which?" - Do not block — the user may have a good reason to proceed without a baseline.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 12d ago First seen · 178 lines · 89 tokens per session scan A b6261ac16b77
measure-before-optimize is a skill published in the GitHub repository karsten-s-nielsen/mad-scientist-skills (3 stars, last pushed 13d ago), licensed MIT. It adds 89 tokens to every session and 2,103 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
concept
This skill should be used when the user asks to "create a concept spec", "retrofit a module", "check spec drift", "run drift detection", "design a new module", "wyx concept", or wants to generate, update, or drift-check CONCEPT.md files. Supports retrofit, greenfield, drift detection, and discovery modes.
map
This skill should be used when the user asks to "generate architecture map", "visualize spec relationships", "create ARCHITECTURE.md", "show concept dependencies", "wyx map", or wants a Mermaid graph with dependency matrix and data flow paths derived from all wyx specs.
audit
This skill should be used when the user asks to "audit spec coverage", "find uncovered modules", "scan for missing specs", "check wyx coverage", "get spec TODO list", "wyx audit", "wyx", or wants a prioritized list of wyx skill commands for uncovered modules. Scans for coverage gaps, pipeline/sync candidates, and…
sync
This skill should be used when the user asks to "document sync patterns", "map sync handlers", "create SYNCS.md", "review sync coordination", "wyx sync", or wants to understand how concepts communicate through orchestrated workflows. Produces SYNCS.md coordination maps.
pipeline
This skill should be used when the user asks to "create a pipeline spec", "document data transformations", "document data flow", "specify pipeline invariants", "wyx pipeline", or wants to design, retrofit, or discover data pipelines with quality invariants and boundary ownership. Produces PIPELINE.md specs.
refactor
Automated iterative code refactoring with swarm-orchestrated specialist agents including deep codebase discovery, confidence-scored code review, and security analysis. Use this skill when the user wants to improve existing code quality, clean up messy code, restructure, simplify, reduce tech debt, or perform…