This package helps users identify and avoid common pitfalls in web and HTML development by analyzing text-based input—like code snippets, design descriptions, or technical discussions—and returning a
Project description
webdev-pitfall-analyzer
webdev-pitfall-analyzer helps developers quickly spot common web‑development pitfalls—security issues, accessibility problems, performance bottlenecks, outdated patterns, and more—by analysing short text inputs such as code snippets, design questions, or discussion fragments. The package uses an LLM (by default ChatLLM7 from langchain_llm7) to return a concise, structured list of warnings and best‑practice recommendations.
📦 Installation
pip install webdev_pitfall_analyzer
🚀 Quick start
from webdev_pitfall_analyzer import webdev_pitfall_analyzer
# Example HTML/JS snippet
snippet = """
<input type="text" onblur="doBadThing()" />
<script>
function doBadThing() {
eval(userInput); // <- unsafe!
}
</script>
"""
warnings = webdev_pitfall_analyzer(user_input=snippet)
print(warnings)
Output (example)
[
"⚠️ Use of `eval` can lead to XSS vulnerabilities. Consider safer alternatives.",
"⚠️ Missing `label` element for the input; this hurts accessibility.",
"⚠️ Inline event handlers (`onblur`) are discouraged; attach listeners via JavaScript instead."
]
🛠️ Function signature
def webdev_pitfall_analyzer(
user_input: str,
api_key: Optional[str] = None,
llm: Optional[BaseChatModel] = None,
) -> List[str]:
| Parameter | Type | Description |
|---|---|---|
user_input |
str |
The text (code, question, description, etc.) you want analysed. |
api_key |
Optional[str] |
API key for ChatLLM7. If omitted, the function will look for the LLM7_API_KEY environment variable; if still not found it falls back to an unauthenticated request (may be rate‑limited). |
llm |
Optional[BaseChatModel] |
Any LangChain‑compatible LLM instance. If not supplied, the default ChatLLM7 (from langchain_llm7) is used. |
The function returns a list of warning/recommendation strings. If the underlying LLM call fails, a RuntimeError is raised.
🔧 Using a custom LLM
You can pass any LangChain chat model that follows the BaseChatModel interface.
OpenAI
from langchain_openai import ChatOpenAI
from webdev_pitfall_analyzer import webdev_pitfall_analyzer
my_llm = ChatOpenAI(model="gpt-4o-mini")
result = webdev_pitfall_analyzer(user_input="...", llm=my_llm)
Anthropic
from langchain_anthropic import ChatAnthropic
from webdev_pitfall_analyzer import webdev_pitfall_analyzer
my_llm = ChatAnthropic(model="claude-3-haiku-20240307")
result = webdev_pitfall_analyzer(user_input="...", llm=my_llm)
Google GenAI
from langchain_google_genai import ChatGoogleGenerativeAI
from webdev_pitfall_analyzer import webdev_pitfall_analyzer
my_llm = ChatGoogleGenerativeAI(model="gemini-1.5-flash")
result = webdev_pitfall_analyzer(user_input="...", llm=my_llm)
🔑 API key for ChatLLM7
The default free tier of LLM7 is sufficient for most occasional analyses.
- Set the key once in your environment:
export LLM7_API_KEY="your_llm7_key"
- Or pass it directly:
result = webdev_pitfall_analyzer(user_input="...", api_key="your_llm7_key")
Obtain a free key by registering at https://token.llm7.io/.
📚 What the analyzer looks for
- Security – unsafe functions (
eval,innerHTML, etc.), injection risks. - Accessibility – missing ARIA attributes, improper heading structure, unlabeled form controls.
- Performance – blocking synchronous XHR, large inline assets, unnecessary reflows.
- Modern best practices – deprecated APIs, outdated HTML5 elements, inefficient CSS selectors.
The underlying prompt (human_prompt, system_prompt) can be customised by forking the repository.
📂 Repository
🛠️ Issues & feature requests: https://github.com/chigwell/webdev_pitfall_analyzer/issues
👤 Author
Eugene Evstafev
Email: hi@eugene.plus
GitHub: https://github.com/chigwell
📄 License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file webdev_pitfall_analyzer-2025.12.21133820.tar.gz.
File metadata
- Download URL: webdev_pitfall_analyzer-2025.12.21133820.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e2ee0b7f2bc69bde02653e741de7ea99b6be28fc074c2cf5f8994529351f907
|
|
| MD5 |
d578c676adaeefc5d3023811157b88c6
|
|
| BLAKE2b-256 |
90c57bf2a8bb62f57811c1ee45c46e847bcbe083fd7c99a0f8cb40794dae12f1
|
File details
Details for the file webdev_pitfall_analyzer-2025.12.21133820-py3-none-any.whl.
File metadata
- Download URL: webdev_pitfall_analyzer-2025.12.21133820-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85dc7ca271f764240177a41988946d642faca23348d2648f71449bb0579d2019
|
|
| MD5 |
363c50a32169513749d5053aee980cfd
|
|
| BLAKE2b-256 |
170ccdee8739f57daa138796c94daf1e85f04a4c37768089a4ade98911c76199
|