linting
Skill1 starsChanged 11 months agoMITView on GitHub
Expert in maintaining code quality standards using flake8, black, isort, and mypy. Use when fixing linting errors or enforcing code style.
- Installs packages
3 other projects use a version of this.
Adopted by
Most recently taken up by
- langwatch/langwatchtheir own version, first seen Oct 17, 2026
- int2t05/engineering-skillstheir own version, first seen Oct 15, 2026
- parisneto/anticharontheir own version, first seen Sep 26, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- langwatch/langwatch★ 5ksame name
- int2t05/engineering-skills★ 3same name
- parisneto/anticharon★ 2same 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 repository12 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- code-reviewSkill
- commit-messagesSkill
- doc-auditSkill
- github-operationsSkill
- issue-writingSkill
- pr-writingSkill
- python-basicsSkill
- python-docsSkill
- releaseSkill
- testingSkill
- test-strategySkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. 0 are common, 12 are distinctive, and 5 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
12
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 44
When flake8 reports lines over 100 characters, break them logically:
- Distinctive: line 72
When isort or flake8 flags import order problems:
- Distinctive: line 102
When mypy reports missing type hints, add them:
- Distinctive: line 133
When flake8 reports unused imports:
- Distinctive: line 213
After auto-fix, check what's left:
- Distinctive: line 230
Should see no errors before committing.
- Distinctive: line 257
Add watcher for Black
- Distinctive: line 258
Add watcher for isort
- Very specific: line 290
Use --diff to see exact changes before applying
- Distinctive: line 332
When mypy complains about missing stubs for third-party libraries:
- Distinctive: line 357
Before creating a commit:
- Very specific: line 359
Run ./lint.sh --fix to auto-fix what's possible
- Very specific: line 360
Run ./lint.sh to check for remaining issues
- Very specific: line 362
Verify clean: ./lint.sh should show no errors
- Very specific: line 374
Use --profile=black to ensure isort is compatible with black:
- Distinctive: line 392
Run on specific files during development:
- Distinctive: line 400
Run full suite before committing.
“Common” is measured: kept by at least 6 in 10 of the 3 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
Linting Skill
Learn how to maintain code quality using flake8, black, isort, and mypy for the Drift project.
How to Run Linters
All Linters at Once
# Check all linting (recommended before commits)
./lint.sh
# Auto-fix formatting issues
./lint.sh --fixIndividual Linters
# flake8 (code quality checks)
flake8 src/drift/ tests/ --max-line-length=100
# black (code formatting)
black src/drift/ tests/ --line-length=100 --check
black src/drift/ tests/ --line-length=100 # Apply fixes
# isort (import sorting)
isort src/drift/ tests/ --profile=black --check
isort src/drift/ tests/ --profile=black # Apply fixes
# mypy (type checking)
mypy src/drift/How to Fix Common Linting Issues
Line Too Long (E501)
When flake8 reports lines over 100 characters, break them logically:
# Before - line too long
result = very_long_function_call_with_many_arguments(arg1, arg2, arg3, arg4, arg5, arg6, arg7)
# After - properly formatted
result = very_long_function_call_with_many_arguments(
arg1, arg2, arg3, arg4,
arg5, arg6, arg7
)For long strings:
# Before
message = "This is a very long error message that exceeds the 100 character limit and needs to be broken up"
# After
message = (
"This is a very long error message that exceeds the 100 character "
"limit and needs to be broken up"
)Import Order Issues
When isort or flake8 flags import order problems:
# Auto-fix with isort
isort src/drift/core/parser.py --profile=black
# Or fix all files
isort . --profile=blackExpected order:
# Standard library
import json
import os
from pathlib import Path
# Third-party
import boto3
import click
from botocore.exceptions import ClientError
# Local
from drift.core.parser import parse_conversation
from drift.core.detector import detect_driftType Hint Issues
When mypy reports missing type hints, add them:
# Before - mypy error: Function is missing a return type annotation
def analyze_conversation(log_path, drift_types):
return {"results": []}
# After - properly typed
def analyze_conversation(
log_path: str,
drift_types: list[str]
) -> dict[str, list[str]]:
"""Analyze conversation log for drift."""
return {"results": []}For optional parameters:
from typing import Optional
def detect_drift(
conversation: dict,
config: Optional[dict] = None
) -> list[str]:
"""Detect drift in conversation."""
passUnused Imports (F401)
When flake8 reports unused imports:
# Before - flake8: 'json' imported but unused
import json
import os
def get_path():
return os.getcwd()
# After - removed unused import
import os
def get_path():
return os.getcwd()Automated tools can help:
# autoflake removes unused imports
autoflake --remove-all-unused-imports --in-place src/drift/core/parser.pyTrailing Whitespace (W291)
# Auto-fix with black
black src/drift/
# Or manually in your editor (most editors can trim on save)Missing Blank Lines (E302, E305)
# Before - flake8: expected 2 blank lines, found 1
class DriftDetector:
pass
class Parser:
pass
# After - proper spacing
class DriftDetector:
pass
class Parser:
passBlack auto-fixes these:
black src/drift/Workflow: Fixing Linting Errors
1. Run Check Script
./lint.sh2. Auto-Fix What's Possible
./lint.sh --fixThis automatically fixes:
- Import ordering (isort)
- Code formatting (black)
- Line length issues (black wraps lines)
- Trailing whitespace (black)
- Blank line spacing (black)
3. Fix Remaining Issues Manually
After auto-fix, check what's left:
./lint.shManually fix:
- Type hints (mypy errors)
- Unused imports (if autoflake not run)
- Logical issues (like undefined names)
4. Verify All Pass
./lint.shShould see no errors before committing.
How to Configure Linters in Your Editor
VS Code
Add to .vscode/settings.json:
{
"python.linting.enabled": true,
"python.linting.flake8Enabled": true,
"python.linting.flake8Args": ["--max-line-length=100"],
"python.formatting.provider": "black",
"python.formatting.blackArgs": ["--line-length=100"],
"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}
}PyCharm
- Settings → Tools → File Watchers
- Add watcher for Black
- Add watcher for isort
- Configure mypy as external tool
How to Interpret Linting Output
flake8 Output
src/drift/core/parser.py:45:80: E501 line too long (103 > 100 characters)Format: file:line:column: code description
- E501: Error code (look up in flake8 docs)
- Line 45, column 80: Where the issue is
mypy Output
src/drift/core/parser.py:23: error: Function is missing a return type annotation- Line 23: Where the issue is
- Clear description of what's missing
black Output
would reformat src/drift/core/parser.py- Tells you which files would change
- Use
--diffto see exact changes before applying
Common Type Hint Patterns
Function with Multiple Return Types
from typing import Union
def get_config(as_dict: bool = False) -> Union[Config, dict]:
"""Get configuration."""
if as_dict:
return {"key": "value"}
return Config()Generator Functions
from typing import Iterator
def iter_messages(log_path: str) -> Iterator[dict]:
"""Iterate messages in log file."""
with open(log_path) as f:
for line in f:
yield json.loads(line)Type Aliases
from typing import TypeAlias
DriftResults: TypeAlias = dict[str, list[str]]
def analyze(log: str) -> DriftResults:
"""Analyze log for drift."""
return {"incomplete_work": ["instance1"]}How to Handle Third-Party Type Issues
When mypy complains about missing stubs for third-party libraries:
Option 1: Install Type Stubs
pip install types-boto3 types-clickOption 2: Add to mypy Config
In pyproject.toml:
[tool.mypy]
ignore_missing_imports = trueOr per-import:
import some_untyped_library # type: ignorePre-Commit Checklist
Before creating a commit:
- Run
./lint.sh --fixto auto-fix what's possible - Run
./lint.shto check for remaining issues - Fix any remaining manual issues
- Verify clean:
./lint.shshould show no errors
This ensures code quality and prevents failed CI checks.
Troubleshooting
Black and flake8 Disagree
Some conflicts (like E203) are configured to be ignored in flake8 config. Check pyproject.toml for ignored rules.
isort Breaks Import Groups
Use --profile=black to ensure isort is compatible with black:
isort . --profile=blackmypy False Positives
Sometimes mypy gets confused. Use # type: ignore sparingly:
result = complex_function() # type: ignore[return-value]Better: Fix the type hint to be accurate.
Linters Run Slow
Run on specific files during development:
black src/drift/core/parser.py
flake8 src/drift/core/parser.py
mypy src/drift/core/parser.pyRun full suite before committing.
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.

