Pakistani Tax Advisor Development
Expert full-stack development assistant for building and maintaining a Pakistani tax calculation application.
What This Skill Does
Provides specialized guidance for developing a modern Pakistani tax advisor application with FastAPI backend, React frontend, PostgreSQL database, and full compliance with Pakistani tax regulations (2024-25 fiscal year).
Technology Stack
**Backend**: FastAPI, Python 3.11+, SQLAlchemy ORM, JWT authentication**Frontend**: React 18, Tailwind CSS, Vite, modern React hooks**Database**: PostgreSQL with properly designed schemas**DevOps**: Docker containerization, GitHub Actions CI/CD**Tax System**: Pakistani tax slabs and fiscal year rulesPakistani Tax Rules (2024-25 Fiscal Year)
Apply these tax brackets for all calculations:
| Income Range (PKR) | Tax Rate |
|-------------------|----------|
| Up to 600,000 | No tax |
| 600,001 - 1,200,000 | 5% |
| 1,200,001 - 2,200,000 | 15% |
| 2,200,001 - 3,200,000 | 25% |
| 3,200,001 - 4,100,000 | 30% |
| Above 4,100,000 | 35% |
Development Instructions
1. Code Standards
**Python Backend**:
Follow PEP 8 style guidelines strictlyUse type hints for all function parameters and return valuesImplement async/await patterns for I/O operationsStructure endpoints with proper FastAPI dependency injectionValidate all request data using Pydantic models**React Frontend**:
Use functional components exclusivelyLeverage React hooks (useState, useEffect, useContext, etc.)Write modern ES6+ JavaScript with destructuring and arrow functionsKeep components small and focused on single responsibilitiesImplement proper error boundaries2. Tax Calculation Logic
When implementing tax calculations:
Use the exact tax slabs defined aboveCalculate tax progressively through bracketsFormat all currency values as Pakistani Rupees (PKR)Support Pakistani fiscal year (July to June)Validate income inputs before processingHandle edge cases (zero income, negative values, etc.)3. Security Requirements
Validate and sanitize all user inputs server-sideImplement JWT authentication properly with secure secret keysUse HTTPS for all production endpointsNever log sensitive user dataImplement rate limiting on API endpointsUse parameterized queries to prevent SQL injection4. Database Design
Design normalized schemas with proper foreign keysUse SQLAlchemy ORM models with relationshipsImplement database migrations using AlembicIndex frequently queried columnsStore monetary values as DECIMAL types, not FLOAT5. UI/UX Standards
Ensure mobile-responsive design using Tailwind CSSDisplay currency in Pakistani Rupee format with proper separatorsShow clear error messages in user-friendly languageProvide loading states for async operationsSupport both English and Urdu where appropriateUse accessible color contrasts and ARIA labels6. Testing Requirements
Write comprehensive tests for:
Tax calculation logic with various income scenariosAPI endpoints (success and error cases)Authentication flowsDatabase operationsFrontend components and user interactions7. Documentation
When adding features:
Update API documentation (OpenAPI/Swagger)Add inline code comments for complex logicDocument environment variables in READMEKeep deployment instructions currentUpdate changelog for version releases8. DevOps Practices
Containerize services using DockerDefine multi-stage builds for optimizationSet up CI/CD pipelines in GitHub ActionsUse environment variables for configurationImplement health check endpointsExample Usage
When asked to "add a new tax calculation endpoint":
1. Create a Pydantic model for the request:
```python
class TaxCalculationRequest(BaseModel):
annual_income: Decimal
fiscal_year: str = "2024-25"
```
2. Implement the calculation function using Pakistani tax slabs
3. Create a FastAPI endpoint with proper validation and error handling
4. Add corresponding frontend form using React and Tailwind CSS
5. Write unit tests for the calculation logic
6. Update API documentation
Important Constraints
Always use Pakistani tax rules for the current fiscal year (2024-25)Currency must always be PKR, not USD or other currenciesFollow the existing code patterns in the projectPrioritize security and data validation in all featuresMaintain backwards compatibility when updating APIsEnsure all changes are mobile-responsiveNotes
The application is designed for Pakistani tax compliance specificallyTax rules may change annually; version the tax logic appropriatelyConsider edge cases like salaried vs business income differencesKeep calculations transparent and auditable for users