Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计提醒

dry-consolidation干固结

Agent Skill

dry-consolidation 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,551

周安装

64

GitHub Stars

28

下载量

507
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:dry-consolidation(干固结)
来源仓库:https://github.com/laurigates/claude-plugins
仓库路径:skills/dry-consolidation
安装命令:
npx skills add https://github.com/laurigates/claude-plugins --skill dry-consolidation
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/laurigates/claude-plugins --skill dry-consolidation

简介

该技能系统化提取重复代码为共享抽象,提供可测试的重构方案。

  • 适用于多文件重复代码块和组件间公共逻辑提取。
  • 包含 shell 命令执行能力,可直接修改代码结构。
  • 安装需从 GitHub 仓库获取,使用前应仔细审查将要执行的 shell 命令。
  • 涉及生产代码修改时,应先在测试环境验证重构结果,确保功能不受影响。

SKILL.md

DRY Consolidation

Systematic extraction of duplicated code into shared, tested abstractions.

When to Use This Skill

Use this skill when...Use these instead when...
Multiple files have identical/near-identical code blocksSingle file needs cleanup → /code:refactor
Copy-pasted utility functions across componentsLooking for anti-patterns without fixing → /code:antipatterns
Repeated UI patterns (dialogs, pagination, error states)Functional refactoring of a file or directory → /code:refactor
Duplicated hooks or state management boilerplateStructural code search only → ast-grep-search
Import blocks are bloated from repeated inline patternsLinting/formatting issues → /lint:check

Context

  • Target path:!echo "$1"
  • Project type:!find. -maxdepth 1 \(-name "package.json" -o -name "Cargo.toml" -o -name "pyproject.toml" -o -name "go.mod" \)
  • Source directories:!find. -maxdepth 1 -type d \(-name "src" -o -name "lib" -o -name "app" -o -name "components" -o -name "packages" \)
  • Test framework:!find. -maxdepth 2 \(-name "vitest.config.*" -o -name "jest.config.*" -o -name "pytest.ini" -o -name "conftest.py" \)
  • Existing shared utilities:!find. \(-path "*/lib/*" -o -path "*/utils/*" -o -path "*/shared/*" -o -path "*/common/*" -o -path "*/hooks/*" \) -type f -print -quit

Parameters

  • $1: Path or directory to scan (defaults to src/)
  • --scope: Focus on a specific extraction type: utilities, components, hooks, or all (default: all)
  • --dry-run: Analyze and report duplications without making changes

Execution

Execute this 7-step consolidation workflow. Use TodoWrite to track each extraction as a separate task.

Step 1: Scan for duplicated patterns

Scan the target path for duplicated patterns. Search for these duplication signals:

Identical function bodies:

Grep for function/method signatures that appear in multiple files.
Look for identical multi-line blocks (3+ lines) across files.

Repeated inline patterns:

  • Utility functions defined identically in multiple files (string truncation, date formatting, validation)
  • Identical error handling blocks (try/catch patterns, error state JSX)
  • Copy-pasted UI fragments (pagination controls, confirmation dialogs, loading states)
  • Repeated hook/state management patterns (delete confirmation + mutation + handler)
  • Duplicated import blocks that signal repeated inline implementations

Search strategy:

  1. Use Grep to find repeated function names, variable patterns, and import clusters
  2. Use Glob to identify files with similar structure (e.g., all *List.tsx, all *Detail.tsx)
  3. Read candidate files to confirm duplication and measure scope

Step 2: Classify duplications

Group discovered duplications into extraction categories:

CategoryExtract IntoLocation Convention
UtilitiesPure functionssrc/lib/utils/ or src/utils/
ComponentsShared UI componentssrc/components/ui/ or src/components/shared/
HooksCustom React/Vue hookssrc/hooks/ or src/composables/
TypesShared type definitionssrc/types/ or alongside the abstraction

Follow the project's existing conventions for shared code location. If no convention exists, propose one based on the framework.

Step 3: Plan extractions

For each duplication cluster, plan the extraction:

  1. Name the abstraction — Use a clear, descriptive name that reflects the shared behavior
  2. Define the interface — Determine parameters needed to cover all usage variations
  3. Choose the location — Follow project conventions for shared code placement
  4. List all consumers — Identify every file that will be updated
  5. Assess risk — Note any subtle differences between duplicated instances that need parameterization

Present the plan to the user before proceeding (unless --dry-run was not specified and the scope is clear).

Plan format:

## Extraction Plan

### 1. [Abstraction Name] → [target file path]
- Type: utility | component | hook
- Replaces: [N] identical blocks across [M] files
- Consumers: [list of files]
- Parameters: [any variations that need to be parameterized]
- Estimated lines saved: [N]

Step 4: Extract shared abstractions

Execute each planned extraction:

  1. Create the shared abstraction with proper typing and documentation
  2. Replace each instance in consumer files with an import + usage of the new abstraction
  3. Handle variations — parameterize differences between instances rather than creating multiple abstractions
  4. Update imports — add the new import, remove imports that were only needed for the inline version

Extraction order: Start with utilities (no dependencies), then components, then hooks (may depend on utilities/components).

Mark each extraction as completed in the todo list before moving to the next.

Step 5: Write tests

Write tests for each extracted abstraction:

Abstraction TypeTest Approach
Utility functionUnit tests covering all input variations, edge cases
UI componentRender tests, prop variations, accessibility
Custom hookHook testing with mock dependencies, state transitions
Type definitionsType-level tests if applicable (tsd, expect-type)

Place test files adjacent to the abstraction or in the project's test directory, following existing conventions.

Step 6: Clean up dead code

After all extractions are complete:

  1. Remove unused imports from all updated consumer files
  2. Remove dead code — inline helper functions that are now replaced
  3. Verify no orphaned references — search for any remaining references to removed code

Step 7: Verify all checks pass

Run the full verification suite:

TypeScript/JavaScript projects:

npx tsc --noEmit          # Type checking
npm run lint              # Linting (or biome/eslint directly)
npm run test              # Full test suite

Python projects:

ty check .                # Type checking
ruff check .              # Linting
pytest                    # Test suite

Rust projects:

cargo check               # Type checking
cargo clippy              # Linting
cargo test                # Test suite

All three must pass. If any fail, fix the issues before reporting completion.

Output Summary

After all phases complete, report:

## DRY Consolidation Summary

### Extractions
- [Abstraction Name] (type) — replaced N blocks in M files
- ...

### New Files Created
- path/to/new/file.ts — [description]
- ...

### Tests Added
- N tests across M test files

### Net Effect
- ~N lines of duplicated code consolidated
- N reusable abstractions created
- All verified: typecheck + lint + N passing tests

Agentic Optimizations

ContextApproach
Quick scanUse --dry-run to see duplication report without changes
Focused extractionUse --scope utilities to extract only utility functions
Large codebaseScope to specific directory: /code:dry-consolidation src/components/
Post-extraction verify`npx tsc --noEmit 2>&1
Test run (fast)npm test -- --bail=1 --reporter=dot for quick pass/fail

See Also

  • /code:refactor — Functional refactoring of a file or directory (pure functions, immutability, composition)
  • /code:antipatterns — Detection-only analysis for code smells
  • ast-grep-search — Structural code search for finding patterns

Related Skills

  • If dead code detected during consolidation → /code:dead-code
  • If complexity is high after consolidation → /code:complexity

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.31%
按下载量换算194

Claude

28.3%
按下载量换算143

Cursor

19.03%
按下载量换算96

Gemini CLI

8.48%
按下载量换算43

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/laurigates/claude-plugins --skill dry-consolidation 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills