Agent skill
similar-code
Find semantically similar code across the codebase using vector search (armyknife searchx). Use when looking for similar implementations, duplicate code, or existing patterns. Requires symbols.db.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/similar-code
SKILL.md
- Always use actual code as query input, not natural language descriptions
- Prerequisite:
symbols.dbmust exist at project root (built viaarmyknife searchx index)
Workflow
- User provides code as argument (e.g.,
/similar-code <pasted code>) - Run the search command:
armyknife searchx query '<code>' --limit 10 --database symbols.db
- Present results as a table (symbol, kind, file, line, similarity)
- Read top matches to show code context
Interpreting Results
| Similarity | Meaning |
|---|---|
| 0.8+ | Very similar (likely same pattern or implementation) |
| 0.6-0.8 | Related (similar structure or purpose) |
| <0.6 | Weak match |
Limitations
| Input Type | Result Quality |
|---|---|
| Actual code | Good (designed for code-to-code similarity) |
| Natural language | Poor (embedding model is code-focused) |
Code is embedded using embeddinggemma:300m (768-dim) via Ollama.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?