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 installto install all dependencies - Copy
.env.exampleto.env.localand fill in the required variables - Run
./setup.shto configure OpenAI Codex integration - Run
npm run devto start the development server
Testing Instructions
- Run
npm run lintto check for linting errors - Run
npm run buildto 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
- Obtain an OpenAI API key from OpenAI Platform
- Run
./setup.shand enter your API key when prompted - The script will configure both
.env.localand.codexrcfiles
Available Codex Features
Code Generation
Use the generateCodeCompletion function from src/utils/openai.ts to generate code based on prompts:
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:
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:
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
-
Provide Clear Context: When generating code, include relevant context about your project structure and requirements.
-
Review Generated Code: Always review and test code generated by Codex before integrating it into your project.
-
Iterative Refinement: Use Codex iteratively, refining prompts based on initial results to get better output.
-
Security Considerations: Never include sensitive information in your prompts to Codex.
-
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