| name | setup-dry |
| description | One-time setup skill that adds structural duplication detection via pre-commit hook and CI. Configures DRY violation checks using AST fingerprinting and Jaccard similarity. Use when user wants automated duplicate code detection. |
Setup DRY
One-time guided setup. Adds DRY violation detection at both CI and pre-commit hook level. Defaults to setting up both -- confirms with user before proceeding.
Workflow
Step 1 -- Detect project setup
Present findings to user for confirmation before proceeding.
If detection is ambiguous, use AskUserQuestion to clarify:
- If language can't be determined: ask what language(s) the project uses
- If no clear source directories: ask which directories contain production code (vs. config, scripts, etc.)
- If existing duplication tools found: ask if they want to replace or run alongside
Step 2 -- Ask user preferences
Use AskUserQuestion for each:
- Where to enforce -- default is both, confirm with user:
- Both CI and pre-commit hook (recommended)
- CI only -- GitHub Actions workflow
- Pre-commit hook only -- local enforcement
- Similarity threshold -- minimum Jaccard similarity to flag as duplicate
- Suggest 0.8 (80% structural similarity)
- User can raise/lower
- Minimum block size -- smallest code block to consider
- Suggest 5 lines -- ignore trivially small matches
- User can adjust
- CI enforcement mode (if CI selected):
- Fail the check (recommended) -- PR cannot merge on new duplicates
- Warn only -- post a comment but don't block
Step 3 -- Generate files
Step 4 -- Verify
Key rules
- Never overwrite existing workflow files or hooks without asking
- Idempotent -- running again detects existing setup and skips