python-clean-code
Skill22 starsChanged 33 days agoMITView on GitHub
Review Python code in the gsc-mcp codebase for clean code violations. Checks function size, single responsibility, type hints, naming, error handling patterns, and adherence to the project's module contracts. Use when refactoring a module or before code review.
8 other projects use a version of this.
Adopted by
Most recently taken up by
- phanijapps/memextheir own version, first seen Oct 17, 2026
- ramybarsoum/claude-skillstheir own version, first seen Oct 13, 2026
- dathuynh1108/agent-skillstheir own version, first seen Oct 11, 2026
- Praveensenpai/karakuritheir own version, first seen Sep 13, 2026
- CasLubbers/code-design-skillstheir own version, first seen Aug 25, 2026
- jenreh/appkittheir own version, first seen Jul 8, 2026
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 8
- ertugrul-dmr/clean-code-skills★ 193same name
- dathuynh1108/agent-skills★ 4same name
- jenreh/appkit★ 4same name
- CasLubbers/code-design-skills★ 2same name
- JoseVelazcoH/python-skills★ 0same name
- phanijapps/memex★ 0same name
- Praveensenpai/karakuri★ 0same name
- ramybarsoum/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository16 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- ai-overviews-impactSkill
- cannibalization-checkSkill
- content-opportunitiesSkill
- crawl-importSkill
- crawl-log-auditSkill
- heading-auditSkill
- indexing-auditSkill
- internal-linking-auditSkill
- link-equity-mapSkill
- onpage-auditSkill
- page-deep-diveSkill
- schema-auditSkill
- seo-weekly-reportSkill
- sitemap-auditSkill
- traffic-drop-diagnosisSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 2 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Every function signature must be fully annotated.
- Very specific: line 26
Use of Any without justification
- Very specific: line 39
Check for logic duplicated across modules.
- Very specific: line 43
Every public tool function must return json.dumps(with_meta(...)).
- Distinctive: line 73
Every finding must cite the exact function name and line number.
“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Python Clean Code Review
Reviews Python code in gsc-mcp for quality issues. Read-only analysis: produces a findings report, applies no fixes.
When to use
Invoke before opening a PR, after adding a new tool, or when a module feels hard to read. Pass a file path or module name as the argument.
Review Dimensions
1. Function Size and Focus
Flag any function exceeding 30 lines (excluding docstring and blank lines). A function that does more than one thing usually has a name with "and" in it, or a docstring that lists multiple behaviors. Each tool function in tools/ should do exactly one thing: call the API, transform the response, and return the JSON string.
2. Type Hints
Every function signature must be fully annotated. Check for:
- Missing return type (
-> str:,-> None:) - Missing parameter types
- Use of
Anywithout justification listanddictwithout subscripts where the shape is known (e.g.list[dict]not justlist)
3. Naming
Private helpers must start with _. Constants at module level must be in _SCREAMING_SNAKE_CASE. Tool functions exposed to MCP must be lowercase with underscores. No abbreviations that require context to decode (r for rows; svc is acceptable because it appears consistently across the codebase).
4. Error Handling
Tool functions must not silently swallow exceptions. They may catch specific exceptions to convert them into user-friendly error messages, but they must not use bare except: or except Exception: without re-raising or returning a structured error response. Transient Google API errors belong in retry.py, not in tool functions.
5. Duplication
Check for logic duplicated across modules. Common candidates: date range calculation (already in analytics._date_range), URL normalization (already in cross._normalize_url), dimension filter construction (already in ga4._build_dimension_filter). If a function re-implements one of these, flag it.
6. Output Contract Compliance
Every public tool function must return json.dumps(with_meta(...)). Flag any function that:
- Returns raw
json.dumps({...})withoutwith_meta - Returns a plain string or dict
- Nests the main data under a
"data"key insidewith_meta
7. Docstrings
MCP uses the function docstring as the tool description visible to the user. The docstring must be present, must describe what the tool does (not how), and must mention key parameters and any data lag (GSC has a 3-day lag by default).
Output Format
## Clean Code Review: <file>
### Critical
- [function:line] [issue]: [why it matters]
### Improvement
- [function:line] [issue]: [suggested fix]
### Minor
- [function:line] [issue]
### Passed
- Type hints: complete on all public functions
- Output contract: all tools use with_metaEvidence Rule
Every finding must cite the exact function name and line number. Do not flag something as a violation without reading the code to confirm it.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

