# TalentScout Agent Guide ## Project Overview TalentScout is a Next.js application that helps companies find talent and helps talent find jobs. The application uses MongoDB, GraphQL with Apollo, and Next.js with TypeScript and Tailwind CSS. ## Development Environment Setup - Run `npm install` to install all dependencies - Copy `.env.example` to `.env.local` and fill in the required variables - Run `./setup.sh` to configure OpenAI Codex integration - Run `npm run dev` to start the development server ## Testing Instructions - Run `npm run lint` to check for linting errors - Run `npm run build` to ensure the application builds correctly ## Code Structure - `/src` - Contains all source code - `/src/app` - Next.js App Router pages and layouts - `/src/components` - React components - `/src/utils` - Utility functions including OpenAI integration - `/src/graphql` - GraphQL schemas and resolvers - `/src/models` - MongoDB models ## OpenAI Codex Integration ### Setup 1. Obtain an OpenAI API key from [OpenAI Platform](https://platform.openai.com/) 2. Run `./setup.sh` and enter your API key when prompted 3. The script will configure both `.env.local` and `.codexrc` files ### Available Codex Features #### Code Generation Use the `generateCodeCompletion` function from `src/utils/openai.ts` to generate code based on prompts: ```typescript import { generateCodeCompletion } from '@/utils/openai'; // Example: Generate a React component const prompt = 'Create a React component that displays a user profile'; const generatedCode = await generateCodeCompletion(prompt, { language: 'typescript', maxTokens: 500, temperature: 0.7 }); ``` #### Code Analysis Use the `analyzeCode` function to get suggestions for improvements and bug fixes: ```typescript import { analyzeCode } from '@/utils/openai'; // Example: Analyze a function for improvements const codeToAnalyze = `function calculateTotal(items) { let total = 0; for (let i = 0; i < items.length; i++) { total += items[i].price; } return total; }`; const analysis = await analyzeCode(codeToAnalyze, 'javascript'); ``` #### Unit Test Generation Use the `generateUnitTests` function to create tests for your code: ```typescript import { generateUnitTests } from '@/utils/openai'; // Example: Generate Jest tests for a function const codeToTest = `export function validateEmail(email) { const regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; return regex.test(email); }`; const tests = await generateUnitTests(codeToTest, 'javascript', 'jest'); ``` ### Best Practices for Using Codex 1. **Provide Clear Context**: When generating code, include relevant context about your project structure and requirements. 2. **Review Generated Code**: Always review and test code generated by Codex before integrating it into your project. 3. **Iterative Refinement**: Use Codex iteratively, refining prompts based on initial results to get better output. 4. **Security Considerations**: Never include sensitive information in your prompts to Codex. 5. **Rate Limiting**: Be mindful of OpenAI API rate limits and costs when making frequent requests. ## Contribution Guidelines - Follow TypeScript best practices - Use Tailwind CSS for styling - Write clean, modular code - Add appropriate comments and documentation - Leverage Codex for code reviews and suggestions ## PR Instructions - Provide a clear title and description - Reference any related issues - Include screenshots for UI changes - Ensure all tests pass - Consider including Codex-generated analysis of your changes