agentsclimarketplace

Night market diagnostics toolkit

Skill athola/claude-night-market/.claude/skills/night-market-diagnostics-toolkit

23 Claude Code plugins: TDD enforcement hooks, git/PR workflows, spec-driven development, code review, project lifecycle, fix-from-error, maintenance automation, context optimization, research, and multi-LLM delegation. 186 skills, 128 commands, 54 agents.

Install
npx -y skills add athola/claude-night-market --skill night-market-diagnostics-toolkit

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

What its author says it does

Copied from the file, not written here

Run and interpret repo diagnostic scripts (ratchets, validators, token stats). Use when measuring health. Do not use to run tests; use night-market-operations.

SKILL.md

13.3 KB, as published. Nobody here has run it

Night Market Diagnostics Toolkit

Measure instead of eyeballing. Every claim about the health of this repo ("the skill graph is clean", "descriptions fit the budget", "no compromised dependencies") has a script that produces a number or a PASS/FAIL. This skill catalogs those scripts, their exact invocations, and how to read their output.

Conventions for everything below:

  • Run all commands from the repo root (/home/alext/claude-night-market).
  • Plain python3 is enough for every script in the table except mutation testing, which needs uv.
  • All checks here are read-only. None of them mutate the repo.

The ratchet-baseline concept

Several checks are ratchets. A ratchet check counts a category of existing debt (for example, SKILL.md files missing an Exit Criteria section), compares the live count against a frozen number in a baseline JSON file, and:

  • passes while the live count is at or below the baseline (pre-existing debt is tolerated),
  • fails the moment a NEW violation pushes the count above the baseline (debt may not grow),
  • nudges you to lower the baseline number when the live count drops (locking in the win so the debt cannot silently return).

The goal is a baseline that only shrinks, eventually to zero. The two ratchet baselines live at scripts/skill_graph_baseline.json (keys max_dangling_bugs, max_uncalled_libraries) and scripts/skill_exit_criteria_baseline.json (key max_missing_exit_criteria). When a ratchet prints a "dropped to N (baseline M). Lower ... to lock the win." line, edit the baseline JSON down to N in the same PR.

Tool table

Jargon used in the table: "dangling Skill() ref" means a Skill(plugin:name) reference in a skill/command/agent file whose target skill does not exist. "Uncalled library" means a library-role skill no other skill invokes (the risk targeted by .claude/rules/shared-utility-consumer-rule.md).

