Skip to content

Commit e6439e7

Browse files
committed
cursor,windsurf(rules[dev-loop]) Sync with latest python loop
1 parent 6dde524 commit e6439e7

File tree

4 files changed

+236
-0
lines changed

4 files changed

+236
-0
lines changed

.cursor/rules/avoid-debug-loops.mdc

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
description: When stuck in debugging loops, break the cycle by minimizing to an MVP, removing debugging cruft, and documenting the issue completely for a fresh approach
3+
globs: *.py
4+
alwaysApply: true
5+
---
6+
# Avoid Debug Loops
7+
8+
When debugging becomes circular and unproductive, follow these steps:
9+
10+
## Detection
11+
- You have made multiple unsuccessful attempts to fix the same issue
12+
- You are adding increasingly complex code to address errors
13+
- Each fix creates new errors in a cascading pattern
14+
- You are uncertain about the root cause after 2-3 iterations
15+
16+
## Action Plan
17+
18+
1. **Pause and acknowledge the loop**
19+
- Explicitly state that you are in a potential debug loop
20+
- Review what approaches have been tried and failed
21+
22+
2. **Minimize to MVP**
23+
- Remove all debugging cruft and experimental code
24+
- Revert to the simplest version that demonstrates the issue
25+
- Focus on isolating the core problem without added complexity
26+
27+
3. **Comprehensive Documentation**
28+
- Provide a clear summary of the issue
29+
- Include minimal but complete code examples that reproduce the problem
30+
- Document exact error messages and unexpected behaviors
31+
- Explain your current understanding of potential causes
32+
33+
4. **Format for Portability**
34+
- Present the problem in quadruple backticks for easy copying:
35+
36+
````
37+
# Problem Summary
38+
[Concise explanation of the issue]
39+
40+
## Minimal Reproduction Code
41+
```python
42+
# Minimal code example that reproduces the issue
43+
```
44+
45+
## Error/Unexpected Output
46+
```
47+
[Exact error messages or unexpected output]
48+
```
49+
50+
## Failed Approaches
51+
[Brief summary of approaches already tried]
52+
53+
## Suspected Cause
54+
[Your current hypothesis about what might be causing the issue]
55+
````
56+
57+
This format enables the user to easily copy the entire problem statement into a fresh conversation for a clean-slate approach.

.cursor/rules/git-commits.mdc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
description: git-commits: Git commit message standards and AI assistance
33
globs: git-commits: Git commit message standards and AI assistance | *.git/* .gitignore .github/* CHANGELOG.md CHANGES.md
4+
alwaysApply: true
45
---
56
# Optimized Git Commit Standards
67

.cursor/rules/notes-llms-txt.mdc

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
description: LLM-friendly markdown format for notes directories
3+
globs: notes/**/*.md,**/notes/**/*.md
4+
alwaysApply: true
5+
---
6+
7+
# Instructions for Generating LLM-Optimized Markdown Content
8+
9+
When creating or editing markdown files within the specified directories, adhere to the following guidelines to ensure the content is optimized for LLM understanding and efficient token usage:
10+
11+
1. **Conciseness and Clarity**:
12+
- **Be Brief**: Present information succinctly, avoiding unnecessary elaboration.
13+
- **Use Clear Language**: Employ straightforward language to convey ideas effectively.
14+
15+
2. **Structured Formatting**:
16+
- **Headings**: Utilize markdown headings (`#`, `##`, `###`, etc.) to organize content hierarchically.
17+
- **Lists**: Use bullet points (`-`) or numbered lists (`1.`, `2.`, etc.) to enumerate items clearly.
18+
- **Code Blocks**: Enclose code snippets within triple backticks (```) to distinguish them from regular text.
19+
20+
3. **Semantic Elements**:
21+
- **Emphasis**: Use asterisks (`*`) or underscores (`_`) for italicizing text to denote emphasis.
22+
- **Strong Emphasis**: Use double asterisks (`**`) or double underscores (`__`) for bold text to highlight critical points.
23+
- **Inline Code**: Use single backticks (`) for inline code references.
24+
25+
4. **Linking and References**:
26+
- **Hyperlinks**: Format links using `[Link Text](mdc:URL)` to provide direct access to external resources.
27+
- **References**: When citing sources, use footnotes or inline citations to maintain readability.
28+
29+
5. **Avoid Redundancy**:
30+
- **Eliminate Repetition**: Ensure that information is not unnecessarily repeated within the document.
31+
- **Use Summaries**: Provide brief summaries where detailed explanations are not essential.
32+
33+
6. **Standard Compliance**:
34+
- **llms.txt Conformance**: Structure the document in alignment with the `llms.txt` standard, which includes:
35+
- An H1 heading with the project or site name.
36+
- A blockquote summarizing the project's purpose.
37+
- Additional markdown sections providing detailed information.
38+
- H2-delimited sections containing lists of URLs for further details.
39+
40+
By following these guidelines, the markdown files will be tailored for optimal LLM processing, ensuring that the content is both accessible and efficiently tokenized for AI applications.
41+
42+
For more information on the `llms.txt` standard, refer to the official documentation: https://llmstxt.org/

