agentharness / rules
Cursor rule1 starsChanged 2 months agoMITView on GitHub
Use when writing or reviewing Python code — naming conventions, type hints, common pitfalls (mutable defaults, bare except, is-vs-==), and testing structure.
We split this python-conventions.mdc into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 31
Use them on function parameters and returns.
≈ “Common” is an estimate: at least 1 in 5 of the 6,350 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
--- description: "Use when writing or reviewing Python code — naming conventions, type hints, common pitfalls (mutable defaults, bare except, is-vs-==), and testing structure." --- ## Python Conventions This file is self-contained for day-to-day use. Deeper reference (needs the full harness checkout, not just this skill — these aren't bundled here since they're documentation, not something this skill runs): `languages/python/CONVENTIONS.md` (complete examples) and `languages/python/COPILOT_INSTRUCTIONS.md` (general agent operating principles for Python repos — inspect before changing, scope discipline, never claim a command passed without running it). ### Naming - `snake_case` — functions, variables. `PascalCase` — classes. `UPPER_SNAKE_CASE` — module-level constants. - Single underscore prefix for private (`_internal`); avoid double underscore except for genuine name-mangling needs. - Exceptions: `PascalCase` + `Error`/`Exception` suffix, specific not generic (`ValidationError`, not `BadThing`). ### Imports & structure Standard library → third-party → local, each group separated by a blank line. Absolute imports over relative. No `from module import *`. ### Type hints Use them on function parameters and returns. Match syntax to the project's minimum Python version — check `requires-python` in `pyproject.toml` before using `list[str]` (3.9+), `X | None` (3.10+), or `match/case` (3.10+). Don't silently raise the minimum version. ### Pitfalls to catch in review ```python # Mutable default argument — persists across calls, shared state bug def f(item, container=[]): # WRONG def f(item, container=None): # RIGHT — default to None, create inside # Bare/broad except — swallows KeyboardInterrupt, hides real errors except: # WRONG except Exception: # still too broad, usually except ValueError as e: # RIGHT — catch what you expect # `is` for value comparison — checks identity, not equality if user_id is 5: # WRONG if user_id == 5: # RIGHT (== for values, `is` only for None/True/False) ``` ### Testing `tests/` directory, `test_*.py` files, `test_*` functions, pytest fixtures for setup. See `patterns/testing/TDD.md` for the broader methodology — this skill covers Python-specific structure only. ### Formatting & tooling Defer to the project's `pyproject.toml` — don't impose Black/Ruff defaults over an existing configured formatter/linter. If unconfigured: Black or `ruff format` (88-char lines), `ruff check`, `mypy` for typing, `pytest` for tests.
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 3,978 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository77 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/accessibility.mdcCursor rule
- .cursor/rules/agentharness-router.mdcCursor rule
- .cursor/rules/agentic-loops.mdcCursor rule
- .cursor/rules/api-design.mdcCursor rule
- .cursor/rules/audit-review-followup.mdcCursor rule
- .cursor/rules/big-work-plan-review.mdcCursor rule
- .cursor/rules/branching.mdcCursor rule
- .cursor/rules/clean-architecture.mdcCursor rule
- .cursor/rules/code-review-api.mdcCursor rule
- .cursor/rules/code-review-db.mdcCursor rule
- .cursor/rules/code-review.mdcCursor rule
- .cursor/rules/code-review-ui.mdcCursor rule
- .cursor/rules/committing.mdcCursor rule
- .cursor/rules/database-conventions.mdcCursor rule
- .cursor/rules/dependency-audit.mdcCursor rule
- .cursor/rules/dependency-injection.mdcCursor rule
- .cursor/rules/design-patterns.mdcCursor rule
- .cursor/rules/docker-conventions.mdcCursor rule
- .cursor/rules/error-handling.mdcCursor rule
- .cursor/rules/file-placement-policy.mdcCursor rule
- .cursor/rules/github-issue-triage.mdcCursor rule
- .cursor/rules/go-conventions.mdcCursor rule
- .cursor/rules/harness-feedback.mdcCursor rule
- .cursor/rules/logging.mdcCursor rule
- .cursor/rules/multi-agent-coordination.mdcCursor rule
- .cursor/rules/mutation-testing.mdcCursor rule
- .cursor/rules/performance-profiling.mdcCursor rule
- .cursor/rules/planning-with-files.mdcCursor rule
- .cursor/rules/port-agent-config.mdcCursor rule
- .cursor/rules/project-bootstrap.mdcCursor rule
- .cursor/rules/react-best-practices.mdcCursor rule
- .cursor/rules/refactoring.mdcCursor rule
- .cursor/rules/requirements-clarification.mdcCursor rule
- .cursor/rules/security-review.mdcCursor rule
- .cursor/rules/solid-principles.mdcCursor rule
- .cursor/rules/testing.mdcCursor rule
- .cursor/rules/typescript-conventions.mdcCursor rule
- accessibilitySkill
- agentic-loopsSkill
- api-designSkill
- audit-review-followupSkill
- big-work-plan-reviewSkill
- branchingSkill
- clean-architectureSkill
- code-review-apiSkill
- code-review-dbSkill
- code-reviewSkill
- code-review-uiSkill
- committingSkill
- database-conventionsSkill
- dependency-auditSkill
- dependency-injectionSkill
- design-patternsSkill
- docker-conventionsSkill
- error-handlingSkill
- file-placement-policySkill
- github-issue-triageSkill
- The first 60 shown.
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.

