Development Rules
Language-Specific References
For language-specific rules, also read:
- TypeScript: references/typescript.md
Basic Principles
✅ Aggressive Refactoring
- Continuously improve code structure and readability
- Make code changes in small, safe steps
- Prioritize maintainability over initial implementation speed
❌ Unused "Just in Case" Code - YAGNI principle
- Don't write code for hypothetical future requirements
- Delete unused functions, variables, and imports immediately
- Keep codebase lean and focused on current needs
Comment Writing Rules
- Function Description Focus: Describe what the code "does", not how it works
- No Historical Information: Do not record development history in comments
- Timeless: Write only content that remains valid whenever read
- Conciseness: Keep explanations to necessary minimum
- Explain "Why": Comments should explain reasoning, not implementation details
Function Design
Parameter Management
- 0-2 parameters maximum: Use structured data (object/struct/dict) for 3+ parameters
✅ Good: createUser({name, email, role})
❌ Avoid: createUser(name, email, role, department, startDate)
Note: Use your language's idiomatic approach for grouping parameters
Dependency Injection
- Inject external dependencies explicitly: Ensure testability and modularity
- Pass dependencies as parameters (functions, constructors, or other language-appropriate mechanisms)
- Avoid global state, direct instantiation, or implicit dependencies
- Prefer interfaces/contracts over concrete implementations where applicable
Error Handling
Absolute Rule: Error suppression prohibited. All errors must have log output and appropriate handling.
Layer-Specific Error Handling
- Presentation Layer: Convert errors to user-friendly messages, log excluding sensitive information
- Business Layer: Detect business rule violations, propagate domain-specific errors
- Data Layer: Convert technical errors to domain errors
Structured Logging and Sensitive Information Protection
Never include sensitive information in logs:
- Passwords, tokens, API keys, secrets
- Credit card numbers, personal identification numbers
- Any personally identifiable information (PII)
Asynchronous Error Handling
- Use appropriate error handling mechanisms for your language
- Always log and appropriately propagate errors
- Set up global error handlers where applicable
Clean Code Principles
✅ Recommended Practices
- Delete unused code immediately
- Remove debug statements and temporary logging
- Use meaningful variable and function names
- Keep functions small and focused on single responsibility
❌ Avoid These Practices
- Commented-out code (use version control for history)
- Magic numbers without explanation
- Deep nesting (prefer early returns)
- Functions that do multiple unrelated things
Refactoring Techniques
Basic Policy
- Small Steps: Maintain always-working state through gradual improvements
- Safe Changes: Minimize the scope of changes at once
- Behavior Guarantee: Ensure existing behavior remains unchanged while proceeding
Implementation Procedure
- Understand Current State
- Make Gradual Changes
- Verify Behavior
- Final Validation
Priority Order
- Duplicate Code Removal
- Large Function Division
- Complex Conditional Branch Simplification
- Architecture Improvement
Performance Considerations
General Principles
- Measure before optimizing (avoid premature optimization)
- Focus on algorithmic complexity over micro-optimizations
- Consider memory usage, especially with large datasets
- Use appropriate data structures for the use case
Resource Management
- Properly close files, connections, and other resources
- Be mindful of memory leaks in long-running applications
- Use efficient algorithms for data processing
Code Organization
File Structure
- Group related functionality together
- Separate concerns (business logic, data access, presentation)
- Use consistent naming conventions throughout the project
- Keep configuration separate from business logic
Modularity
- Write small, focused modules/functions
- Minimize dependencies between modules
- Use clear interfaces between components
- Follow single responsibility principle
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: shinpr-agentic-code-coding-rules3description: Development Rules4---56# Development Rules78## Language-Specific References910For language-specific rules, also read:11- **TypeScript**: [references/typescript.md](references/typescript.md)1213## Basic Principles1415✅ **Aggressive Refactoring**16- Continuously improve code structure and readability17- Make code changes in small, safe steps18- Prioritize maintainability over initial implementation speed1920❌ **Unused "Just in Case" Code** - YAGNI principle21- Don't write code for hypothetical future requirements22- Delete unused functions, variables, and imports immediately23- Keep codebase lean and focused on current needs2425## Comment Writing Rules2627- **Function Description Focus**: Describe what the code "does", not how it works28- **No Historical Information**: Do not record development history in comments29- **Timeless**: Write only content that remains valid whenever read30- **Conciseness**: Keep explanations to necessary minimum31- **Explain "Why"**: Comments should explain reasoning, not implementation details3233## Function Design3435**Parameter Management**36- **0-2 parameters maximum**: Use structured data (object/struct/dict) for 3+ parameters37 ```38 ✅ Good: createUser({name, email, role})39 ❌ Avoid: createUser(name, email, role, department, startDate)40 ```41 *Note: Use your language's idiomatic approach for grouping parameters*4243**Dependency Injection**44- **Inject external dependencies explicitly**: Ensure testability and modularity45- Pass dependencies as parameters (functions, constructors, or other language-appropriate mechanisms)46- Avoid global state, direct instantiation, or implicit dependencies47- Prefer interfaces/contracts over concrete implementations where applicable4849## Error Handling5051**Absolute Rule**: Error suppression prohibited. All errors must have log output and appropriate handling.5253**Layer-Specific Error Handling**54- **Presentation Layer**: Convert errors to user-friendly messages, log excluding sensitive information55- **Business Layer**: Detect business rule violations, propagate domain-specific errors56- **Data Layer**: Convert technical errors to domain errors5758**Structured Logging and Sensitive Information Protection**59Never include sensitive information in logs:60- Passwords, tokens, API keys, secrets61- Credit card numbers, personal identification numbers62- Any personally identifiable information (PII)6364**Asynchronous Error Handling**65- Use appropriate error handling mechanisms for your language66- Always log and appropriately propagate errors67- Set up global error handlers where applicable6869## Clean Code Principles7071✅ **Recommended Practices**72- Delete unused code immediately73- Remove debug statements and temporary logging74- Use meaningful variable and function names75- Keep functions small and focused on single responsibility7677❌ **Avoid These Practices**78- Commented-out code (use version control for history)79- Magic numbers without explanation80- Deep nesting (prefer early returns)81- Functions that do multiple unrelated things8283## Refactoring Techniques8485**Basic Policy**86- **Small Steps**: Maintain always-working state through gradual improvements87- **Safe Changes**: Minimize the scope of changes at once88- **Behavior Guarantee**: Ensure existing behavior remains unchanged while proceeding8990**Implementation Procedure**911. Understand Current State922. Make Gradual Changes933. Verify Behavior944. Final Validation9596**Priority Order**971. Duplicate Code Removal982. Large Function Division993. Complex Conditional Branch Simplification1004. Architecture Improvement101102## Performance Considerations103104**General Principles**105- Measure before optimizing (avoid premature optimization)106- Focus on algorithmic complexity over micro-optimizations107- Consider memory usage, especially with large datasets108- Use appropriate data structures for the use case109110**Resource Management**111- Properly close files, connections, and other resources112- Be mindful of memory leaks in long-running applications113- Use efficient algorithms for data processing114115## Code Organization116117**File Structure**118- Group related functionality together119- Separate concerns (business logic, data access, presentation)120- Use consistent naming conventions throughout the project121- Keep configuration separate from business logic122123**Modularity**124- Write small, focused modules/functions125- Minimize dependencies between modules126- Use clear interfaces between components127- Follow single responsibility principle128129---130> Converted and distributed by [TomeVault](https://tomevault.io/claim/shinpr) — claim your Tome and manage your conversions.131<!-- tomevault:4.0:skill_md:2026-04-11 -->