# Development Workflow

## Development Process

### Local Development
1. Server Management
   ```bash
   python manage.py tailwind runserver  # Required command for local development
   ```

2. URL Access
   - Production: http://thrillwiki.com
   - Avoid using localhost

### Code Organization

1. Template Structure
   - Base templates in templates/
   - HTMX partials in model-specific partials/ folders
   - Consistent naming conventions
   - Reusable components

2. Feature Development
   - Model changes
   - URL configuration
   - View implementation
   - Template creation
   - HTMX/AlpineJS integration

### Git Workflow

1. Version Control
   - All changes must be committed
   - Detailed commit messages required
   - Push directly to main branch
   - Regular commits for trackability

2. Commit Message Format
   ```
   [Component] Brief description of change

   - Detailed bullet points of changes
   - Impact on other components
   - Testing performed
   ```

## Testing Patterns

### Test Structure
- tests/ directory for test files
- Coverage tracking (.coverage)
- README.md in tests/ for documentation
- test_runner.py for custom configurations

### Testing Requirements
1. Functionality Testing
   - Core features
   - Edge cases
   - Error conditions
   - User workflows

2. Integration Testing
   - Cross-component functionality
   - External service integration
   - Database operations
   - Cache behavior

3. UI Testing
   - HTMX interactions
   - AlpineJS functionality
   - Responsive design
   - Browser compatibility

### Testing Guidelines
- Write tests for new features
- Update tests for modifications
- Maintain test coverage
- Document test scenarios

## Release Process

### Pre-Release Checklist
1. Code Quality
   - All tests passing
   - Coverage maintained
   - Linting clean
   - Documentation updated

2. Feature Verification
   - Core functionality tested
   - HTMX interactions verified
   - AlpineJS behavior confirmed
   - Cross-browser testing

### Deployment Steps
1. Code Preparation
   - Commit all changes
   - Push to main branch
   - Verify build success

2. Post-Deployment
   - Verify site functionality
   - Check error logs
   - Monitor performance
   - Validate new features

## Project Standards

### Code Style
1. Python
   - Follow PEP 8
   - Use type hints
   - Document functions
   - Clear variable names

2. Templates
   - Consistent indentation
   - Organized partial templates
   - Clear component structure
   - Documented HTMX attributes

3. JavaScript
   - AlpineJS best practices
   - Clean function names
   - Documented interactions
   - Minimal complexity

### Documentation Requirements
1. Code Documentation
   - Docstrings for Python code
   - Comment complex logic
   - Update README files
   - Maintain context files

2. Template Documentation
   - Document HTMX patterns
   - Explain AlpineJS usage
   - Note partial dependencies
   - Document data requirements

### Best Practices
1. HTMX Usage
   - Partial templates in dedicated folders
   - Clear target attributes
   - Documented triggers
   - Error handling

2. AlpineJS Integration
   - Minimal state management
   - Clear x-data structures
   - Documented behaviors
   - Progressive enhancement

3. Django Patterns
   - Clear view logic
   - Optimized queries
   - Proper model relationships
   - Efficient template inheritance

## Quality Assurance

### Code Review Process
1. Self-Review
   - Test coverage
   - Documentation
   - Code standards
   - Performance impact

2. Testing Requirements
   - Local verification
   - Production testing
   - Error handling
   - Edge cases

### Performance Standards
1. Page Load
   - Optimize queries
   - Minimize requests
   - Efficient templates
   - Proper caching

2. Interaction Speed
   - Quick HTMX responses
   - Smooth transitions
   - Responsive UI
   - Error feedback

### Maintenance
1. Regular Tasks
   - Update dependencies
   - Review error logs
   - Monitor performance
   - Update documentation

2. Code Health
   - Refactor as needed
   - Remove unused code
   - Update patterns
   - Maintain standards
