agents/projects/code-health/keep-sorted/SKILL.md
This skill empowers AI agents to proactively maintain Chromium's code health by
identifying lists that should be alphabetically sorted, injecting
go/keep-sorted presubmit directives, and automatically fixing the order of
elements.
You should scan for files that conventionally require sorted lists but are
missing the block tags. Use tools like grep_search or find_by_name. Common
Target Types:
strings.xml (e.g., android/java/res/values/strings.xml)colors.xmldimens.xmlids.xmlBUILD.gn (for dependency lists)Look for contiguous blocks of similar elements (like <string name="...">,
<dimen name="...">, <color name="..."> or deps = [ ... ]) that are
naturally suited for alphabetical sorting. Pay close attention to blocks that
lack the <!-- go/keep-sorted start --> and <!-- go/keep-sorted end -->
tags.
Bad (Unsorted, missing tags):
<dimen name="margin_top">16dp</dimen>
<dimen name="margin_bottom">8dp</dimen>
Good (Sorted, with tags):
<!-- go/keep-sorted start -->
<dimen name="margin_bottom">8dp</dimen>
<dimen name="margin_top">16dp</dimen>
<!-- go/keep-sorted end -->
go/keep-sorted start tag before the
first item and the go/keep-sorted end tag after the last item. Use the
appropriate comment syntax for the file type (e.g., <!-- --> for XML, #
for GN).keep-sorted formatter over the file; otherwise, sort the items
manually in your script or output.Every cleanup CL must be associated with a tracking bug.
[Code Health] Maintain keep-sorted). Use
this newly created child bug's ID for your CL.Create a new branch and upload your changes to Gerrit. Your CL commit message
must include the [Code Health] tag and reference the tracking bug:
[Code Health] Add keep-sorted for <file_context>
Bug: <BUG_ID>