Agent Skillszai-org/ZCode › dep-refs

dep-refs

GitHub

通过 pnpm dep:refs 分析 TypeScript 导出引用,辅助重构时确认符号使用情况、查找未导出项及验证删除安全性。

.agents/skills/dep-refs/SKILL.md zai-org/ZCode

Trigger Scenarios

重构代码前检查符号引用 验证导出是否被使用以决定删除 列出文件所有导出项

Install

npx skills add zai-org/ZCode --skill dep-refs -g -y
More Options

Non-standard path

npx skills add https://github.com/zai-org/ZCode/tree/main/.agents/skills/dep-refs -g -y

Use without installing

npx skills use zai-org/ZCode@dep-refs

指定 Agent (Claude Code)

npx skills add zai-org/ZCode --skill dep-refs -a claude-code -g -y

安装 repo 全部 skill

npx skills add zai-org/ZCode --all -g -y

预览 repo 内 skill

npx skills add zai-org/ZCode --list

SKILL.md

Frontmatter
{
    "name": "dep-refs",
    "description": "Use when needs to inspect TypeScript export references in the z-code workspace, list exports from a file, verify whether an export is unused before deletion, investigate who imports a symbol during refactors, or combine pnpm knip unused-export results with pnpm dep:refs symbol-level reference tracing.",
    "disable-model-invocation": true
}

Dep Refs

Use the repository's pnpm dep:refs CLI to answer symbol-level questions before changing or deleting TypeScript exports. Run commands from the z-code repository root.

Workflow

Start broad when deleting code:

pnpm knip

Use knip to find likely unused exports, then inspect any risky or unclear export with dep:refs:

pnpm dep:refs packages/shared/src/remoteTarget.ts:stripRemoteTargetSecrets

List all exports in a file when the exact symbol name is unknown:

pnpm dep:refs --list-exports packages/shared/src/remoteTarget.ts

Use scoped scans for fast exploration only when the scope is intentionally limited:

pnpm dep:refs --scope packages/services packages/shared/src/remoteTarget.ts:stripRemoteTargetSecrets

Before claiming an export is safe to delete, prefer an unscoped dep:refs run so cross-package callers are not missed.

JSON Mode

Use silent pnpm mode for machine-readable output, because normal pnpm output includes extra banner lines:

pnpm -s dep:refs packages/shared/src/remoteTarget.ts:stripRemoteTargetSecrets --json | jq .

Use JSON when summarizing many symbols, feeding results to jq, or comparing references and reExports counts programmatically.

Interpreting Results

Treat References (0) and Re-exports (0) as "no static references found", not as proof that no dynamic usage exists. The script does not detect dynamic import() paths or string-based references.

If a symbol only appears under Re-exports, trace the outward barrel path before deleting. A re-export can still be part of the public surface even when there are no direct internal imports.

For refactors, report concrete callers with file and line from the CLI output, then decide whether to update callers, preserve the export, or delete it.

Version History

  • 872ad96 Current 2026-09-21 23:46

Same Skill Collection

.agents/skills/agent-browser/SKILL.md
.agents/skills/ai-elements/SKILL.md
.agents/skills/architecture-governance/SKILL.md
.agents/skills/dogfood/SKILL.md
.agents/skills/feature-boundary-planner/SKILL.md
.agents/skills/react-best-practices/SKILL.md
.agents/skills/electron/SKILL.md

Metadata

Files
0
Version
872ad96
Hash
c6744b04
Indexed
2026-09-21 23:46

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-22 00:22
浙ICP备14020137号-1