Skip to Content
agore-skill
How-to Guides

How to add a lint rule

Extend internal/lint with a deterministic rule, its table-driven tests, and keep docs and templates green.

You want a new deterministic check inside agore-skill lint. The lint engine is fixed at ten rules today; a new rule is a deliberate product decision, and this page shows the mechanical path once that decision is made.

Shape the rule first

Every rule has an ID, a severity, a trigger condition and an exact message template. Keep the existing alphabet: prefixes group by concern (SPEC-* specification, LAYOUT-*, TRIG-*, CTX-* context, SEC-* security), numbers increment within the prefix.

Implement the rule

  1. Open internal/lint/rules.go. Rules run in a fixed order — SPEC-001 … SEC-002 — and a rule is skipped when its ID is listed in skill.lint.ignore.
  2. Add your check as part of the rule table. Rules receive *skill.Skill, the *inspect.Report and the config.LintConfig (with budgets); derive what you need from those inputs only.
  3. Emit a lint.Diagnostic with the rule ID, severity, affected file and the message formatted from its template. Diagnostics must be deterministic: same input, same output, no I/O, no time, no randomness.

Test the rule

internal/lint/rules_test.go is table-driven. Add cases for:

  • the exact trigger condition (positive),
  • the boundary just below the trigger (negative),
  • the message string, byte-for-byte against the template,
  • interaction with ignore (the rule skipped).

Then run the invariant tests: the lint package asserts that all three embedded scaffold templates stay at 0 errors and 0 warnings. If your rule would fire on a fresh agore-skill create output, either the templates must be updated or the rule rethought — a rule that trips the happy path breaks the tutorial contract.

mise run test
mise run cover

Keep the docs in sync

Pass the gate

mise run check

On this page