←back to thread

136 points d-yoda | 1 comments | | HN request time: 0.252s | source

Hi HN! I built pyscn for Python developers in the vibe coding era. If you're using Cursor, Claude, or ChatGPT to ship Python code fast, you know the feeling: features work, tests pass, but the codebase feels... messy.

Common vibe coding artifacts:

• Code duplication (from copy-pasted snippets)

• Dead code from quick iterations

• Over-engineered solutions for simple problems

• Inconsistent patterns across modules

pyscn performs structural analysis:

• APTED tree edit distance + LSH

• Control-Flow Graph (CFG) analysis

• Coupling Between Objects (CBO)

• Cyclomatic Complexity

Try it without installation:

  uvx pyscn analyze .          # Using uv (fastest)
  pipx run pyscn analyze .     # Using pipx
  (Or install: pip install pyscn)
Built with Go + tree-sitter. Happy to dive into the implementation details!
Show context
stuaxo ◴[] No.45489095[source]
Here are some anti patterns a colleague put in their code.

Prescriptive comment: Comment describes exactly what the following code does without adding useful context. (Usually this is for the LLM to direct itself and should be removed).

Inconsistent style: You have this across modules, but this would be in the same file.

Inconsistent calling style: A function or method should return one kind of thing.

(In the worst case, the LLM has generated a load of special cases in the caller to handle the different styles it made).

Unneeded "Service" class: I saw a few instances where something that should have been simple function calls resulted in a class with Service in the name being added, I'm not sure why, but it did happen adding extra complications.

Those are the ones off the top of my head.

As a senior dev, I think use of these tools can be fine, as long as people are happy to go and fix the issues and learn, anyone can go from vibe coder to coder if you accept the need to learn and improve.

The output of the LLM is a starting point, however much we engineer prompts, we can't know what else we need to say until we see the (somewhat) wrong output and iterate it.

replies(1): >>45511809 #
1. d-yoda ◴[] No.45511809[source]
This is super insightful, thank you for sharing. It's a great list of common LLM-generated anti-patterns.

I'd love to look into incorporating checks for these into pyscn. This is exactly the kind of stuff I want it to catch.