agents/projects/code-health/histogram-cleanup/SKILL.md
Identify and safely remove "dead code" associated with expired histograms. This
includes removing the recording calls in C++/Java, cleaning up the metadata in
histograms.xml, and addressing any dependent tests.
Expired histograms that are not intentionally kept for diagnostics represent technical debt. Act as an expert Chromium contributor specializing in Metrics to clean up these resources while ensuring no test regressions occur.
Goal: Remove expired Chromium histograms (dead metrics) from XML files and all code recording sites.
histograms.xml that the co-located
histograms are also expired and lack the <expired_intentionally> tag.[!IMPORTANT] Execution Protocol: Execute all steps sequentially one by one. Do not skip any step. Do not use
edit-codeorgrep. Userg(ripgrep) for searches.
Follow the workspace preparation steps in workspace_preparation.md to ensure a clean and updated environment.
Follow the Discovery & Batch Selection workflow.
Comprehensive Analysis: Delegate the entire deep dive to the
generalist sub-agent with this exact prompt:
"Read
references/analysis_guidelines.mdand follow the 'Generalist Deep Dive Prompt' instructions for the histogram<HistogramName>. ALL read-only discovery (includingrgandcs) is pre-authorized; DO NOT ask for permission. Assumergis available in the environment."
Present Findings & Evaluate Confidence: Evaluate the Confidence Score
returned by the generalist.
ask_user (type='choice'):
header: "Confidence Check"question: "This histogram is safe to remove from [Files] and [Tests].
My confidence for this cleanup is [X]/10 because [Justification]. Shall I
proceed with the cleanup diff?"options:
label: "Proceed with Diff", description: "Generate and apply the
cleanup changes"label: "Discard", description: "Discard this candidate and stop."Process the changes file by file, and apply modifications inside each file one recording call at a time (rather than refactoring all files or recording calls at once). This ensures stability and allows for precise verification.
python3 tools/metrics/histograms/validate_format.py to validate all
metadata changes. Address any errors that are reported.git cl format to format the modified source
code. Address any errors that are reported.generalist sub-agent. Proceed to the
Verification phase only after the review returns PASS.Follow the Verification workflow.
Bug Tracking:
references/bug_discovery.md using the <HistogramName> and
<ExpiryDate> from the candidate.Upload Pipeline:
histogram-cleanupcleanup-<HistogramName>histogram-cleanupRemove expired histogram: <HistogramName>Remove expired histogram <HistogramName> which expired on <ExpiryDate> and has no recording sites.499059525<Bug ID> from the Bug Tracking step.histograms.xml