skills/invariant-guard/SKILL.md
--- name: invariant-guard description: Correctness-first: forces writing the function contract, loop invariant, termination argument, and edge cases BEFORE code. Catches Boyer-Moore, leftmost binary search, QuickSelect traps. category: Document Processing source: antigravity tags: [typescript, node, claude, ai, template, design, document, cro] url: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/invariant-guard --- # invariant-guard — Correctness-First Coding The model
npx skillsauth add ranbot-ai/awesome-skills skills/invariant-guardInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
The model knows what a loop invariant is. It knows recursion needs a base case. It knows about empty lists, integer overflow, and the difference between < and ≤. It just does not write these down before producing code, so it ships subtle correctness bugs that tests do not catch.
invariant-guard fixes the behavior. State the invariants. State the base case. State the termination argument. State the edge cases. Then write the code — and verify that the code maintains what you stated.
Violating the letter of these rules is violating the spirit of the skill. "I know this algorithm" is the exact rationalization that ships off-by-one and missing-postcondition bugs.
Use invariant-guard when writing or reviewing algorithms where the obvious implementation is subtly wrong:
Pairs with lemmaly (picks the algorithm) and mathguard (picks the math). Load invariant-guard after the algorithm has been chosen and before the loop body is written.
NO LOOP OR RECURSION WITHOUT A WRITTEN INVARIANT AND TERMINATION ARGUMENT
If you cannot write the invariant in one sentence, you have not designed the loop. Write code anyway and you are coding by guess — and the bug will be in the case you did not enumerate.
Every loop gets a one-line invariant. Before writing any loop, state in one sentence what is true at the top of every iteration. Examples:
result contains the sum of a[0..i)."lo ≤ target_position ≤ hi."seen contains every element processed so far; dups contains every element that appeared at least twice."If you cannot write the invariant in one sentence, you have not designed the loop yet.
Every loop gets a one-line termination argument. Name the quantity that strictly decreases (or strictly increases toward a bound) on every iteration. Examples:
hi − lo strictly decreases each iteration."i increases by 1 and is bounded above by n."stack.length strictly decreases each pop; nothing pushes inside this branch."No termination argument, no loop.
Every recursion gets an explicit base case and a measure. Before writing a recursive function, state:
len(xs), hi − lo, depth, n).No base case + measure, no recursion. (Mutual recursion: state the measure across the cycle.)
List edge cases before writing, not after. For every function operating on a collection or number, list which of these apply and how they behave:
[], "", null, undefined, None).[x]).-0, denormals (for floats).The cases that apply must each have a one-phrase expected behavior written down.
Make illegal states unreachable, not just unhandled. Prefer encoding constraints in types and structure so the wrong state cannot be constructed:
Loading | Loaded(data) | Error(msg) not {loading, data, error}).UserId vs OrderId).If the language cannot encode it, write the invariant as a comment and assert it at the boundary.
Before producing non-trivial code that has loops, recursion, or non-trivial state, your message must contain — in this order:
testing
Fix SEO indexing issues, crawl budget problems, and Search Console coverage errors for Next.js apps. Covers canonical tags, noindex audits, sitemap health, static rendering, and internal linking.
data-ai
Analyze AI disruption pressure across a business, map competitive exposure, and produce a 90-day defensive action plan.
tools
--- name: longbridge description: 125+ agent skills for Longbridge Securities — real-time quotes, charts, fundamentals, portfolio analysis, options, and more for HK/US/A-share/SG markets. Trilingual: Simplified Chinese, Traditional category: AI & Agents source: antigravity tags: [api, mcp, claude, ai, agent, security, cro] url: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/longbridge --- # Longbridge ## Overview Longbridge is the official skill collection for Longbr
tools
Design, debug, and harden GitHub Actions CI/CD workflows, including reusable workflows, matrix builds, self-hosted runners, OIDC authentication, caching, environments, secrets, and release automation.