Important notes: the one-liner above to find rules with no hits does not consider rules inside a section. It also does not consider the age of the rule. A brand new rule (or newly updated rule) which hasn't yet been tested would show up in the list of rules to be removed.
Here is a script which will get all of the rules including ones in sections:
[Expert@DallasSC]# mgmt_cli -f json -r true show access-rulebase name "Network" details-level full show-hits true use-object-dictionary true limit 500 offset 0 | jq -c '.rulebase[]|if has("rulebase") then .rulebase[] else . end|{uuid:.uid,hits:.hits.value,ruleNumber:."rule-number",ruleName:.name,lastModified:."meta-info"."last-modify-time".posix}'
{"uuid":"7f2e8b2e-a444-4e78-ae30-2c353fcb1811","hits":5601804,"ruleNumber":1,"ruleName":"Sectionless","lastModified":1749511597766}
{"uuid":"cfaeefa5-a96a-4ed8-8306-72e72d79f23d","hits":35332,"ruleNumber":2,"ruleName":"Management access","lastModified":1749511600777}
{"uuid":"5dae513d-934d-4a47-b8af-1b5d6b201eb4","hits":0,"ruleNumber":3,"ruleName":"Bad browsing","lastModified":1749511601446}
{"uuid":"c5b09864-5c5c-4775-b781-2287c56496b4","hits":0,"ruleNumber":4,"ruleName":null,"lastModified":1749511602850}
{"uuid":"7da03051-74b7-4d2f-92ff-7af45d8a625b","hits":0,"ruleNumber":5,"ruleName":null,"lastModified":1749511603707}
{"uuid":"21c0044c-f1a2-4fa7-bfb8-b19c0ca1dab1","hits":0,"ruleNumber":6,"ruleName":null,"lastModified":1749511604665}
{"uuid":"7f54a07b-ec25-4ce3-a427-73dfa6affc54","hits":0,"ruleNumber":7,"ruleName":null,"lastModified":1749511605528}
{"uuid":"26e693d5-360e-4ff6-a8f1-b3a33fd96a0f","hits":0,"ruleNumber":8,"ruleName":null,"lastModified":1749511606414}
{"uuid":"5d7e798b-3df8-4c5b-bc49-dc8c0cde40aa","hits":0,"ruleNumber":9,"ruleName":null,"lastModified":1749511607238}
{"uuid":"f873fabe-9d6d-41a5-8d63-0bb445ef141f","hits":0,"ruleNumber":10,"ruleName":null,"lastModified":1749511608131}
{"uuid":"81f1116a-b8b2-43cc-b0ad-802b584bdca1","hits":0,"ruleNumber":11,"ruleName":null,"lastModified":1749511609027}
{"uuid":"b7d2f494-631a-4a77-8480-d70297346aa5","hits":0,"ruleNumber":12,"ruleName":null,"lastModified":1749511609889}
{"uuid":"e80c2af2-30d7-4077-a332-274218019762","hits":0,"ruleNumber":13,"ruleName":null,"lastModified":1749511610664}
{"uuid":"267b45b0-efe5-47fc-83ec-b6b70335191a","hits":0,"ruleNumber":14,"ruleName":null,"lastModified":1749511612564}
{"uuid":"4c7aa052-0077-4cdc-8444-71c886232ea5","hits":0,"ruleNumber":15,"ruleName":null,"lastModified":1749511613791}
{"uuid":"04c0c300-4a22-47a1-9738-6bac10cf73f1","hits":0,"ruleNumber":16,"ruleName":null,"lastModified":1749511615241}
{"uuid":"a2a5e904-b467-4eb0-82f1-862891c670d5","hits":0,"ruleNumber":17,"ruleName":null,"lastModified":1749511616156}
{"uuid":"8e6adc3c-d8ff-472d-8daa-ad7055319ed4","hits":0,"ruleNumber":18,"ruleName":null,"lastModified":1749511617077}
{"uuid":"95b4133d-bb45-4d2a-9778-ae824819f033","hits":0,"ruleNumber":19,"ruleName":null,"lastModified":1749511617998}
{"uuid":"817d4149-bbb7-4dc0-8ba6-c11b8b9aad02","hits":0,"ruleNumber":20,"ruleName":null,"lastModified":1749511618889}
{"uuid":"7fa553a0-f199-48b8-83eb-b62799e5193d","hits":0,"ruleNumber":21,"ruleName":null,"lastModified":1749511619723}
{"uuid":"4b48e412-21e4-46a3-b8e4-9cda96664e56","hits":0,"ruleNumber":22,"ruleName":null,"lastModified":1749511620605}
{"uuid":"d4d3f951-09c1-42b2-a38c-d3390fde56ab","hits":0,"ruleNumber":23,"ruleName":null,"lastModified":1749511621484}
{"uuid":"35055d5e-86da-443c-8719-2f85a4271d43","hits":0,"ruleNumber":24,"ruleName":null,"lastModified":1749511622364}
{"uuid":"59571bb0-b18f-4869-b19f-ebb3c8f51721","hits":0,"ruleNumber":25,"ruleName":null,"lastModified":1749511623204}
{"uuid":"5a3d81d2-85bf-457d-a546-65c0b97e8602","hits":0,"ruleNumber":26,"ruleName":null,"lastModified":1749511624010}
{"uuid":"c3ea60ca-99e1-4d46-a48f-2f664c8eda68","hits":0,"ruleNumber":27,"ruleName":null,"lastModified":1749511625185}
{"uuid":"d6ce82b3-9c3b-4819-98b8-69146ee21f8f","hits":0,"ruleNumber":28,"ruleName":null,"lastModified":1749511626879}
{"uuid":"91bec9e7-6df4-4d0f-8563-eb5f600c14fb","hits":9393231,"ruleNumber":29,"ruleName":null,"lastModified":1749511628953}
Here's a version to get rules older than 370 days and with 0 hits:
mgmt_cli -f json -r true show access-rulebase name "Network" details-level full show-hits true use-object-dictionary true limit 500 offset 0 | jq -c '.rulebase[]|if has("rulebase") then .rulebase[] else . end|{uuid:.uid,hits:.hits.value,ruleNumber:."rule-number",ruleName:.name,lastModified:."meta-info"."last-modify-time".posix}' | jq -c "select(.lastModified < $(date --date='-370 days' +'%s000'))|select(.hits == 0)"
In both cases, if you have more than 500 rules, you'll have to run it multiple times adjusting the offset value to get all of the rules. You will probably also need to adjust the access layer name ("Network" above).