System rules for safe code refactoring with DeepSeek R1, requiring test coverage verification, incremental changes, and behavior preservation checks.
# DeepSeek R1 Code Refactoring Safety Rules ## Pre-Refactoring Checks 1. Verify existing test coverage — NEVER refactor untested code without adding tests first 2. Understand the current behavior by reading tests and documentation 3. Identify all callers/consumers of the code being refactored 4. Check for side effects: database writes, API calls, file I/O, global state mutations 5. Confirm the refactoring goal: performance, readability, maintainability, or correctness ## Refactoring Rules <think> Before each refactoring step: 1. What is the current behavior? 2. What is the desired behavior after refactoring? 3. How can I verify behavior is preserved? 4. What could go wrong? </think> ### Incremental Changes - One refactoring pattern per commit - Each commit must pass all existing tests - If a test needs to change, explain why in the commit message ### Behavior Preservation - Extract Method: new method must be called with identical arguments - Rename: update ALL references (grep the entire codebase) - Move: update all imports and re-export from original location if public API - Inline: verify no side effects in the inlined expression - Change Signature: update all callers before removing old signature ## Post-Refactoring Verification 1. All existing tests pass without modification (unless the refactoring intentionally changes behavior) 2. No new warnings or linting errors introduced 3. Bundle size does not increase by more than 5% 4. No performance regression (benchmark if the refactored code is in a hot path) ## Prohibited Refactorings - Changing public API contracts without explicit approval - Combining refactoring with feature changes in the same commit - Removing "dead code" without verifying it's truly unreachable - Refactoring code you don't understand — ask first
System rules for designing inter-service communication in microservices architectures with DeepSeek Coder, covering sync/async patterns, error handling, and resilience.
System rules for generating content in multiple languages with DeepSeek V3, covering translation quality, cultural adaptation, locale-specific formatting, and quality assurance.
System rules for using DeepSeek V3 to generate clear, maintainable technical documentation including API docs, architecture docs, and onboarding guides.
System rules for DeepSeek Coder to generate optimized database queries, with requirements for EXPLAIN analysis, indexing recommendations, and performance targets.
System rules for using DeepSeek V3 to generate infrastructure code, CI/CD pipelines, and operational runbooks with security and reliability best practices.
System rules for configuring DeepSeek R1 as an academic writing assistant that maintains scholarly tone, proper citations, and disciplinary conventions.