code-review

Perform a structured code review of changes, checking for correctness, style, tests, and potential issues.

Install
npx skills add 'https://github.com/langchain-ai/deepagents/tree/main/examples/deploy-coding-agent/skills/code-review'
Download bundle ↓
main · 229ffefScanned 2026-09-17

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗

lint_check.py

lint_check.pyBrowse 2 files
View on GitHub
← Back to SKILL.md
#!/usr/bin/env python3"""Quick lint check helper for the code-review skill. Scans Python files for common issues that a full linter might miss or thatare worth flagging during code review: - Files missing a module docstring- Functions longer than 50 lines- Bare `except:` clauses Usage::     python /skills/code-review/lint_check.py [path ...] If no paths are given, scans the current directory recursively.""" import astimport sysfrom pathlib import Path  def check_file(path: Path) -> list[str]:    """Return a list of warnings for a single Python file."""    warnings: list[str] = []    try:        source = path.read_text(encoding="utf-8")    except Exception as exc:        return [f"{path}: could not read ({exc})"]     try:        tree = ast.parse(source, filename=str(path))    except SyntaxError as exc:        return [f"{path}:{exc.lineno}: syntax error: {exc.msg}"]     # Check for missing module docstring    if not ast.get_docstring(tree):        warnings.append(f"{path}:1: missing module docstring")     for node in ast.walk(tree):        # Long functions        if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):            length = (node.end_lineno or node.lineno) - node.lineno + 1            if length > 50:                warnings.append(                    f"{path}:{node.lineno}: function '{node.name}' is {length} lines long (>50)"                )         # Bare except        if isinstance(node, ast.ExceptHandler) and node.type is None:            warnings.append(f"{path}:{node.lineno}: bare 'except:' clause")     return warnings  def main(paths: list[str]) -> int:    targets = [Path(p) for p in paths] if paths else [Path(".")]    all_warnings: list[str] = []     for target in targets:        if target.is_file() and target.suffix == ".py":            all_warnings.extend(check_file(target))        elif target.is_dir():            for py_file in sorted(target.rglob("*.py")):                all_warnings.extend(check_file(py_file))     for w in all_warnings:        print(w)     if all_warnings:        print(f"\n{len(all_warnings)} warning(s) found.")        return 1     print("No warnings found.")    return 0  if __name__ == "__main__":    sys.exit(main(sys.argv[1:]))