{
 "schema_version": 1,
 "generated": "2026-11-09",
 "id": "semgrep-semgrep--search-your-code-for-a-bug-pattern-with-semgrep",
 "repo": "semgrep/semgrep",
 "repo_url": "https://github.com/semgrep/semgrep",
 "repo_slug": "semgrep-semgrep",
 "title": "Search your code for a bug pattern in one command",
 "page_title": "How to search your code for a bug pattern in one command with Semgrep",
 "summary": "Install the CLI and write a pattern query inline with -e.",
 "who": "A developer who wants a quick structural search that grep cannot do.",
 "problem": "Plain text search cannot match code by structure, such as the same expression on both sides of a comparison.",
 "outcome": "A list of matches in your source folder for the pattern you wrote.",
 "steps": [
  "Install with `pipx install semgrep`",
  "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",
  "Change the pattern and rerun to look for other shapes"
 ],
 "agent_prompt": "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.",
 "agents": [
  "claude-code",
  "codex",
  "cursor",
  "gemini-cli"
 ],
 "difficulty": "Beginner",
 "time": "15 minutes",
 "basis": "readme",
 "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.",
 "category": "Security and science",
 "tags": [
  "Security and science"
 ],
 "lang": "c",
 "requirements": [
  "Python and pip, or pipx, uv, Homebrew or Docker",
  "A project directory to scan",
  "Optional free Semgrep account for extra rules"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": true,
 "score": 1.0,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/semgrep-semgrep/search-your-code-for-a-bug-pattern-with-semgrep/",
 "md": "https://dedupedai.com/use-cases/semgrep-semgrep/search-your-code-for-a-bug-pattern-with-semgrep/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/semgrep-semgrep--search-your-code-for-a-bug-pattern-with-semgrep.json",
 "api_version": "v1"
}
