script-ecosystem-audit
Skill2 starsChanged 9 months agoApache-2.0View on GitHub
Comprehensive diagnostic of the script infrastructure — 18 categories across 5 domains with composite health scoring, trend tracking, patch suggestions, and interactive finding-by-finding walkthrough. Covers all .js files under scripts/ and their npm registrations for module consistency, safety patterns, reachability, code quality, and testing.
We split this skill into the rules it gives an agent
17 rules. About 0 are common, 12 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈12
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 42
Before a major script refactor or reorganization
- Very specific: line 43
After adding 5+ new scripts to the scripts/ directory
- Distinctive: line 59
Never re-present findings that were already decided.
- Distinctive: line 92
Check if progress file exists and is < 2 hours old
- Distinctive: line 93
If yes: resume — display dashboard from saved data, show "Resuming from finding {n}/{total} ({n-1} reviewed)", continue walkthrough
- Distinctive: line 95
If no (or stale): proceed to Phase 1
- Very specific: line 99
Update currentFindingIndex, append decision, write progress file immediately.
- Distinctive: line 103
Delete progress file. Append results to history JSONL.
- Distinctive: line 109
Run the audit script:
- Distinctive: line 137
After dashboard, show effort estimate: "Found N findings.
- Very specific: line 166
Defer: Create DEBT entry via /add-debt (S1 for errors, S2 for warnings)
- Distinctive: line 183
After reviewing top 20, present remaining by severity: "N remaining: {e} errors, {w} warnings, {i} info.
- Distinctive: line 186
Done when: All findings decided or batch-resolved.
- Very specific: line 213
Run __tests__/ suite to confirm audit integrity:
- Distinctive: line 229
Done when: Before/after comparison presented.
- Distinctive: line 246
Delete progress file (audit complete)
- Very specific: line 274
Comprehensive audit integration: When called by /comprehensive-ecosystem-audit, the script runs with --batch --summary flags and returns …
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- prettier-ignore-start -->Document Version: 2.0 Last Updated: 2026-03-08 Status: ACTIVE
<!-- prettier-ignore-end -->Script Ecosystem Audit
Deep diagnostic of scripts/**/*.js infrastructure — shared libraries, npm
script registrations, and cross-script dependencies. Produces per-category
scores, a composite health grade (A-F), trend tracking across runs, and an
interactive walkthrough with patch suggestions.
Scope: scripts/**/*.js only. Skill-local scripts
(.claude/skills/*/scripts/) are owned by /skill-ecosystem-audit.
Invocation: /script-ecosystem-audit or /script-ecosystem-audit --summary
Routing Guide
| Task | Use |
| Script infrastructure health | /script-ecosystem-audit |
| Hook internals | /hook-ecosystem-audit |
| Skill quality & skill-local scripts | /skill-ecosystem-audit |
| General code review | /audit-code |
| All ecosystem audits at once | /comprehensive-ecosystem-audit |
When to Use
- User explicitly invokes
/script-ecosystem-audit - Before a major script refactor or reorganization
- After adding 5+ new scripts to the
scripts/directory - As part of
/comprehensive-ecosystem-audit(called automatically)
When NOT to Use
- Auditing hook internals — use
/hook-ecosystem-audit - Auditing individual skill quality — use
/skill-audit - General code review — use
/audit-code - Quick structural check of skills — use
npm run skills:validate
CRITICAL RULES (MUST — Read First)
- CHECK for saved progress first (MUST) — resume from
.claude/tmp/script-audit-progress.jsonif it exists and is < 2 hours old. Never re-present findings that were already decided. - ALWAYS run the script first (MUST) — never generate findings without data
- ALWAYS display the dashboard (MUST) before starting the walkthrough
- Present findings via conversational Q&A (MUST) — collect decisions through normal conversation. NEVER use AskUserQuestion.
- SAVE progress after every decision (MUST) — write updated state to progress file immediately
- Show patch suggestions inline (SHOULD) with each patchable finding
- Include a recommendation with rationale (MUST) per finding
- Create TDMS entries (SHOULD) for deferred findings via
/add-debt
Arguments & Modes
| Flag | Description |
| (none) | Full audit with JSON output + interactive walkthrough |
--summary | Compact score-only output, no walkthrough |
--check | Quick pass/fail (exit code 0 if no errors, 1 if any) |
--batch | Suppress state writes (for iterative fixing) |
--save-baseline | Save current scores as regression baseline |
Compaction Guard
Path: .claude/tmp/script-audit-progress.json
Read
REFERENCE.mdfor progress file schema.
On Skill Start (MUST — Before Phase 1)
- Check if progress file exists and is < 2 hours old
- If yes: resume — display dashboard from saved data, show "Resuming from finding {n}/{total} ({n-1} reviewed)", continue walkthrough
- If no (or stale): proceed to Phase 1
After Each Decision (MUST — During Phase 3)
Update currentFindingIndex, append decision, write progress file immediately.
On Completion
Delete progress file. Append results to history JSONL.
Phase 1: Run & Parse
- Run the audit script:
node .claude/skills/script-ecosystem-audit/scripts/run-script-ecosystem-audit.js - If script fails (MUST handle): display error, suggest checking
node --versionand module dependencies. Do NOT proceed with empty data. - Parse v2 JSON output from stdout (progress goes to stderr)
- Create session log:
.claude/tmp/script-audit-session-{YYYY-MM-DD-HHMM}.jsonl - Save initial progress state with
currentFindingIndex: 0
Read
REFERENCE.mdfor v2 JSON output schema and session log JSONL schema.
Done when: Progress file written with score, grade, and findings data.
Phase 2: Dashboard Overview
MUST display the dashboard before starting walkthrough.
Read
REFERENCE.mdfor dashboard template.
Present compact header with composite grade, domain breakdown, category scores.
If 0 findings (MUST handle): display score, skip Phase 3, go directly to Phase 4. "No findings — script infrastructure is clean."
After dashboard, show effort estimate: "Found N findings. Estimated review time: ~{N×0.3} min full, ~{top20×0.3} min top-20 only."
If >50 findings (MUST): "50+ findings detected. Review top 20 by impact, then batch-decide the rest? [Y/review all]"
Done when: Dashboard displayed, user confirms walkthrough approach.
Phase 3: Finding-by-Finding Walkthrough
MUST use conversational Q&A — NOT AskUserQuestion. MUST save progress after every decision.
Sort findings by impactScore descending. Present each with a context card:
Read
REFERENCE.mdfor finding card template.
Each finding MUST include a recommended action with brief rationale.
Decision Options
ERROR findings: Fix Now | Defer (→ DEBT entry) WARNING findings: Fix Now | Defer | Skip INFO findings: Acknowledge | Defer
Decision Handling
- Fix Now: Apply patch if available, provide guidance if not
- Defer: Create DEBT entry via
/add-debt(S1 for errors, S2 for warnings) - Skip/Acknowledge: Log to session file
After Each Decision
Show running tally: "Progress: {n}/{total} | Fixed: {f} | Deferred: {d} | Skipped: {s}"
Delegation Protocol (MUST support)
- "you decide" → accept all recommendations
- "skip remaining INFO" → batch-skip all remaining INFO findings
- "fix all patchable" → apply all remaining patches without individual review
- "defer the rest" → defer all remaining findings as DEBT entries
Batch Management (MUST for >20 findings after top-20)
After reviewing top 20, present remaining by severity: "N remaining: {e} errors, {w} warnings, {i} info. Review all / Warnings+ only / Skip to summary?"
Done when: All findings decided or batch-resolved.
Phase 4: Summary, Trend & Actions
Present unified summary with trend data (if previous runs exist):
Read
REFERENCE.mdfor summary template.
Include:
- Decision breakdown (fixed/deferred/skipped counts)
- Patches applied count
- Top 3 impact areas
- Trend data (SHOULD) — if history JSONL has entries, show direction + delta per category. Flag categories poor across 2+ consecutive runs: "{category} has been {rating} for {N} consecutive runs."
- Artifact list (MUST): session log path, DEBT entries created, files patched, history updated
Done when: Summary presented to user.
Phase 5: Self-Audit Verification
Run __tests__/ suite to confirm audit integrity:
node --test .claude/skills/script-ecosystem-audit/scripts/__tests__/*.test.jsRe-run the audit script and compare:
node .claude/skills/script-ecosystem-audit/scripts/run-script-ecosystem-audit.jsRead
REFERENCE.mdfor self-audit template.
Present before/after comparison. If score didn't improve, investigate why.
Done when: Before/after comparison presented.
Phase 6: Learning Loop & Closure (MUST)
- Auto-learnings (MUST): Generate 2-3 data-driven insights from audit
results. E.g., "Top regressing category: X. Most-fixed category: Y. Recurring
issue: Z poor for N consecutive runs." Save to history JSONL
learningsfield. - Optional user feedback (SHOULD): "Any additional observations or patterns
the checkers should learn?" Accept empty / "none" to proceed. If provided,
save to history JSONL
feedbackfield. - Invocation tracking (MUST):
cd scripts/reviews && npx tsx write-invocation.ts --data '{"skill":"script-ecosystem-audit","type":"skill","success":true,"schema_version":1,"completeness":"stub","origin":{"type":"manual"},"context":{}}' - Delete progress file (audit complete)
On next startup (MUST): If history JSONL has entries, surface previous auto-learnings and user feedback: "Previous run noted: [learnings]. User feedback: [if any]."
Done when: Learnings generated, invocation logged, progress file deleted.
Guard Rails
- Script failure: Display error + diagnostics, do not proceed with empty data
- Empty results: Skip walkthrough, show clean score
- Pause/resume: User says "pause" → save state, print progress, exit.
Resume:
/script-ecosystem-auditreads progress file and continues. - Circuit breaker: >50 findings → offer top-20 review + batch
- Session log retention: Ephemeral in
.claude/tmp/, not archived by/session-end. Retained for current session only.
Integration
Neighbors: /hook-ecosystem-audit (hooks), /comprehensive-ecosystem-audit
(orchestrator), /skill-ecosystem-audit (skill scripts), /add-debt (TDMS)
Comprehensive audit integration: When called by
/comprehensive-ecosystem-audit, the script runs with --batch --summary flags
and returns JSON to stdout. The orchestrator expects:
{ grade, score, errors, warnings, info, patches, domains }.
Artifact Contracts:
| Artifact | Producer | Consumer | Lifetime |
| Progress file | This skill | This skill (resume) | Ephemeral — deleted on completion |
| Session log | This skill | Current session only | Ephemeral |
| History JSONL | Audit script | This skill (trends) | Persistent — append-only |
| DEBT entries | This skill via /add-debt | TDMS pipeline | Persistent |
Category checks enforce patterns from CLAUDE.md Section 5 (Critical Anti-Patterns). See CLAUDE.md for canonical definitions.
Version History
| Version | Date | Description |
| 2.0 | 2026-03-08 | Skill audit v2: 39 decisions, REFERENCE.md extraction, UX fix |
| 1.0 | 2026-02-24 | Initial implementation |
In this repository81 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- llms.txtllms.txt
- find-skillsSkill
- add-debtSkill
- alertsSkill
- analyzeSkill
- artifacts-builderSkill
- audit-agent-qualitySkill
- audit-aggregatorSkill
- audit-ai-optimizationSkill
- audit-codeSkill
- audit-comprehensiveSkill
- audit-documentationSkill
- audit-engineering-productivitySkill
- audit-enhancementsSkill
- audit-healthSkill
- audit-performanceSkill
- audit-processSkill
- audit-refactoringSkill
- audit-securitySkill
- brainstormSkill
- checkpointSkill
- code-reviewerSkill
- comprehensive-ecosystem-auditSkill
- content-research-writerSkill
- convergence-loopSkill
- create-auditSkill
- data-effectiveness-auditSkill
- debt-runnerSkill
- decrypt-secretsSkill
- deep-planSkill
- deep-researchSkill
- developer-growth-analysisSkill
- doc-ecosystem-auditSkill
- doc-optimizerSkill
- docs-maintainSkill
- document-analysisSkill
- ecosystem-healthSkill
- Excel AnalysisSkill
- find-skillsSkill
- frontend-designSkill
- gh-fix-ciSkill
- github-healthSkill
- health-ecosystem-auditSkill
- hook-ecosystem-auditSkill
- market-research-reportsSkill
- mcp-builderSkill
- media-analysisSkill
- multi-ai-auditSkill
- pre-commit-fixerSkill
- pr-ecosystem-auditSkill
- pr-retroSkill
- pr-reviewSkill
- quick-fixSkill
- recallSkill
- repo-analysisSkill
- repo-synthesisSkill
- session-beginSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

