Skip to content
Skills Library
Programming · Review & audit

no-duplicate-string

/no-duplicate-string

Find string literals that appear in 3+ files across the codebase. Use when the user wants to identify hardcoded strings that should be extracted into a shared constant or config, hunts for strings duplicated across multiple modules, or asks to find magic strings that repeat. Returns a small ranked table showing the most common strings, not the files themselves.

Repository
sniff ↗
Licence
MIT
Last repository change
06.08.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 06.08.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Find string literals that appear in 3+ files across the codebase. Use when the user wants to identify hardcoded strings that should be extracted into a shared constant or config, hunts for strings duplicated across multiple modules, or asks to find magic strings that repeat. Returns a small ranked table showing the most common strings, not the files themselves.

Original author description

Find string literals that appear in 3+ files across the codebase. Use when the user wants to identify hardcoded strings that should be extracted into a shared constant or config, hunts for strings duplicated across multiple modules, or asks to find magic strings that repeat. Returns a small ranked table showing the most common strings, not the files themselves.

How it works

  1. Usage
  2. Caveats
Original SKILL.md headings · 38 lines, 242 words
SKILL.md preview
---
name: no-duplicate-string
description: >-
  Find string literals that appear in 3+ files across the codebase.
  Use when the user wants to identify hardcoded strings that should be extracted into
  a shared constant or config, hunts for strings duplicated across multiple modules,
  or asks to find magic strings that repeat. Returns a small ranked table showing the
  most common strings, not the files themselves.
---

# no-duplicate-string

Find hardcoded string literals that repeat across 3+ distinct files. Identifying
duplicated strings helps surface values that should be centralized (shared configs,
constants modules, environment variables). This is the **file-metric** engine: no
AST, just regex extraction per file, using the same ignore list and test handling
as the AST skills.

## Usage

Run the detector through the installed sniff CLI:

1. If `sniff version` fails: `uv tool install sniff-smells`.
2. Run: `sniff --only no-duplicate-string DIR [--threshold N] [--min-len N]
   [--top N] [--include-tests]`
3. Report the table; do not paste raw file contents.

Flags:
- `--threshold N` (default 3): minimum distinct files a string must appear in to
  be flagged.
- `--min-len N` (default 4): minimum string length to avoid noise.
- `--top N` (default 10): how many strings to show.

**Print the entire table verbatim.** It IS the answer. Do NOT summarize it to
prose or drop rows. You may add ONE takeaway line after the table (e.g. the
most-duplicated string), but the full table comes first and in full.

## Caveats

- Extraction is regex-based and includes both `"..."` and `'...'` patterns;
  template literals (backticks) are not yet supported.
- Very short strings are filtered by default (`--min-len 4`) to reduce noise.
  Common keywords like `true`, `false`, `null`, `undefined` are also skipped.
- Duplicated strings in comments or documentation are not detected (analysis is
  source-code strings only).
- String normalization treats `\"` and `"` the same for deduplication purposes.

Versions

The database has no other skills named no-duplicate-string.

Database snapshot: 13.11.2026 · package version 870903138882 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100duplicate-code
    Find the largest blocks of duplicated code (copy-pasted logic), ranked by size. Use when the user asks what code is duplicated, hunts for copy-paste, wants to find repeated logic, sync/async twin methods, or blocks worth extracting into a shared helper. This finds duplicated…
  • 100string-reviewer
    Use this skill when asked to review text and user-facing strings within the codebase. It ensures that these strings follow rules on clarity, usefulness, brevity and style.
  • 100magic-value-elimination
    This skill should be used when the user's code contains inline string literals, unexplained numbers, hardcoded timeout values, status strings, or any value that should be a named constant or enum. Covers the elimination of magic values and the rule that every literal should have a name.
  • 90copy-recon
    Survey all user-facing strings in a codebase — map coverage and find gaps. Use when asked "what user-facing strings do we have", "map our copy coverage", or "find hardcoded strings".
  • 100i18n-string-coverage
    Build-an-X workflow that scans source code for untranslated strings - finds hardcoded user-facing text not wrapped in the i18n function (`t()`, `i18n.t`, `gettext`, `__()`, etc.), maps gaps to the team's translation file, reports per-language coverage (en: 100%; fr: 87%; es:…
  • 100go-strings
    Guides the agent to write correct and efficient Go string code. Use when writing or reviewing Go code that iterates over strings, concatenates strings, trims strings, converts between string and []byte, or extracts substrings. Covers rune semantics, string iteration pitfalls,…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.