Limit Window Format
limit-window-format
info
experience: consistencyexperience: reliability
spec: limits
Limit window should be a duration (e.g. 60s, 1h).
A limit window should be a duration like 60s, 1m, 1h, or 1d.
Rule definition
The full Spotlight rule — drop it into a ruleset (.spotlight.yaml / .spectral.yaml) and run it with any Spotlight tool.
limit-window-format:
title: Limit Window Format
reference: https://spotlight-rules.com/spec/rules/rate-limits/limit-window-format/
description: A limit window should be a duration like 60s, 1m, 1h, or 1d.
message: Limit window should be a duration (e.g. 60s, 1h).
given: $.limits[*].window
severity: info
then:
function: pattern
functionOptions:
match: ^\d+(ms|s|m|h|d)$
tags:
- format:rate-limits
- spec:limits
- experience:consistency
- experience:reliability
prompt: "You are editing a Rate Limits document to satisfy the Spotlight API
governance rule 'limit-window-format' (Limit Window Format). Requirement: A
limit window should be a duration like 60s, 1m, 1h, or 1d. To fix: Ensure
the targeted value matches the regular expression `^\\d+(ms|s|m|h|d)$`;
rewrite any value that does not. This rule is evaluated at the JSONPath
`$.limits[*].window` — inspect every location it matches and correct only
what violates the rule. Make the smallest change that satisfies the rule,
leave all unrelated content, key order, comments, and formatting unchanged,
and keep the document valid Rate Limits. Return only the complete corrected
document, with no commentary."
AI fix prompt — send this to Claude, Gemini, or ChatGPT with your artifact to auto-fix this rule
You are editing a Rate Limits document to satisfy the Spotlight API governance rule 'limit-window-format' (Limit Window Format). Requirement: A limit window should be a duration like 60s, 1m, 1h, or 1d. To fix: Ensure the targeted value matches the regular expression `^\d+(ms|s|m|h|d)$`; rewrite any value that does not. This rule is evaluated at the JSONPath `$.limits[*].window` — inspect every location it matches and correct only what violates the rule. Make the smallest change that satisfies the rule, leave all unrelated content, key order, comments, and formatting unchanged, and keep the document valid Rate Limits. Return only the complete corrected document, with no commentary.
| Artifact | Rate Limits |
|---|---|
| Applies at (given) | $.limits[*].window |
| Severity | info — educational by default; raise to warn/error to enforce |
| Reference | https://spotlight-rules.com/spec/rules/rate-limits/limit-window-format/ |