
# Communication Rules

- Present answers to questions immediately, with detailed explanations added afterward.
- There is no need to paraphrase the user's questions in your own words.
- When answering with speculation or prediction without specific information sources, always explicitly state this.
- Propose multiple solutions and clearly indicate their merits and demerits.
- Actively consider new technologies and approaches.
- If information sources exist, clearly cite them together at the end of your response.
- Briefly explain the rationale for changes.

# General Rules

- When printing tables in cascade, do not use Markdown. Use a monospace font.

# Code Generation

- Ensure generated code is executable by repeatedly verifying its operation.
- For code modification requests, display enough lines before and after the changed portions for positive identification of the qarea of code - but avoid unnecessary repetition of code when possible.
- Divide into multiple code blocks as needed.
- Prioritize simple and non-redundant implementations.
- Use Google-style docstrings for code documentation.
- Use GMT or UTC times whenever possible to avoide obfuscation.

# Development Flow

- My build system in Python is "uv".
- My version control system is "git".
- My package manager is "uv".
- My virtual environment manager is "uv".
- When attempting to run executables (like pytest) wihin a uv envirionment, issue command "uv run" so that the virtual environment is guaranteed to be the right one.
- My testing framework is "pytest".
- When developing unit tests, use pytest, and the pytest-mock plugin.
- Leverage pytest fixtures and plugins to improve test quality and efficiency.
- Use pytest's built-in features like fixtures, parametrization and markers to make tests more flexible and reusable.
- Always offer to set up pre-commit hooks for code quality and formatting. Use ruff check, ruff format and isort.

## Feature Development Steps

1. Create specifications for the Minimum Viable Product
2. Select and install development languages and frameworks needed for the specifications
3. Organize folder structure according to the development language and framework templates
4. List the files needed to create a Minimum Viable Product
5. Create tests that meet the specifications based on TDD principles
6. Follow the RED - GREEN - REFACTORING principles and implement step by step

## Bug Fix Steps

1. Use tests to identify the cause
2. If the cause cannot be identified using tests, comprehensively check the implementation to identify the cause
3. Examine areas affected by the fix
4. Always adhere to TDD principles during the fix process
5. Follow the RED - GREEN - REFACTORING principles and implement fixes gradually
6. Run tests
7. If tests fail, return to step 4; if successful, consider the fix complete

## Testing

1. Use the `mocker` fixture to mock dependencies
2. Use pytest-cov to measure test coverage
3. For tests only, avoid DRY (Don't Repeat Yourself) descriptions even if they become redundant.
4. When patching, patch the name where it is used, not where it is defined.

# Shortcuts

- `/plan`    : Clearly and thoroughly outline the work plan and confirm there are no discrepancies. Only proceed with execution after reaching agreement.
- `/debug`   : Identify the root cause of bugs. List 5-7 possible causes and narrow them down to 1-2. Validate hypotheses using logs before applying fixes.
- `/review`  : Review code from perspectives such as quality, efficiency, security, and maintainability, and provide specific improvement suggestions.
- `/refactor`: Propose refactoring to improve readability and maintainability without changing functionality.
- `/optimize`: Analyze code from a performance optimization perspective and propose specific improvements.
- `/test`    : Propose appropriate testing strategies and specific test code.
- `/doc`     : Assist with code documentation. Clearly explain function purposes, arguments, return values, etc.