ToolInvocationWhat it measuresHow to interpretWhen to run
Plugin structure validatorpython3 plugins/abstract/scripts/validate_plugin.py plugins/<name>plugin.json validity, kebab-case naming, directory layoutExit 0 with "Plugin validation passed". Any FAIL line names the broken fileBefore committing plugin changes. make validate-all loops it over every plugin
Skill-graph drift ratchetpython3 scripts/check_skill_graph_drift.pyDangling Skill() refs and uncalled libraries vs skill_graph_baseline.jsonExit 0 at/below baseline. Nonzero exit lists the new dangling refs. "Lower ... to lock the win" means shrink the baselineAfter adding, renaming, or deleting skills or Skill() refs
Exit-criteria drift ratchetpython3 scripts/check_skill_exit_criteria_drift.pySKILL.md files under plugins/ missing an ## Exit Criteria heading vs skill_exit_criteria_baseline.jsonSame ratchet semantics as aboveAfter adding or editing any SKILL.md
Pinned-version checkerpython3 scripts/check_pinned_versions.pyGitHub-sourced tool pins vs the latest upstream release (needs network)"N pin(s) current" is healthy. A "holding X at ..." line documents an intentional hold with its reason (for example bandit 1.8.6 for the Python 3.9 hook floor)In pre-commit, and whenever a CI tool-setup step breaks
Capabilities syncbash scripts/capabilities-sync-check.shplugin.json registrations vs the generated capabilities reference in book/src/"PASSED: All capabilities are in sync" plus counts. On drift, run /sanctum:sync-capabilities --fixAfter changing any skill, command, or agent registration
Supply-chain scanpython3 scripts/supply_chain_scan.pyLockfiles vs the known-compromised-versions blocklist, plus known malicious artifactsTwo [OK] lines is clean. Any hit must be resolved before releaseWhen adding dependencies, during incidents, before releases
Token statspython3 plugins/abstract/scripts/context_optimizer.py stats plugins/ --format jsonBytes and estimated tokens per SKILL.md, bucketed small/medium/largeSkills over ~5,000 estimated tokens breach the quality-gates file limit and are split candidatesWhen a skill feels bloated, before modularizing
Description budgetpython3 plugins/abstract/scripts/validate_budget.pySum of all skill/command description characters vs the 90,000-char ecosystem ceiling (ADR-0004, 160 chars per description)Prints used/ceiling and headroom. Exit 0 means within budgetAfter editing any frontmatter description
skrills validateskrills validate --skill-dir plugins --target claudeSkill frontmatter validity per target framework (Claude, Codex, Copilot)"Validated N skills: ..." then an Errors (n): list with file:line. Fix every listed errorSkill audits. make validate-skills falls back to uv run python scripts/check_plugin_hooks.py when skrills is absent
skrills analyzeskrills analyze --skill-dir pluginsSkill token usage and dependency structureLarge-token outliers are split candidatesBudget planning. make analyze-skills falls back to scripts/generate_dependency_map.py
Mutation testingcd plugins/<name> && uv run mutmut run --paths-to-mutate=scripts/,src/ --tests-dir=tests/Whether the test suite kills injected code mutations (surviving mutants = untested behavior)Exit 0 = no survivors. Exit 2 = survivors found (CI treats this as pass-with-report). Any other exit = crash, investigateWeekly CI (Sunday) or manually before hardening a test suite
Markdown link checkerpython3 scripts/check-markdown-links.py [file.md ...]Broken relative links and anchors. No args = scan the whole repoExit 1 prints each broken link as file: linkAfter moving or renaming docs or skills
Lint-suppression guardpython3 scripts/check_noqa.py <files...>Inline lint/type suppressions that lack a stated reason"BLOCKED" plus a hit list. Fix the issue, or append a reason after the suppression markerPre-commit runs it on changed files
Docstring qualitypython3 scripts/check_docstring_quality.py <files.py...>Docstrings that merely restate the function nameEach hit says "delete it or add information". Do exactly thatPre-commit runs it on changed Python files
JSON-utils driftbash scripts/shared/check-json-utils-drift.shVendored JSON helper copies in plugin hooks vs the canonical scripts/shared/json_utils.sh"OK: all vendored JSON utilities match canonical." Anything else names the drifted copyAfter editing json_utils.sh or any inlined copy
Export statspython3 scripts/clawhub_export.py --statsSkill counts per plugin and top-20 membership for cross-framework exportTotals line plus a per-plugin tableBefore cross-framework publishing
Framework detectpython3 scripts/framework_detect.py [--json]Which agent-framework capabilities the current directory exposes (skills, agents, hooks, commands, mcp, a2a)[+]/[-] capability checklistWhen debugging cross-framework export targets

Interpretation notes

  • context_optimizer stats prints nothing in the default text format. This is a verified quirk: stats on a directory with no --format flag produces empty output and exit 0. Always pass --format json (clean JSON) rather than --format table, which dumps a raw Python dict.
  • Ratchet failures name the new violations. A ratchet that fails after your change means your change added debt. Fix the new ref or add the missing section. Never raise a baseline number to make a check pass, with one documented exception: a brand-new library skill legitimately starts uncalled, and scripts/check_skill_graph_drift.py itself (plus the _comment in scripts/skill_graph_baseline.json) instructs you to raise max_uncalled_libraries to record the 30-day consumer grace period that .claude/rules/shared-utility-consumer-rule.md grants (the rule grants the grace period; the script defines the baseline mechanics). night-market-architecture-contract records the same exception in its ratchet invariants.
  • Mutation exit codes are the contract. CI (.github/workflows/mutation-testing.yml) treats exit 0 and exit 2 as success and posts survivors to the step summary. Only exits other than 0 and 2 fail the workflow. So a green mutation run does NOT mean zero survivors. Read the report.
  • check_pinned_versions needs network access. It queries GitHub for latest releases. Offline, expect failures that are environmental, not real findings.

Health snapshot in one command

