extractum-skills / rules
Cursor rule44 starsChanged 10 months agoMITView on GitHub
Docstring and documentation standards
- Reads credentials
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 1,533 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 repository7 other files it gives its agents.
- .cursor/rules/00-project-overview.mdcCursor rule
- .cursor/rules/05-solution-design.mdcCursor rule
- .cursor/rules/10-python-standards.mdcCursor rule
- .cursor/rules/20-type-annotations.mdcCursor rule
- .cursor/rules/30-logging-standards.mdcCursor rule
- .cursor/rules/50-error-handling.mdcCursor rule
- .cursor/rules/60-async-patterns.mdcCursor rule
The file
We split this 40-docstrings.mdc into the rules it gives an agent
6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Every Python file must have a module-level docstring:
- Distinctive: line 28
Use Google-style docstrings for functions:
- Distinctive: line 97
Use period at the end of single-line docstrings
- Distinctive: line 98
Use blank line after the summary in multi-line docstrings
- Distinctive: line 99
Keep lines under 80 characters when possible
- Distinctive: line 100
Use imperative mood ("Create...", "Return...", "Validate...")
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 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: "Docstring and documentation standards"
globs:
- "**/*.py"
alwaysApply: false
priority: 5
---
# Docstring Standards
## Module Docstrings
Every Python file must have a module-level docstring:
```python
"""
Claude Code Agent SDK - RAG Agent Script.
This script demonstrates how to use the Claude Agent SDK to run an AI agent
that can interact with files and execute commands.
"""
```
---
## Function Docstrings
Use Google-style docstrings for functions:
### Simple Functions
```python
def _log_separator(logger: logging.Logger) -> None:
"""Log a separator line."""
logger.info(SEPARATOR_CHAR * SEPARATOR_LENGTH)
```
### Functions with Arguments
```python
async def run_agent(prompt: str, logger: logging.Logger) -> AgentResultSummary:
"""
Run the Claude agent with the given prompt.
Args:
prompt: The prompt/command for the agent to execute.
logger: Logger instance for output.
Returns:
Dictionary containing the result summary.
Raises:
ValueError: If ANTHROPIC_API_KEY is not set.
Exception: If agent execution fails.
"""
```
---
## Class and TypedDict Docstrings
```python
class AgentResultSummary(TypedDict, total=False):
"""Type definition for agent execution result summary."""
prompt: str
messages: list[dict[str, Any]]
total_cost_usd: float
num_turns: int
success: bool
```
---
## Private Function Docstrings
Even private functions (prefixed with `_`) should have docstrings:
```python
def _validate_api_key() -> None:
"""Validate that the API key is available in environment."""
...
def _create_agent_options() -> ClaudeAgentOptions:
"""Create and return agent options with default configuration."""
...
def _format_tool_use(block: ToolUseBlock) -> str:
"""Format a tool use block as a readable string."""
...
```
---
## Docstring Formatting
- Use period at the end of single-line docstrings
- Use blank line after the summary in multi-line docstrings
- Keep lines under 80 characters when possible
- Use imperative mood ("Create...", "Return...", "Validate...")
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.

