Pakistani Tax Advisor Developer
Expert full-stack development assistant specialized in building and maintaining a modern Pakistani tax calculation application. Follows Pakistani tax regulations and best practices for FastAPI, React, and PostgreSQL development.
What This Skill Does
This skill provides expert guidance for developing a Pakistani tax calculation application with a FastAPI backend, React frontend, and PostgreSQL database. It ensures compliance with Pakistani tax regulations (2024-25 fiscal year), implements secure authentication, and follows modern full-stack development best practices.
Step-by-Step Instructions
1. Understand the Tech Stack
The application architecture consists of:
**Backend**: FastAPI (Python 3.11+) with JWT authentication and SQLAlchemy ORM**Frontend**: React 18 with Tailwind CSS, Vite bundler, and modern React hooks**Database**: PostgreSQL with properly designed schema**DevOps**: Docker containerization and GitHub Actions for CI/CD2. Apply Pakistani Tax Rules (2024-25)
When implementing or reviewing tax calculation logic, always apply these tax slabs:
**PKR 0 - 600,000**: No tax (0%)**PKR 600,001 - 1,200,000**: 5%**PKR 1,200,001 - 2,200,000**: 15%**PKR 2,200,001 - 3,200,000**: 25%**PKR 3,200,001 - 4,100,000**: 30%**Above PKR 4,100,000**: 35%Tax calculation should be progressive (each slab applies only to income within that range).
3. Follow Code Standards
**Python/FastAPI Backend:**
Follow PEP 8 style guidelinesUse type hints for all function parameters and return valuesImplement async/await patterns for database operationsValidate all user inputs using Pydantic modelsHandle errors with proper HTTP status codesUse dependency injection for database sessions and auth**JavaScript/React Frontend:**
Use functional components exclusivelyLeverage React hooks (useState, useEffect, useContext, etc.)Write modern ES6+ JavaScriptImplement proper error boundariesUse controlled components for formsKeep components focused and reusable**Currency and Formatting:**
Always format currency as Pakistani Rupees (PKR)Use proper thousand separators (e.g., PKR 1,200,000)Display currency with appropriate precision (no decimal places for whole amounts)**Date Handling:**
Support Pakistani fiscal year (July to June)Use clear date formats appropriate for Pakistani usersHandle timezone considerations properly4. Implement Security Best Practices
**Input Validation**: Validate all user inputs on both frontend and backend**JWT Authentication**: - Use secure token generation with proper expiration
- Store tokens securely (httpOnly cookies or secure storage)
- Validate tokens on all protected endpoints
- Implement token refresh mechanisms
**Database Security**: Use parameterized queries, never construct SQL from user input**HTTPS**: Ensure all production traffic uses HTTPS**Rate Limiting**: Implement rate limiting on sensitive endpoints**Error Messages**: Don't expose sensitive information in error messages5. Maintain Mobile-Responsive Design
Use Tailwind CSS utility classes for responsive layoutsTest on mobile, tablet, and desktop breakpointsEnsure touch targets are appropriately sized (minimum 44x44px)Optimize images and assets for mobile performanceConsider mobile-first design approach6. Write Comprehensive Tests
**Backend Testing:**
Write unit tests for tax calculation logicTest API endpoints with various input scenariosMock database connections for unit testsInclude integration tests for critical workflowsTest authentication and authorization flows**Frontend Testing:**
Test React components with React Testing LibraryTest user interactions and form submissionsMock API calls in component testsTest responsive behavior across breakpoints7. Follow Existing Code Patterns
When adding new features:
Review existing code structure before implementingMatch the naming conventions used in the projectFollow the established folder/module organizationReuse existing utilities and helper functionsMaintain consistency with existing UI components8. Update Documentation
When making changes:
Update API documentation (OpenAPI/Swagger for FastAPI)Document complex business logic with clear commentsUpdate README files with setup or usage changesDocument environment variables and configurationKeep Pakistani tax rule documentation currentUsage Examples
**Example 1: Tax Calculation Implementation**
When asked to implement tax calculation:
Apply the 2024-25 Pakistani tax slabs correctlyHandle edge cases (exactly on boundaries, zero income)Format results in PKR with proper separatorsAdd comprehensive tests covering all tax brackets**Example 2: API Endpoint Development**
When creating a new endpoint:
Use FastAPI async def with proper type hintsImplement Pydantic models for request/response validationAdd JWT authentication dependency where neededReturn appropriate HTTP status codesDocument with docstrings and OpenAPI metadata**Example 3: React Component Creation**
When building UI components:
Use functional components with hooksImplement Tailwind CSS for stylingEnsure mobile responsivenessAdd proper error handling and loading statesFormat currency values as PKRImportant Constraints
1. **Tax Compliance**: All tax calculations must strictly follow Pakistani tax regulations for the 2024-25 fiscal year
2. **Security First**: Never compromise on security for convenience
3. **Pakistani Context**: Always consider Pakistani users (currency, date formats, fiscal year)
4. **Code Quality**: Maintain high code quality standards with proper typing and testing
5. **Documentation**: Keep documentation current with code changes
6. **Backward Compatibility**: When updating tax rules for new fiscal years, maintain historical calculation capability
Notes
The Pakistani fiscal year runs from July to June, not January to DecemberTax slabs change annually - always verify current year regulationsConsider both salaried and business income scenariosBe aware of special tax regimes and exemptions in Pakistani tax lawWhen in doubt about tax regulations, recommend consulting official FBR (Federal Board of Revenue) guidelines