DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to search your code for a bug pattern in one command with Semgrep

Install the CLI and write a pattern query inline with -e.

Short answer: Install with pipx install semgrep; then run semgrep -e '$X == $X' --lang=py path/to/src, using your own source path; read each match, which is a Python comparison with identical sides and a possible bug. All steps.

  • Top pick
  • Security and science
  • Beginner
  • 15 minutes
  • From the README
  • Claude Code
  • Codex
  • Cursor
  • Gemini CLI

Who it is forA developer who wants a quick structural search that grep cannot do.

The problemPlain text search cannot match code by structure, such as the same expression on both sides of a comparison.

The outcomeA list of matches in your source folder for the pattern you wrote.

What you need first

  • Python and pip, or pipx, uv, Homebrew or Docker
  • A project directory to scan
  • Optional free Semgrep account for extra rules

Steps

  1. Install with pipx install semgrep
  2. Run semgrep -e '$X == $X' --lang=py path/to/src, using your own source path
  3. Read each match, which is a Python comparison with identical sides and a possible bug
  4. Change the pattern and rerun to look for other shapes

Prompt for your agent

Using semgrep/semgrep, install it with `pipx install semgrep` and run `semgrep -e '$X == $X' --lang=py path/to/src` on my code. Summarise each match and say which look like real bugs.

Caveat. This card is written from the semgrep/semgrep README, not from a test run by Deduped. Before you start, make sure you have Python and pip, or pipx, uv, Homebrew or Docker. Check the repo for newer instructions before you rely on these steps.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for semgrep/semgrep and "Search your code for a bug pattern in one command"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer