본문으로 건너뛰기
cccskills
무료GitHub에 공개

stale-module-pruner

Ripgrep-powered dead-code crawler that finds stale, broken, or orphaned JavaScript/CJS/MJS modules in the Agent Studio framework. Walks a target directory, checks each file for external references, and surfaces (or deletes) unreferenced files. Prevents registry bloat and silent tool dropouts from modules no one calls.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(10)

  • SKILL.md7.2 KB
  • commands/stale-module-pruner.md119 B
  • hooks/post-execute.cjs316 B
  • hooks/pre-execute.cjs433 B
  • references/research-requirements.md292 B
  • rules/stale-module-pruner.md290 B
  • schemas/input.schema.json1.0 KB
  • schemas/output.schema.json636 B
  • scripts/main.cjs3.9 KB
  • templates/implementation-template.md193 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Stale Module Pruner

Overview

Ripgrep-powered dead-code crawler for the Agent Studio framework. Walks a target directory (default: .claude/lib), then for each .js/.cjs/.mjs file checks whether its module name appears in any other file across the codebase. Files with no external references are flagged as STALE and optionally deleted.

Core principle: Dead modules that stay in .claude/lib/ create false positive references in the ecosystem scanner, inflate the registry, and mislead other tools about what capabilities are actually active. Regular pruning keeps the framework lean and the scanner signal clean.

When to Invoke

Skill({ skill: 'stale-module-pruner' });

Invoke when:

  • Post-archival cleanup: after moving modules to _archive/, run pruner on lib/
  • After bulk refactors that relocated or merged modules
  • Before running validate-ecosystem-integrity.cjs to reduce noise
  • As part of a maintenance sprint

Mandatory Skills

SkillPurposeWhen
task-management-protocolTrack pruning progressAlways
ripgrepSearch for module referencesDuring scan
code-semantic-searchVerify intent when uncertainOn ambiguous hits
context-compressorCompress large result setsWhen output is large
verification-before-completionGate completionBefore marking done
memory-searchCheck prior pruning patternsAt start

Iron Laws

  1. Always dry-run first. Run without --delete and save the STALE list before any destructive pass. Never delete files on a first invocation without reviewing the candidates. One false positive can remove an actively-used module.

  2. Never rely on filename alone. The pruner matches by module name (filename without extension). Files named utils.cjs may be legitimately unreferenced by that exact name but still used via a barrel import or index re-export. Verify ambiguous hits against barrel/index files before treating as truly stale.

  3. Always check test files. A module may have zero production references but an active test. The pruner skips .json and .md matches but not test .cjs files. If the only reference is in a test, the module may still be needed.

  4. Never delete archived modules as stale. Modules in _archive/ or _archive/dead/ are already archived — the pruner skips _archive/ dirs by default. Do not point --targetDir at an archive path.

  5. Always save the prune report before completing. Write findings to .claude/context/reports/qa/stale-module-prune-{ISO-date}.md before marking the task complete.

Anti-Patterns

Anti-PatternRiskCorrect Approach
Running with --delete on first invocationDestroys modules with barrel/index re-exportsAlways dry-run first, review candidates, then delete
Treating zero-reference as definitive staleBarrel imports and test-only references create false staleVerify each STALE candidate against index files + tests
Running from a non-project-root CWDAll path resolution breaks; misleading outputAlways run from project root (process.cwd())
Pointing --targetDir at .claude/lib onlyMisses stale modules in scripts/ or tools/Run separate passes with different --targetDir values
Deleting without a prune report artifactNo audit trail; next session can't identify what was lostAlways save report before deletion

Step 1: Dry-Run Scan

# Default: scan .claude/lib for stale CJS/MJS/JS modules (dry-run)
node .claude/skills/stale-module-pruner/scripts/main.cjs

# Scan a different target directory
node .claude/skills/stale-module-pruner/scripts/main.cjs --targetDir .claude/tools/cli

# Scan with custom search scope
node .claude/skills/stale-module-pruner/scripts/main.cjs --targetDir .claude/lib \
  --searchDirs .claude,tests,scripts,package.json

The script outputs one line per stale module:

STALE: .claude/lib/utils/old-helper.cjs
STALE: .claude/lib/routing/deprecated-matcher.cjs

Total stale items processed: 2

Step 2: Review Candidates

For each STALE: line:

  1. Open the file — understand its purpose
  2. Search for indirect references: barrel imports, require('./'), index.cjs re-exports
  3. Check test files: grep -r "{filename}" tests/
  4. Confirm it is genuinely unused before approving for deletion

Create a prune report at .claude/context/reports/qa/stale-module-prune-{ISO-date}.md:

# Stale Module Prune Report

<!-- Agent: developer | Task: #{id} | Session: {date} -->

**Date:** YYYY-MM-DD
**Target:** .claude/lib
**Candidates:** N

## Confirmed Stale (delete)

- .claude/lib/utils/old-helper.cjs — no references, no tests, no barrel export

## Kept (false positive)

- .claude/lib/utils/common.cjs — referenced by index.cjs barrel (not caught by name match)

Step 3: Delete Pass (Conditional)

Only after the prune report is reviewed and candidates confirmed:

node .claude/skills/stale-module-pruner/scripts/main.cjs \
  --targetDir .claude/lib --delete

After deletion, re-run validate-ecosystem-integrity.cjs to confirm no new [PHANTOM_REQUIRE] errors were introduced.

Memory Protocol (MANDATORY)

Before starting:

cat .claude/context/memory/learnings.md
cat .claude/context/memory/issues.md

Review prior pruning patterns and known barrel-import false positives.

After completing:

  • Pruning pattern → .claude/context/memory/learnings.md
  • False positive suppression decision → .claude/context/memory/decisions.md
  • Unresolved stale candidate needing owner review → .claude/context/memory/issues.md

Assume interruption: If the prune report isn't saved to disk, it didn't happen.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Ensure accessibility in UI components including semantic HTML, ARIA attributes, keyboard navigation, and WCAG 2.2 AA compliance.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

oimiragieo/agent-studio422026년 7월 14일 업데이트

Use when you want to improve response quality through meta-cognitive reasoning. Applies 15+ reasoning methods to reconsider and refine initial outputs.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

oimiragieo/agent-studio422026년 7월 14일 업데이트

N-round opposing-stance debates for trade-off analysis. Assigns pro/con roles to agents, runs structured debate rounds with quality scoring, and produces a moderator synthesis with confidence-rated recommendation. Generalizable to architecture, technology, security, and design decisions.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

oimiragieo/agent-studio422026년 7월 14일 업데이트

Force adversarial code review stance that eliminates confirmation bias — reviewer must find issues or re-analyze

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

oimiragieo/agent-studio422026년 7월 14일 업데이트

Creates specialized AI agents on-demand when no existing agent matches a request. Use when the Router cannot find a suitable agent for a task. Enables self-evolution by generating persistent agents.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

oimiragieo/agent-studio422026년 7월 14일 업데이트

LLM-as-judge evaluation framework with 5-dimension rubric (accuracy, groundedness, coherence, completeness, helpfulness) for scoring AI-generated content quality with weighted composite scores and evidence citations

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

oimiragieo/agent-studio422026년 7월 14일 업데이트

oimiragieo의 스킬 모두 보기

이 스킬의 문제 신고