Agent skill

Nextclaw Dead Code Governance

by Peiiii in Peiiii/nextclaw

当用户要求扫描、识别、清理、常态化治理 NextClaw 仓库里的死代码、无用代码、unused files、unused exports、unused dependencies,尤其是核心包越来越臃肿、想删旧实现或做定期减债时使用。

MITAuto-check passed

Install Nextclaw Dead Code Governance

skills CLI
$ npx skills add Peiiii/nextclaw --skill nextclaw-dead-code-governance -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Peiiii/nextclaw nextclaw-dead-code-governance --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Peiiii/nextclaw.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/wiki/skills/operations/nextclaw-dead-code-governance .claude/skills/nextclaw-dead-code-governance && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
nextclaw-dead-code-governance
GitHub stars
260
Token cost
~974 tokens
SKILL.md length
196 words
Files
1
Skills in repo
70
Repo updated
First seen
Licence
MIT

At a glance

当用户要求扫描、识别、清理、常态化治理 NextClaw 仓库里的死代码、无用代码、unused files、unused exports、unused dependencies,尤其是核心包越来越臃肿、想删旧实现或做定期减债时使用。

  • Works in 4 steps: 先读上下文 → 只读扫描 → 降噪过滤 → …
  • SKILL.md covers 目标, 使用前提, 核心判断 and 扫描流程, plus 5 more sections
  • Calls pnpm, rg and node

What it does

Nextclaw Dead Code Governance is an agent skill from Peiiii/nextclaw. 当用户要求扫描、识别、清理、常态化治理 NextClaw 仓库里的死代码、无用代码、unused files、unused exports、unused dependencies,尤其是核心包越来越臃肿、想删旧实现或做定期减债时使用。

Its SKILL.md is about 970 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: A human-centered long-term AI partner—not a task-centered assistant. The licence is MIT.

Example prompts

  • “/nextclaw-dead-code-governance”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. 先读上下文
  2. 只读扫描
  3. 降噪过滤
  4. 反查证据

What it can do on your machine

Read from SKILL.md and the folder at commit 297cf0e. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pnpm
    • rg
    • node
    • git

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use pnpm and git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Nextclaw Dead Code Governance loads about 974 tokens when it runs. Until then it costs about 37 tokens; SKILL.md has 196 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~37
When it runs · the whole SKILL.md, loaded when a task matches
~974

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Peiiii/nextclaw at commit 297cf0e, republished under its MIT licence (© Peiiii). 196 words, ~974 tokens.

