An AI-powered tool that grades and improves knowledge base documents for AI agents. Built with Next.js, OpenAI, and Tailwind CSS.
- Instant Grading: Get a 0-100 score based on Klaviyo's knowledge base best practices
- Detailed Suggestions: Categorized improvement recommendations with specific fixes
- Document Rewriting: Automatically generate improved versions of your documents
- Side-by-Side Diff: Visual comparison between original and improved documents
- One-Click Copy: Easy clipboard integration for improved documents
- Node.js 18+
- OpenAI API key
- Clone the repository:
cd ~/Repos/knowledge-grader- Install dependencies:
npm install- Set up environment variables:
# Edit .env.local and add your OpenAI API key
OPENAI_API_KEY=your-actual-api-key-here- Run the development server:
npm run dev- Open http://localhost:3000 in your browser
- Navigate to the app (automatically redirects to
/doc-grader) - Paste your knowledge document (max 50KB)
- Click "Grade Document"
- Review:
- Overall grade (0-100) with color coding
- Expandable suggestions organized by category
- Side-by-side diff viewer
- Copy the improved document to your clipboard
knowledge-grader/
├── app/
│ ├── api/
│ │ └── doc-grader/
│ │ └── evaluate/
│ │ └── route.ts # API endpoint
│ ├── doc-grader/
│ │ └── page.tsx # Main grading page
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Home (redirects)
│ └── globals.css # Global styles
├── components/
│ └── doc-grader/
│ ├── DocGraderForm.tsx # Main form component
│ ├── GradeDisplay.tsx # Grade visualization
│ ├── SuggestionsList.tsx # Suggestions accordion
│ └── DiffViewer.tsx # Diff viewer
├── lib/
│ ├── schemas/
│ │ └── docGrader.ts # Zod validation schemas
│ ├── services/
│ │ └── docGraderService.ts # OpenAI integration
│ └── openai.ts # OpenAI client setup
└── package.json
- Framework: Next.js 16 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- AI: OpenAI GPT-4o
- Validation: Zod
- Diff Viewer: react-diff-viewer-continued
Track the performance of knowledge documents before and after using this tool:
- Document grade improvements (before/after)
- AI agent accuracy on edited vs. unedited documents
- Customer satisfaction with agent responses
ISC