Source profileQuality 87/100

tuanductran/hr-skills/.agents/skills/dry-refactoring/SKILL.md

dry-refactoring

Guided workflow to eliminate copy-paste duplication in packages/hr-skills-build and packages/skills-ref, detected by jscpd. Extract shared functions, constants, and types into their own files instead of growing an existing one.

Source repository stars
43
Declared platforms
0
Static risk flags
0
Last source update
2026-08-05
Source checked
2026-08-05

Decision brief

What it does—and where it fits

Guided workflow to eliminate copy-paste duplication in packages/ TypeScript source. Use after jscpd has produced a clone list.

Best for

    Not for

    • Tasks that require unconfirmed production actions or broad system permissions.
    • Environments where the pinned source and install steps cannot be inspected.

    Compatibility matrix

    Platform support, with evidence labels

    PlatformStatusEvidenceWhat to check
    CodexNot declaredNo explicit evidencePortability before use
    Claude CodeNot declaredNo explicit evidencePortability before use
    CursorNot declaredNo explicit evidencePortability before use
    Gemini CLINot declaredNo explicit evidencePortability before use
    Open the compatibility checker

    Installation

    Inspect first. Install second.

    The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

    Source-detected install commandSource
    npx skills add https://github.com/tuanductran/hr-skills --skill ".agents/skills/dry-refactoring"
    Safe inspection promptEditorial

    Inspect the Agent Skill "dry-refactoring" from https://github.com/tuanductran/hr-skills/blob/26fae0e8572f0e3e50d4b28fbe3abbff2e6a0814/.agents/skills/dry-refactoring/SKILL.md at commit 26fae0e8572f0e3e50d4b28fbe3abbff2e6a0814. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

    Workflow

    What the source asks the agent to do

    1. 01

      Workflow

      1. Run jscpd, scoped to packages/ only (never skills/, see the jscpd skill for why). 2. Parse each clone line to identify the two duplicated locations (file + line range). 3. Read both code fragments and understand what they do — don't refactor blind. 4. Decide the refactor targ…

      Run jscpd, scoped to packages/ only (never skills/, see the jscpd skill for why).Parse each clone line to identify the two duplicated locations (file + line range).Read both code fragments and understand what they do — don't refactor blind.
    2. 02

      Prerequisites

      Run jscpd first — see jscpd for the exact command this repo uses:

      Run jscpd first — see jscpd for the exact command this repo uses:
    3. 03

      Where extracted code goes in this repo

      This repo already separates code by domain under packages/hr-skills-build/src/{shared,validation,cli,planner,runtime,registry,search,build,evaluation}/ and packages/skills-ref/src/. Follow that structure — don't dump extracted helpers into whichever file happens to be open:

      Duplicated logic used by 2+ files in the same domain folder (e.g. two files under src/validation/) → new file in that same folder, e.g. src/validation/security-helpers.ts, imported by both.Duplicated logic used across domain folders (e.g. src/cli/ and src/evaluation/) → src/shared/, alongside the existing shared/constants.ts, shared/helpers.ts, shared/schema.ts, shared/types.ts.Duplicated logic across packages (hr-skills-build and skills-ref both define it) → do not create a third copy in either package. Prefer keeping a single canonical definition in the package it conceptually belongs to (sk…
    4. 04

      Naming collisions

      Before extracting, grep -rn "export (const|function|type|interface) " packages for the name you're about to reuse. If a same-named export already exists elsewhere in the monorepo:

      Prefer a more specific name over a generic one (e.g. parseSkillFrontmatter over parse) rather than renaming the existing export and risking unrelated churn.If both are genuinely the same concept split across two files, that's itself a duplication signal — consolidate into one export instead of two similarly-named ones.Before extracting, grep -rn "export (const|function|type|interface) " packages for the name you're about to reuse. If a same-named export already exists elsewhere in the monorepo:
    5. 05

      Refactoring strategies

      Extract function — duplicate is a block of logic → shared function, called from both places.

      Extract function — duplicate is a block of logic → shared function, called from both places.Extract module — duplicate spans multiple files in the same or related domains → shared file per the placement rules above, imported by all call sites.Extract constant — duplicate is repeated literal data or config → named constant in the domain's constants.ts.

    Permission review

    Static risk signals and limitations

    No configured static risk pattern was detected

    This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.

    Evidence record

    Why each signal appears

    EvidenceSourceComputedTestedEditorial
    SignalValueEvidence typeMeaning
    Quality score87/100ComputedDocumentation, specificity, maintenance, and trust rules
    Repository stars43SourceRepository attention, not individual Skill quality
    Compatibility0 platformsSourceDeclared in the catalog source record
    Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

    Pinned source

    Provenance and original SKILL.md

    Repository
    tuanductran/hr-skills
    Skill path
    .agents/skills/dry-refactoring/SKILL.md
    Commit
    26fae0e8572f0e3e50d4b28fbe3abbff2e6a0814
    License
    MIT
    Collected
    2026-08-05
    Default branch
    main
    View the original SKILL.md

    dry-refactoring

    Guided workflow to eliminate copy-paste duplication in packages/* TypeScript source. Use after jscpd has produced a clone list.

    Prerequisites

    Run jscpd first — see jscpd for the exact command this repo uses:

    bunx jscpd@5 packages --reporters ai --format typescript
    

    Workflow

    1. Run jscpd, scoped to packages/ only (never skills/, see the jscpd skill for why).
    2. Parse each clone line to identify the two duplicated locations (file + line range).
    3. Read both code fragments and understand what they do — don't refactor blind.
    4. Decide the refactor target using the placement rules below.
    5. Extract the shared logic; update all call sites, not just the two jscpd reported.
    6. Run bun run typecheck and bun run test (repo-wide or --filter to the affected package — see turbo).
    7. Re-run jscpd to confirm the clone is gone.
    8. Repeat, highest-impact cluster first (most repeated pattern, not just the first line in the report).

    Where extracted code goes in this repo

    This repo already separates code by domain under packages/hr-skills-build/src/{shared,validation,cli,planner,runtime,registry,search,build,evaluation}/ and packages/skills-ref/src/. Follow that structure — don't dump extracted helpers into whichever file happens to be open:

    • Duplicated logic used by 2+ files in the same domain folder (e.g. two files under src/validation/) → new file in that same folder, e.g. src/validation/security-helpers.ts, imported by both.
    • Duplicated logic used across domain folders (e.g. src/cli/* and src/evaluation/*) → src/shared/, alongside the existing shared/constants.ts, shared/helpers.ts, shared/schema.ts, shared/types.ts.
    • Duplicated logic across packages (hr-skills-build and skills-ref both define it) → do not create a third copy in either package. Prefer keeping a single canonical definition in the package it conceptually belongs to (skills-ref for skill-file parsing primitives, hr-skills-build for build/registry/CLI concerns) and importing it from the other, or promote it to a small shared internal package if both genuinely need to own it independently. Never resolve this by copy-pasting into a third location.
    • Constants → their own constants.ts in the relevant folder; don't fold them into a file that already holds functions or types.
    • Types/interfaces → their own types.ts (or *.types.ts if types.ts already exists and would grow unrelated concerns) in the relevant folder — never appended to a functions file "for now."

    Naming collisions

    Before extracting, grep -rn "export (const|function|type|interface) <name>" packages for the name you're about to reuse. If a same-named export already exists elsewhere in the monorepo:

    • Prefer a more specific name over a generic one (e.g. parseSkillFrontmatter over parse) rather than renaming the existing export and risking unrelated churn.
    • If both are genuinely the same concept split across two files, that's itself a duplication signal — consolidate into one export instead of two similarly-named ones.

    Refactoring strategies

    Extract function — duplicate is a block of logic → shared function, called from both places.

    Extract module — duplicate spans multiple files in the same or related domains → shared file per the placement rules above, imported by all call sites.

    Extract constant — duplicate is repeated literal data or config → named constant in the domain's constants.ts.

    Extract type/interface — duplicate or near-duplicate shape appears in two files → single definition in the domain's types.ts, both files import it.

    Avoid the template/base class strategy in this codebase unless a real inheritance hierarchy already exists — this repo favors small composable functions and Valibot schemas (see valibot) over class hierarchies.

    Tips

    • All call sites updated, not just the two jscpd reported — grep for other near-identical blocks jscpd's thresholds may have missed.
    • Tests still pass after refactoring (bun run test), and bun run typecheck is clean.
    • The extracted abstraction has a clear, descriptive name — see naming collisions above.
    • If the duplication is between packages/hr-skills-build and packages/skills-ref, check whether a changeset is needed — see changeset.
    • Format with Biome after refactoring (bun run format or let lefthook catch it on commit) — see biome.

    Alternatives

    Compare before choosing

    Computed 10023,835

    alirezarezvani/claude-skills

    app-store-optimization

    App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store. Use when the user asks about ASO, app store rankings, app metadata, app titles and descriptions, app store listings, app visibility, or mobile app marketing on iOS or Android. Supports keyword research and scoring, competitor keyword analysis, metadata optimization, A/B test planning, launch checklist

    Computed 1004,944

    dotnet/skills

    migrate-vstest-to-mtp

    Migrates .NET test projects from VSTest to Microsoft.Testing.Platform (MTP). Use when user asks to "migrate to MTP", "switch from VSTest", "enable Microsoft.Testing.Platform", "use MTP runner", set OutputType=Exe only for test projects in Directory.Build.props, or mentions EnableMSTestRunner, EnableNUnitRunner, or UseMicrosoftTestingPlatformRunner. USE FOR: MTP behavioral differences vs VSTest (exit code 8, zero tests discovered, --ignore-exit-code, TESTINGPLATFORM_EXITCODE_IGNORE); centralizing

    Computed 9929,680

    HKUDS/Vibe-Trading

    strategy-generate

    Create, modify, and optimize quantitative trading strategies, then backtest and evaluate them.

    Computed 9832,671

    K-Dense-AI/scientific-agent-skills

    dask

    Distributed computing for larger-than-RAM pandas/NumPy workflows. Use when you need to scale existing pandas/NumPy code beyond memory or across clusters. Best for parallel file processing, distributed ML, integration with existing pandas code. For out-of-core analytics on single machine use vaex; for in-memory speed use polars.