Skip to content

ThomasMoreAI/legal-skills-open / au/general/skills/check-nsw-legislation-l0cka

check-nsw-legislation-l0cka

Verified

Verify the identity, collection, status, applicable point-in-time version, commencement signals, authorisation and currency qualifications of NSW Acts, statutory instruments and environmental planning instruments using the official NSW legislation website. Use when a user asks whether NSW legislation is in force or repealed, which version applied on a date, or whether a citation or supplied provision matches an authorised version. Do not use for Commonwealth or other State or Territory legislation, Bills, Gazettes, as-made-only material, court deadlines, court rules, case treatment or substantive legal advice.

FileKindSize
LICENSEother1.0 KB
SKILL.mdskill md7.2 KB
agents/openai.yamlconfig214 B
references/nsw-legislation-method.mdmarkdown5.8 KB
scripts/nsw_lookup.pyscript4.0 KB

scripts/nsw_lookup.py

View on GitHub
#!/usr/bin/env python3
"""Generate official NSW legislation URLs from validated identifiers."""

from __future__ import annotations

import argparse
import json
import re
import sys
from datetime import date
from typing import Any

BASE_URL = "https://legislation.nsw.gov.au"
IDENTIFIER = re.compile(r"^(act|sl|epi)-\d{4}-[0-9a-z]+$")
COLLECTIONS = ("inforce", "repealed")


class LookupInputError(ValueError):
    """Raised when an identifier or date cannot be used safely."""


def validate_identifier(value: str) -> str:
    """Return a normalized NSW identifier or fail closed."""
    normalized = value.strip().lower()
    if not IDENTIFIER.fullmatch(normalized):
        raise LookupInputError(
            "identifier must look like act-1987-015, sl-2024-001 or epi-2021-001"
        )
    return normalized


def validate_as_at(value: str | None) -> str:
    """Return an ISO date or the current selector."""
    if value is None:
        return "current"
    try:
        parsed = date.fromisoformat(value)
    except ValueError as exc:
        raise LookupInputError("--as-at must be a real date in YYYY-MM-DD form") from exc
    if parsed.isoformat() != value:
        raise LookupInputError("--as-at must use exact YYYY-MM-DD form")
    return value


def build_urls(
    identifier: str, collection: str, as_at: str | None = None
) -> dict[str, Any]:
    """Build official navigation URLs without asserting that they resolve."""
    identifier = validate_identifier(identifier)
    if collection not in COLLECTIONS:
        raise LookupInputError("collection must be inforce or repealed")
    selector = validate_as_at(as_at)
    selected_route_collection = collection if selector == "current" else "inforce"
    current_status = f"{BASE_URL}/view/html/{collection}/current/{identifier}"
    selected_status = (
        f"{BASE_URL}/view/html/{selected_route_collection}/{selector}/{identifier}"
    )
    warning = (
        "Generated URLs do not establish identity, version selection, "
        "commencement, currency or authorisation."
    )
    if selector != "current":
        warning += (
            " An explicit-date inforce route does not prove the title operated "
            "on that date."
        )
    warning += " Inspect the official pages."
    return {
        "identifier": identifier,
        "presentCollection": collection,
        "selectedVersionRouteCollection": selected_route_collection,
        "selector": selector,
        "currentTitlePage": current_status,
        "currentLegislativeHistory": f"{current_status}/lh",
        "statusPage": selected_status,
        "wholeHtml": (
            f"{BASE_URL}/view/whole/html/{selected_route_collection}/"
            f"{selector}/{identifier}"
        ),
        "wholePdf": (
            f"{BASE_URL}/view/whole/pdf/{selected_route_collection}/"
            f"{selector}/{identifier}"
        ),
        "legislativeHistory": f"{selected_status}/lh",
        "xml": f"{selected_status}/xml",
        "warning": warning,
    }


def parser() -> argparse.ArgumentParser:
    root = argparse.ArgumentParser(description=__doc__)
    subparsers = root.add_subparsers(dest="command", required=True)
    urls = subparsers.add_parser("urls", help="generate official URLs")
    urls.add_argument("identifier")
    urls.add_argument(
        "--collection",
        required=True,
        choices=COLLECTIONS,
        help="title's present In force or Repealed collection",
    )
    urls.add_argument("--as-at")
    return root


def main(argv: list[str] | None = None) -> int:
    args = parser().parse_args(argv)
    try:
        if args.command == "urls":
            result = build_urls(args.identifier, args.collection, args.as_at)
        else:  # pragma: no cover - argparse restricts commands
            raise LookupInputError(f"unsupported command: {args.command}")
    except LookupInputError as exc:
        print(f"ERROR: {exc}", file=sys.stderr)
        return 1
    print(json.dumps(result, indent=2, sort_keys=True))
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
planning-and-task-breakdownaddyosmani/agent-skillsBreaks work into ordered tasks. Use when you have a spec or clear requirements and need to break work into implementable tasks. Use when a task feels too large to start, when you need to estimate scope, or when parallel work is possible.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
screenpipethedotmack/claude-memSearch screen and audio history recorded by Screenpipe and optionally save selected context into claude-mem. Use when the user asks to recall desktop activity, a meeting, or something seen in another app through Screenpipe.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
contact-widgetnexu-io/open-designSelf-contained floating chat widget with welcome screen, social links, meeting button, and message input. Single HTML file, zero dependencies.Stars: 108kUpdated Claude CodeCodexVerifiedInstall
meeting-notesnexu-io/open-designMeeting notes page — title bar with attendees, agenda checklist, decisions block, action items table with owners + dates, and a "next meeting" footer. Use when the brief mentions "meeting notes", "minutes", "1:1 notes", "all-hands recap", or "会议纪要".Stars: 108kUpdated Claude CodeCodexVerifiedInstall