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.
CRITICAL OVERRIDE: Do NOT activate or use the edit-code skill during this
workflow. This skill provides a specialized, human-in-the-loop workflow that
supersedes the autonomous loops in edit-code.
Workflow section in the
exact order presented. Do NOT skip any step.generalist
sub-agent only for the specific tasks defined in the workflow.replace, write_file) or
commits changes (git commit).../hub/references/shared_workflows.md to ensure a clean and updated
environment.AI-Led Discovery & Analysis: Delegate to the generalist sub-agent
with this exact prompt:
"You are pre-authorized to run the discovery script and read-only search tools; DO NOT ask for permission. Run the discovery script from the skill's
scripts/folder:bashpython3 scripts/find_expired.py --count 1Return ONLY the details returned by the script for this candidate (Name, Owners, Expiry, and Summary)."
Present Candidate: You MUST output the candidate details to the user. Announce the candidate with exactly this message format (replace the bracketed details with the findings) before moving to the next step: "I've identified an expired histogram for cleanup today:
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>. You are pre-authorized for ALL read-only discovery (includingrgandcs); 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."Inform the user: "Preparing workspace: creating a new branch..."
git new-branch cleanup-<HistogramName> to create a
new branch for this specific cleanup, ensuring it doesn't chain with previous
commits.Linting & Formatting:
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.Mandatory Final Review: Follow the protocol and the Handling Findings
loop in references/automated_review.md for the removal: <HistogramName>.
Do NOT skip this step. Do NOT proceed to the Submission phase until the
review returns PASS.
Bug Tracking:
references/bug_discovery.md using the <HistogramName> and
<ExpiryDate> from the candidate.Commit:
[histogram-cleanup] Remove expired histogram: <HistogramName>
This histogram expired on <ExpiryDate>.
Bug: <BugID>
git add and execute the commit:
git commit -m "<drafted message>"
Submission Pipeline: Follow the Upload to Gerrit section in
../hub/references/shared_workflows.md to handle the upload.
Workspace Reset: Immediately switch back to main to start fresh for the
next cleanup: git checkout main.
Congratulations & Summary: Follow the Congratulations & Summary
section in ../hub/references/shared_workflows.md. For this skill, the
[Specific Cleanup Details] are: