CodeScout is an open-standard Agent Skill (SKILL.md) that eliminates the 8x code duplication explosion in AI-assisted development. It forces coding agents to explore and index existing utilities, formatters, and wrappers before authoring new functions.
A recent GitClear study analyzing 211M lines of code revealed that duplicate code blocks have surged by over 800% in AI-assisted repositories:
- Session Amnesia: Because agents work on localized tasks, they are blind to existing helpers living in sibling directories.
- The Reinvention Trap: When an agent needs to format a date, currency, slug, or handle a JWT token, it writes a brand new helper function from scratch. Over a few months, teams end up with 14 slightly different date formatters and 6 HTTP client wrappers scattered across the repository.
- Maintenance Nightmare: When a business rule changes (e.g. date format or currency symbol), bugs appear because half the code uses
formatDatefromutils/date.tsand the other half uses a private copy fromfeature-x/helper.ts.
Scout existing utilities before authoring duplicate code with zero configuration:
# 1. Scout for an existing function or concept
$ codescout "formatDate"
# 2. Scout inside a specific folder
$ codescout "currency" src/utils/
# 3. Interactive scout mode (indexes repository and prompts for queries)
$ codescout
# 4. Audit entire repository for duplicated function declarations
$ codescout --audit
# 5. Install automated pre-commit hook
$ codescout --install-hook🔭 CodeScout: Searching for 'formatDate' across 128 indexed functions...
============================================================
Found 2 matching candidate(s):
• [95% Match] formatRelativeDate(date: Date)
Source: src/utils/format.ts:8
Import: import { formatRelativeDate } from './src/utils/format';
• [80% Match] parseIsoDateString(iso: string)
Source: src/utils/date.ts:14
Import: import { parseIsoDateString } from './src/utils/date';
• 'formatRelativeDate' defined 2 times: - src/utils/format.ts:8 - src/screens/UserProfile.tsx:42
---
## 🔭 The CodeScout Protocol
1. **Scout Before Coding**: Search the project index before writing any helper or transformation logic (`python3 scripts/codescout.py --search "<concept>"`).
2. **Reuse Fork**: If a matching utility exists with >= 60% similarity, import and reuse it. Do NOT write private duplicate helpers.
3. **Canonical Centralization**: If no utility exists, author the new helper in the project's canonical utility directory (`src/utils/`, `lib/utils/`), not buried inline inside a component.
---
## 🚀 Universal Agent Installation
### 1. Claude Code
Install directly into your project's skills directory:
```bash
git clone https://github.com/subinz1/codescout-skill.git .claude/skills/codescout
Copy SKILL.md into .cursor/rules/ or add to project rules.
Clone into .codex/skills/ or reference SKILL.md in your agent prompt.
Prevent duplicate function proliferation:
echo "python3 scripts/codescout.py --audit" >> .git/hooks/pre-commit
chmod +x .git/hooks/pre-commitname: CodeScout Duplication Audit
on: [pull_request]
jobs:
codescout:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: python3 scripts/codescout.py --auditCodeScout is built with zero external npm or pip dependencies. It parses AST and regex patterns across TypeScript, JavaScript, Python, Dart, and Go in under 10 milliseconds.
codescout-skill/
├── SKILL.md # Universal Agent Skill specification
├── scripts/
│ └── codescout.py # Zero-dependency function indexer & fuzzy scout
├── references/
│ └── REUSE_TAXONOMY.md # Canonical utility directory patterns & DRY guide
├── fixtures/
│ ├── existing_utils.ts # Shared canonical utilities
│ └── reinvented_code.ts # Duplicate function reinvention example
├── tests/
│ └── test_codescout.py # Automated unit test suite
├── package.json
├── LICENSE # MIT License
└── TODO.md # Phase 2 roadmap (vector embedding cache, auto-merge)
MIT © Subin George