agentleFS
Microsoft AzureKnown publisherAzure/azure-policy-linter/.github/skills/sanity-check-linter/SKILL.md

sanity-check-linter

Skill25 starsChanged 5 months agoMITView on GitHub

Run the Policy Linter CLI against a temporary test policy to confirm a recent code change behaves end-to-end. Triggers: "sanity check the linter", "run the linter against a test policy", "verify the linter still works", "smoke test the linter".

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. About 0 are common, 10 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run the linter CLI against a temporary policy to confirm a code change is structurally sound end-to-end before committing.

    line 8
  2. Distinctive:

    After adding a new linter rule.

    line 12
  3. Distinctive:

    After modifying the engine, expression model, or rule dispatch.

    line 13
  4. Distinctive:

    Before declaring a non-trivial change complete.

    line 14
  5. Distinctive:

    Not needed for doc-only changes, test-only changes, or version bumps.

    line 16
  6. Very specific:

    Check for an existing global install before touching anything.

    line 20
  7. Distinctive:

    Create two temporary policy files for the changed rule:

    line 47
  8. Distinctive:

    Run the linter against both policies under each scenario relevant to the change.

    line 70
  9. Distinctive:

    No findings appear from rule sets that weren't selected.

    line 84
  10. Very specific:

    Delete the temporary files: Remove-Item sanity-check.json, sanity-check-suppressed.json.

    line 87
  11. Very specific:

    If step 1 found a feed install to restore, reinstall it: dotnet tool install -g <id> --version <version>.

    line 89
  12. Distinctive:

    Not a replacement for unit tests.

    line 93
  13. Distinctive:

    Not a coverage tool. The test policy is intentionally minimal - pick one that exercises the change you're verifying.

    line 94

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: Sanity-Check the Policy Linter

Run the linter CLI against a temporary policy to confirm a code change is structurally sound end-to-end before committing. This is distinct from unit tests - it verifies rule discovery, dispatch, rule-set filtering, and output formatting.

When to use

  • After adding a new linter rule.
  • After modifying the engine, expression model, or rule dispatch.
  • Before declaring a non-trivial change complete.

Not needed for doc-only changes, test-only changes, or version bumps.

Flow

  1. Check for an existing global install before touching anything. List installed tools and find any that provides the policylinter command or whose id ends in .PolicyLinter.Cli:

    dotnet tool list -g

    dotnet tool doesn't record where a tool came from, so you can't tell a local build from a feed install by inspection. Record the id and version. Unless the current task already said it's fine to overwrite an existing install, show the user the id and version, tell them it will be removed, and ask whether it's a real install from a feed (restore it afterwards) or a disposable local build (don't). Wait for confirmation.

  2. Uninstall the existing tool (repeat for the new id too, if it differs):

    dotnet tool uninstall -g <existing-id>
  3. Pack and install the CLI as a global tool from a clean build:

    dotnet pack src/PolicyLinter.Cli/PolicyLinter.Cli.csproj --configuration Release -o <output-path>
    dotnet tool install -g Microsoft.Azure.Policy.PolicyLinter.Cli --add-source <output-path> --no-cache
  4. List the available rule sets to confirm rule discovery works:

    policylinter --list-rule-sets
  5. Create two temporary policy files for the changed rule:

    • One that triggers the rule.
    • One that differs only in the condition that should suppress the rule.

    The deny-VM example below triggers a default rule (HardCodedPolicyEnforcementEffect), which gives you a guaranteed finding to confirm the CLI ran end-to-end. Adjust it to exercise the change you just made, then create the matching suppression case.

    @"
    {
      "properties": {
        "policyType": "Custom",
        "mode": "All",
        "displayName": "Sanity-check policy",
        "description": "Temporary policy for linter sanity-check.",
        "policyRule": {
          "if": { "field": "type", "equals": "Microsoft.Compute/virtualMachines" },
          "then": { "effect": "deny" }
        }
      }
    }
    "@ | Out-File -FilePath sanity-check.json -Encoding UTF8
  6. Run the linter against both policies under each scenario relevant to the change. At minimum, run the default rule set. If the change touches a non-default rule set or rule-set filtering, run those too:

    policylinter sanity-check.json
    policylinter sanity-check-suppressed.json
    policylinter sanity-check.json --rule-set <RuleSetName>
    policylinter sanity-check-suppressed.json --rule-set <RuleSetName>
    policylinter sanity-check.json --rule-set <RuleSetName> --rule-set default
    policylinter sanity-check-suppressed.json --rule-set <RuleSetName> --rule-set default
  7. For each run, verify:
    • The CLI exits without an error.
    • Findings from the rule you changed appear (or are absent) as expected.
    • No findings appear from rule sets that weren't selected.
  8. Clean up:
    • Delete the temporary files: Remove-Item sanity-check.json, sanity-check-suppressed.json.
    • Uninstall the sanity-check build: dotnet tool uninstall -g Microsoft.Azure.Policy.PolicyLinter.Cli.
    • If step 1 found a feed install to restore, reinstall it: dotnet tool install -g <id> --version <version>.

What this skill is not

  • Not a replacement for unit tests. Unit tests exercise rule logic against precise inputs; this confirms end-to-end glue.
  • Not a coverage tool. The test policy is intentionally minimal - pick one that exercises the change you're verifying.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.