{ "templates": [ { "id": "add-tests", "name": "Add unit tests", "description": "Create comprehensive unit tests for this module to ensure code quality and prevent regressions", "applyTo": "src/**/*.{js,ts,jsx,tsx}", "excludeFileContains": "test", "priority": "high", "aiInstruction": "Create a test file with the same name plus '.test' suffix (e.g., utils.test.ts). Use Jest or Vitest. Write tests for all exported functions covering: 1) happy path scenarios, 2) edge cases, 3) error conditions. Aim for >80% code coverage." }, { "id": "add-documentation", "name": "Add JSDoc/TSDoc comments", "description": "Document the public API with JSDoc/TSDoc comments explaining parameters, return values, and usage examples", "applyTo": "src/**/*.{js,ts}", "fileContains": "export", "priority": "medium" }, { "id": "error-handling", "name": "Add error handling", "description": "Implement proper error handling with try-catch blocks and meaningful error messages", "applyTo": "src/**/*.{js,ts}", "fileContains": "async ", "priority": "high", "aiInstruction": "Wrap async operations in try-catch blocks. Create custom error classes for different error types. Log errors with context (function name, parameters). Return user-friendly error messages. Consider using a centralized error handler." }, { "id": "typescript-types", "name": "Add TypeScript types", "description": "Define proper TypeScript interfaces/types for better type safety and developer experience", "applyTo": "src/**/*.ts", "fileContains": "any", "priority": "medium" }, { "id": "react-prop-types", "name": "Add prop types validation", "description": "Add PropTypes or TypeScript interfaces to validate component props", "applyTo": "src/**/*.{jsx,tsx}", "fileContains": "export", "priority": "medium" }, { "id": "react-accessibility", "name": "Add accessibility attributes", "description": "Ensure component is accessible with proper ARIA labels, keyboard navigation, and semantic HTML", "applyTo": "src/components/**/*.{jsx,tsx}", "priority": "high" }, { "id": "api-error-handling", "name": "Handle API errors", "description": "Add proper error handling for API calls including network errors, timeouts, and error responses", "applyTo": "src/**/*.{js,ts}", "fileContains": "fetch(", "priority": "high" }, { "id": "env-variables", "name": "Use environment variables", "description": "Move hardcoded API endpoints and secrets to environment variables for security and flexibility", "applyTo": "src/**/*.{js,ts}", "fileContains": "http", "priority": "high" }, { "id": "sql-injection", "name": "Prevent SQL injection", "description": "Use parameterized queries or ORM to prevent SQL injection vulnerabilities", "applyTo": "src/**/*.{js,ts,py}", "fileContains": "SELECT", "priority": "high" }, { "id": "input-validation", "name": "Add input validation", "description": "Validate and sanitize user inputs to prevent security vulnerabilities", "applyTo": "src/**/*.{js,ts}", "fileContains": "req.body", "priority": "high" }, { "id": "dependency-security", "name": "Review dependencies", "description": "Run npm audit or similar to check for security vulnerabilities in dependencies", "applyTo": "package.json", "priority": "medium" }, { "id": "git-ignore-secrets", "name": "Update .gitignore", "description": "Ensure sensitive files (.env, credentials, etc.) are in .gitignore to prevent accidental commits", "applyTo": ".env*", "priority": "high" }, { "id": "readme-update", "name": "Update README", "description": "Update README.md with usage instructions, installation steps, and examples for new features", "applyTo": "src/**/*.{js,ts,py}", "fileContains": "export", "priority": "low" }, { "id": "changelog-update", "name": "Update CHANGELOG", "description": "Document the changes in CHANGELOG.md following semantic versioning", "applyTo": "src/**/*", "priority": "low" }, { "id": "code-review", "name": "Request code review", "description": "Create a pull request and request review from team members before merging", "applyTo": "src/**/*", "priority": "high" }, { "id": "performance-optimization", "name": "Check performance", "description": "Profile the code and optimize any performance bottlenecks (use React.memo, useMemo, useCallback for React)", "applyTo": "src/**/*.{jsx,tsx}", "priority": "medium" }, { "id": "responsive-design", "name": "Test responsive design", "description": "Verify the UI works correctly on mobile, tablet, and desktop screen sizes", "applyTo": "src/components/**/*.{jsx,tsx,css,scss}", "priority": "high" }, { "id": "browser-compatibility", "name": "Test browser compatibility", "description": "Test in Chrome, Firefox, Safari, and Edge to ensure cross-browser compatibility", "applyTo": "src/**/*.{jsx,tsx}", "priority": "medium" }, { "id": "docker-compose", "name": "Update docker-compose", "description": "Update docker-compose.yml with new services or environment variables", "applyTo": "Dockerfile", "priority": "medium" }, { "id": "ci-cd-pipeline", "name": "Update CI/CD pipeline", "description": "Update GitHub Actions, Jenkins, or other CI/CD configuration for new build steps", "applyTo": ".github/workflows/**/*.yml", "priority": "medium" }, { "id": "branch-deployment-plan", "name": "Create deployment plan", "description": "Document deployment steps, rollback procedures, and any required infrastructure changes", "branchLevel": true, "priority": "high", "aiInstruction": "Create a DEPLOYMENT.md file documenting: 1) Pre-deployment checklist, 2) Step-by-step deployment instructions, 3) Environment variables needed, 4) Database migrations, 5) Rollback procedure, 6) Smoke test steps, 7) Monitoring/alerts to watch." }, { "id": "branch-notify-team", "name": "Notify team of changes", "description": "Send a message to Slack/Teams about the upcoming changes and any impacts", "branchLevel": true, "priority": "medium" }, { "id": "branch-update-docs", "name": "Update documentation", "description": "Update user-facing documentation, API docs, or internal wikis with changes", "branchLevel": true, "priority": "medium" }, { "id": "branch-run-e2e", "name": "Run E2E tests", "description": "Execute end-to-end tests to verify the full user flow works correctly", "branchLevel": true, "priority": "high" }, { "id": "branch-security-review", "name": "Security review", "description": "Review changes for security vulnerabilities, run security scanners if available", "branchLevel": true, "priority": "high", "aiInstruction": "Run 'npm audit' to check dependencies. Review code for: 1) SQL/NoSQL injection, 2) XSS vulnerabilities, 3) Hardcoded secrets, 4) Insecure direct object references, 5) Missing authentication/authorization checks. Use OWASP Top 10 as a checklist." } ] }