.windsurfrules

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# libtmux Python Project Rules
2+
3+
<project_stack>
4+
- uv - Python package management and virtual environments
5+
- ruff - Fast Python linter and formatter
6+
- py.test - Testing framework
7+
- pytest-watcher - Continuous test runner
8+
- mypy - Static type checking
9+
- doctest - Testing code examples in documentation
10+
</project_stack>
11+
12+
<coding_style>
13+
- Use a consistent coding style throughout the project
14+
- Format code with ruff before committing
15+
- Run linting and type checking before finalizing changes
16+
- Verify tests pass after each significant change
17+
</coding_style>
18+
19+
<python_docstrings>
20+
- Use reStructuredText format for all docstrings in src/**/*.py files
21+
- Keep the main description on the first line after the opening `"""`
22+
- Use NumPy docstyle for parameter and return value documentation
23+
- Format docstrings as follows:
24+
```python
25+
"""Short description of the function or class.
26+
27+
Detailed description using reStructuredText format.
28+
29+
Parameters
30+
----------
31+
param1 : type
32+
Description of param1
33+
param2 : type
34+
Description of param2
35+
36+
Returns
37+
-------
38+
type
39+
Description of return value
40+
"""
41+
```
42+
</python_docstrings>
43+
44+
<python_doctests>
45+
- Use narrative descriptions for test sections rather than inline comments
46+
- Format doctests as follows:
47+
```python
48+
"""
49+
Examples
50+
--------
51+
Create an instance:
52+
53+
>>> obj = ExampleClass()
54+
55+
Verify a property:
56+
57+
>>> obj.property
58+
'expected value'
59+
"""
60+
```
61+
- Add blank lines between test sections for improved readability
62+
- Keep doctests simple and focused on demonstrating usage
63+
- Move complex examples to dedicated test files at tests/examples/<path_to_module>/test_<example>.py
64+
- Utilize pytest fixtures via doctest_namespace for complex scenarios
65+
</python_doctests>
66+
67+
<testing_practices>
68+
- Run tests with `uv run py.test` before committing changes
69+
- Use pytest-watcher for continuous testing: `uv run ptw . --now --doctest-modules`
70+
- Fix any test failures before proceeding with additional changes
71+
</testing_practices>
72+
73+
<git_workflow>
74+
- Make atomic commits with conventional commit messages
75+
- Start with an initial commit of functional changes
76+
- Follow with separate commits for formatting, linting, and type checking fixes
77+
</git_workflow>
78+
79+
<git_commit_standards>
80+
- Use the following commit message format:
81+
```
82+
Component/File(commit-type[Subcomponent/method]): Concise description
83+
84+
why: Explanation of necessity or impact.
85+
what:
86+
- Specific technical changes made
87+
- Focused on a single topic
88+
89+
refs: #issue-number, breaking changes, or relevant links
90+
```
91+
92+
- Common commit types:
93+
- **feat**: New features or enhancements
94+
- **fix**: Bug fixes
95+
- **refactor**: Code restructuring without functional change
96+
- **docs**: Documentation updates
97+
- **chore**: Maintenance (dependencies, tooling, config)
98+
- **test**: Test-related updates
99+
- **style**: Code style and formatting
100+
101+
- Prefix Python package changes with:
102+
- `py(deps):` for standard packages
103+
- `py(deps[dev]):` for development packages
104+
- `py(deps[extra]):` for extras/sub-packages
105+
106+
- General guidelines:
107+
- Subject line: Maximum 50 characters
108+
- Body lines: Maximum 72 characters
109+
- Use imperative mood (e.g., "Add", "Fix", not "Added", "Fixed")
110+
- Limit to one topic per commit
111+
- Separate subject from body with a blank line
112+
- Mark breaking changes clearly: `BREAKING:`
113+
</git_commit_standards>
114+
115+
<pytest_testing_guidelines>
116+
- Use fixtures from conftest.py instead of monkeypatch and MagicMock when available
117+
- For instance, if using libtmux, use provided fixtures: server, session, window, and pane
118+
- Document in test docstrings why standard fixtures weren't used for exceptional cases
119+
- Use tmp_path (pathlib.Path) fixture over Python's tempfile
120+
- Use monkeypatch fixture over unittest.mock
121+
</pytest_testing_guidelines>
122+
123+
<import_guidelines>
124+
- Prefer namespace imports over importing specific symbols
125+
- Import modules and access attributes through the namespace:
126+
- Use `import enum` and access `enum.Enum` instead of `from enum import Enum`
127+
- This applies to standard library modules like pathlib, os, and similar cases
128+
- For typing, use `import typing as t` and access via the namespace:
129+
- Access typing elements as `t.NamedTuple`, `t.TypedDict`, etc.
130+
- Note primitive types like unions can be done via `|` pipes
131+
- Primitive types like list and dict can be done via `list` and `dict` directly
132+
- Benefits of namespace imports:
133+
- Improves code readability by making the source of symbols clear
134+
- Reduces potential naming conflicts
135+
- Makes import statements more maintainable
136+
</import_guidelines>

0 commit comments

Comments
 (0)