scripts/health-snapshot.sh (in this skill directory) runs the six cheap checks and prints a PASS/FAIL table. It is read-only, needs only bash and python3, requires no network, and completes in about 6 seconds (measured 2026-07-02).

bash .claude/skills/night-market-diagnostics-toolkit/scripts/health-snapshot.sh

It runs: plugin structure validation (all plugins), capabilities sync, supply-chain scan, both drift ratchets, and the description budget. Exit 0 means all six passed. Exit 1 means at least one failed, and the failing check's full output is printed to stderr above the table. Run it at session start, before a PR, and after any bulk skill edit.

Blocking vs advisory

Which failures stop a merge and which are signals:

CheckGateEffect on failure
validate_plugin.pypre-commit (19 hook entries)Blocks commit
Skill-graph drift ratchetpre-commitBlocks commit
Exit-criteria drift ratchetpre-commitBlocks commit
check_noqa.pypre-commitBlocks commit
check_docstring_quality.pypre-commitBlocks commit
check-markdown-links.pypre-commitBlocks commit
validate_budget.pypre-commitBlocks commit
check-json-utils-drift.shpre-commitBlocks commit
check_pinned_versions.pypre-commitBlocks commit
capabilities-sync-check.shpre-commit and CI (capabilities-sync.yml)Blocks commit and PR
Mutation testingCI (weekly and manual dispatch)Advisory: survivors reported, workflow stays green
supply_chain_scan.pymanual / make supply-chain-scan (not wired to CI)Advisory day-to-day, treat as blocking before any release
context_optimizer, skrills analyze, clawhub stats, framework_detectmanualAdvisory: measurement only

The dimension-level policy lives in .claude/quality_gates.json: enforce_blocking is true with max_critical_issues: 3, and only the security dimension sets block_on_violation: true. The performance (20KB / 5,000-token file limits, 60-line functions, complexity under 12), maintainability (debt ratio under 0.3, nesting under 5), and compliance dimensions are advisory (block_on_violation: false). So: security findings block, size/complexity findings warn.

When NOT to use

  • Running the test suite, lint, typecheck, or a release: use night-market-operations (command anatomy and artifacts).
  • You already have a failure and need symptom-to-cause triage: use night-market-debugging-playbook.
  • You need the meaning and default of a config knob rather than a measurement: use night-market-config-catalog.
  • You are deciding whether evidence is sufficient to claim work complete: use night-market-validation-and-qa.

Exit Criteria

  • bash .claude/skills/night-market-diagnostics-toolkit/scripts/health-snapshot.sh runs from the repo root, prints a six-row PASS/FAIL table, and exits 0 when all checks pass and 1 when any fails.
  • Every invocation in the tool table is copy-pasteable from the repo root and executes without a usage error.
  • A reader who has only this file can state the ratchet contract: baseline freezes existing debt, new violations fail, shrinking the baseline locks in wins.
  • The blocking/advisory table matches .pre-commit-config.yaml entries and the block_on_violation flags in .claude/quality_gates.json.
  • Mutation exit-code semantics (0 clean, 2 survivors tolerated, anything else is a crash) match .github/workflows/mutation-testing.yml.

Provenance and maintenance

Compiled 2026-07-02 against repo v1.9.15 on branch discussions-fix-1.9.14. Volatile numbers observed that day: 197 skills, 134 commands, 56 agents registered; description budget 73,135 of 90,000 chars used (81.3%); ratchet live counts 5 dangling refs (baseline 31), 7 uncalled libraries (baseline 8), 1 missing Exit Criteria (baseline 127); 13 version pins current with bandit intentionally held at 1.8.6.

Re-verification one-liners:

# Baselines and live ratchet counts
python3 scripts/check_skill_graph_drift.py; python3 scripts/check_skill_exit_criteria_drift.py

# Registration counts and budget usage
bash scripts/capabilities-sync-check.sh | tail -3; python3 plugins/abstract/scripts/validate_budget.py | tail -3

# Pre-commit wiring of the blocking table
rg -n "check_skill_graph_drift|check_noqa|validate_budget|check_pinned_versions" .pre-commit-config.yaml

# Mutation exit-code contract
rg -n "exit_code" .github/workflows/mutation-testing.yml

# Gate dimension block flags
python3 -c "import json;print(json.load(open('.claude/quality_gates.json')))"

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.