Download SKILL.mdSave it as .claude/skills/nextclaw-dead-code-governance/SKILL.md (or your agent's skills folder).
name
nextclaw-dead-code-governance
description
当用户要求扫描、识别、清理、常态化治理 NextClaw 仓库里的死代码、无用代码、unused files、unused exports、unused dependencies,尤其是核心包越来越臃肿、想删旧实现或做定期减债时使用。

NextClaw 死代码治理

目标

把“感觉项目越来越臃肿”变成可重复、低误删风险的清理流程。

这个 skill 只负责死代码治理:找出并删除无引用、重复、过期、被新路径替代的代码。它不负责一般性能优化、功能重构或目录治理战役;若任务扩大到长期自治推进,再联动 autonomous-maintainability-campaign。

使用前提

本 skill 命中后拥有本次死代码扫描、删除与实现结果,不拥有阶段切换;完成当前 slice 后返回生命周期,由 Validation、Review、Delivery 和 Retrospective 各自处理后续合同。长期自治战役、迭代留痕或规则修改只有条件实际成立时才加载对应 owner,不重新加载上游 lifecycle。

核心判断

死代码候选分三类:

  1. 确定可删:生产代码无引用、无 package exports、无 bin/脚本入口、无动态注册、无文档要求保留,且已有替代路径或本身无行为价值。
  2. 疑似可删:机器扫不到引用,但可能是公共 API、插件入口、协议类型、测试入口、构建资源、CLI/bin、动态 import 或外部包消费表面。
  3. 暂不删除:NCP 协议类型、SDK/export 表面、runtime/plugin 注册点、CLI/bin 入口、构建产物、资源文件、测试入口噪声、兼容迁移仍需要的旧路径。

默认只删除 确定可删。疑似可删 先列入报告或下一批验证,不在同一刀里硬删。

扫描流程

1. 先读上下文

先确认:

  • 用户要的是只读审计,还是直接清理。
  • 作用域是全仓库、核心包,还是某个 package。
  • 当前工作区是否已有无关改动:git status --short。

核心包优先级通常是:

  • packages/nextclaw
  • packages/nextclaw-core
  • packages/nextclaw-runtime
  • packages/nextclaw-app-runtime
  • packages/nextclaw-server
  • packages/ncp-packages/*
  • packages/nextclaw-ui
2. 只读扫描

优先使用仓库已有信号:

bash
pnpm metrics:local
pnpm lint:maintainability:hotspots

再用 knip 扫死代码,按作用域收窄:

bash
pnpm dlx knip --workspace <package-or-path> --include files,exports,dependencies --reporter compact --no-exit-code --max-show-issues 200

对生产路径可补:

bash
pnpm dlx knip --production --workspace <package-or-path> --include files,exports,dependencies --reporter compact --no-exit-code --max-show-issues 200

对局部未用符号可补:

bash
pnpm -C <package> exec tsc -p tsconfig.json --noEmit --noUnusedLocals --noUnusedParameters
3. 降噪过滤

knip 常见误报必须先过滤:

  • *.test.*、tests/:多半是测试入口未配置,不等于可删。
  • ui-dist/、dist/、public/sw.js、资源目录:可能是构建或发布资源。
  • package exports 指向的类型和入口:可能被外部用户消费。
  • CLI bin、scripts、worker entry、dynamic import、plugin manifest、runtime registry:不能只看静态 import。
  • index.ts barrel 暴露的公共类型:先判断是否属于 API surface,再决定是否收窄导出。
4. 反查证据

删除前必须至少做一次源码反查:

bash
rg -n "<symbol-or-file-stem>" packages scripts apps docs -g '!**/dist/**' -g '!**/ui-dist/**' -g '!**/node_modules/**'

同时检查:

  • package.json 的 exports、bin、files、scripts
  • tsconfig.json path alias
  • 相关 index.ts barrel
  • docs/logs 中是否只是历史记录,历史记录不能单独证明代码仍需保留

删除策略

优先顺序:

  1. 重复实现:保留已有 canonical owner,删除旧复制品。
  2. 无引用生产文件:确认没有入口或动态加载后删除。
  3. 未使用 helper / 局部函数:直接删,避免为了修 lint 做空包装。
  4. 旧 UI 组件 / 旧 hook:只有测试引用而生产无引用时,连同对应孤立测试一起评估。
  5. unused dependency:最后处理;先确认源码、脚本、构建、peer/发布合同都不用。

每一刀要小,默认只做同一责任链的一组删除。不要把“死代码清理”顺手扩大成架构重构。

不要做的事

  • 不要用 knip --fix 或自动删除文件。
  • 不要删除用户未提交的无关改动。
  • 不要因为机器标 unused 就删除公共 API、协议类型或插件入口。
  • 不要靠压缩格式、缩短命名、折叠空白来满足非功能净减。
  • 不要在同一批里混删多个无关 feature root,除非用户明确要求大规模治理。

验证闭环

触达 TypeScript 源码、类型或导入导出边界时,必须跑:

bash
pnpm -C <package> tsc

源码清理还要跑 package lint:

bash
pnpm -C <package> lint

如果 package lint 或全量治理被无关工作区改动阻塞,改跑当前触达文件的 targeted 版本,并在最终回复说明阻塞来源:

bash
pnpm lint:new-code:governance -- --files <touched-files...>

定向测试优先跑被删除路径的替代 owner 或邻近行为测试:

bash
pnpm -C <package> exec vitest run <relevant-tests...>

收尾必须跑:

bash
node .agents/skills/development-review/scripts/check-maintainability.mjs --non-feature --paths <touched-files...>
pnpm check:governance-backlog-ratchet

删除后可复扫:

bash
pnpm dlx knip --workspace <package-or-path> --include files,exports --reporter compact --no-exit-code --max-show-issues 120

汇报格式

最终汇报必须包含:

  • 删除了什么,以及为什么确认可删。
  • 保留了什么疑似项,以及为什么暂不删。
  • tsc、lint、测试、maintainability guard、governance 的结果。
  • 总代码增减、非测试代码增减。
  • 正向减债动作,通常是 删除 或 简化。
  • 是否新增或更新 docs/logs 迭代记录。
  • 若全量治理被无关改动阻塞,说明 targeted 验证已覆盖本次触达范围。

常态化节奏

常态治理时,每轮只选择一个高置信批次:

  1. 先扫核心包生产 unused files。
  2. 再扫重复实现和旧 owner。
  3. 再收敛 unused exports。
  4. 最后处理 unused dependencies。

每完成一批,记录剩余候选和下一刀建议。若剩余项需要产品/API 兼容判断,停止并向用户报告,不要强行继续。

© Peiiii, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/wiki/skills/operations/nextclaw-dead-code-governance of Peiiii/nextclaw.

Open the folder on GitHubat commit 297cf0e

Compare with similar skills

Nextclaw Dead Code Governance next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Nextclaw Dead Code Governance compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Nextclaw Dead Code Governance this skillPeiiii/nextclaw260—~974Automated safety check: PassMIT
Unused CSSthedaviddias/Front-End-Checklist74k—~415Automated safety check: PassMIT
Board Governancesickn33/agentic-awesome-skills47k1 repos~4.1kAutomated safety check: PassMIT
Agent Governancegithub/awesome-copilot40k2 repos~4.6kAutomated safety check: PassMIT
Dead Dependenciesredis/RedisInsight8.9k—~1.5kAutomated safety check: PassCustom licence
Dead End Pagesthedaviddias/Front-End-Checklist74k—~683Automated safety check: PassMIT

Similar skills

  • Unused CSS

    thedaviddias/Front-End-Checklist

    A skill your agent uses when reviewing stylesheets, component styles, and responsive behavior related to Remove unused CSS rules.

    74k GitHub stars~415 tokensUpdated 3 days ago
    Frontend & DesignAuto-check passed
  • Board Governance

    sickn33/agentic-awesome-skills

    Board and governance register: meeting date, agenda, decision, resolution number, vote result, action owner and due date.

    47k GitHub starsUsed in 1 repo~4.1k tokens
    Auto-check passed
  • Agent Governance

    github/awesome-copilot

    Official

    Patterns and techniques for adding governance, safety, and trust controls to AI agent systems.

    40k GitHub starsUsed in 2 repos~4.6k tokens
    AI & LLM EngineeringAuto-check passed
  • Dead Dependencies

    redis/RedisInsight

    Official

    Find and safely remove unused ("dead") npm dependencies in RedisInsight using a grep + leaf-check + build-gate recipe.

    8.9k GitHub stars~1.5k tokensUpdated 4 days ago
    DatabasesAuto-check passed
  • Dead End Pages

    thedaviddias/Front-End-Checklist

    A skill your agent uses when auditing a site's internal link graph for dead-end pages, suggesting related-content links to add to thin or standalone pages, or reviewing CMS templates that produce…

    74k GitHub stars~683 tokensUpdated 3 days ago
    Data & AnalyticsAuto-check passed
  • Model Registry Governance

    sickn33/agentic-awesome-skills

    Establish model registry standards, governance controls, metadata schemas, approvals, and lifecycle policies for enterprise AI deployments.

    47k GitHub starsUsed in 2 repos~3.9k tokens
    DevOps & CloudAuto-check passed

More from Peiiii/nextclaw

All 70 skills in this repo
  • Nextclaw Skin Studio

    Peiiii/nextclaw

    A skill your agent uses when a user wants to browse, apply, inspect, create, refine, switch, or remove a NextClaw skin; wants a personal skin with arbitrary CSS, JavaScript, images, SVG, DOM…

    260 GitHub stars~1.8k tokensUpdated today
    Auto-check passed
  • A skill your agent uses when a development task needs visible phase tracing, task-level or phase-level Token measurement, model/effort comparison, or a deterministic usage report or local dashboard…

    260 GitHub stars~802 tokensUpdated today
    Auto-check passed
  • 当 NextClaw 产品更新后需要生成、替换、挑毛病或检查官网、GitHub README、用户文档或社交传播中的真实截图、AI 宣传视觉、整页 HTML 宣传预览、社区二维码等对外视觉资产时使用;也用于“更新截图”“重新截一批图”“做宣传页”“生成 campaign 页面”“视觉审稿”“五星挑刺法”或发布前检查视觉资产。普通站点布局开发或只写文章不触发。

    260 GitHub stars~801 tokensUpdated today
    Auto-check passed
  • UI UX Pro Max

    Peiiii/nextclaw

    A skill your agent uses when the user wants professional UI/UX design guidance, design-system generation, UX review, or stack-specific frontend guidance through a bundled local UI/UX Pro Max dataset…

    260 GitHub stars~2k tokensUpdated today
    Auto-check passed
  • Impeccable

    Peiiii/nextclaw

    A skill your agent uses when the user wants distinctive, production-grade frontend design, anti-generic AI aesthetics, UX critique, technical UI audits, or final polish through bundled Impeccable…

    260 GitHub stars~2.5k tokensUpdated today
    Auto-check passed
  • Curate NextClaw skill resources, including OpenClaw and community sources.

    260 GitHub stars~479 tokensUpdated today
    Auto-check passed

Questions about Nextclaw Dead Code Governance

What does Nextclaw Dead Code Governance do?

当用户要求扫描、识别、清理、常态化治理 NextClaw 仓库里的死代码、无用代码、unused files、unused exports、unused dependencies,尤其是核心包越来越臃肿、想删旧实现或做定期减债时使用。. Nextclaw Dead Code Governance is an agent skill from Peiiii/nextclaw.

How do I install Nextclaw Dead Code Governance in Claude Code?

Run `npx skills add Peiiii/nextclaw --skill nextclaw-dead-code-governance -a claude-code`. Or copy the skill folder (.agents/wiki/skills/operations/nextclaw-dead-code-governance in Peiiii/nextclaw) into .claude/skills/nextclaw-dead-code-governance in your project. Claude Code loads it when a task matches its description.

How do I install Nextclaw Dead Code Governance in Codex?

Run `npx skills add Peiiii/nextclaw --skill nextclaw-dead-code-governance -a codex`. Or copy the skill folder (.agents/wiki/skills/operations/nextclaw-dead-code-governance in Peiiii/nextclaw) into .agents/skills/nextclaw-dead-code-governance in your project. Codex loads it when a task matches its description.

Can I use Nextclaw Dead Code Governance in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Peiiii/nextclaw --skill nextclaw-dead-code-governance -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/nextclaw-dead-code-governance, .gemini/skills/nextclaw-dead-code-governance, .github/skills/nextclaw-dead-code-governance and .opencode/skills/nextclaw-dead-code-governance in your project.

What does Nextclaw Dead Code Governance need to run?

Going by SKILL.md and its folder, Nextclaw Dead Code Governance needs the command-line tools its instructions call (pnpm, rg, node and git).

Does Nextclaw Dead Code Governance access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Nextclaw Dead Code Governance safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Nextclaw Dead Code Governance use?

Nextclaw Dead Code Governance is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Nextclaw Dead Code Governance use?

About 974 tokens (SKILL.md is roughly 3.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Nextclaw Dead Code Governance?

Skills that share tags, products or a category with Nextclaw Dead Code Governance: Unused CSS (thedaviddias/Front-End-Checklist, 74k stars), Board Governance (sickn33/agentic-awesome-skills, 47k stars), Agent Governance (github/awesome-copilot, 40k stars) and Dead Dependencies (redis/RedisInsight, 8.9k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Nextclaw Dead Code Governance?

Peiiii (a GitHub user) maintains it in Peiiii/nextclaw, which has 260 GitHub stars. The repository holds 70 skills in this directory. The repository was last updated on October 8, 2026.

Source: Peiiii/nextclaw on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.