Context Generation
Context is the foundation of effective AI assistance. Bootspring automatically generates a CLAUDE.md file that captures everything your AI assistant needs to know about your project.
Why Context Matters#
Without context, AI assistants give generic advice. With context, they provide tailored guidance specific to your project's tech stack, conventions, and patterns.
Without Context#
You: "Create a form component"
AI: "Here's a generic React form..." (may not match your patterns)
With Context#
You: "Create a form component"
AI: "Based on your Next.js 14 project using React Hook Form, Zod,
and Tailwind, here's a form following your existing patterns..."
What Gets Generated#
The CLAUDE.md file contains:
Project Overview#
# MyApp - AI Context
**Type**: SaaS Application
**Purpose**: Project management for remote teams
**Stage**: Active DevelopmentTech Stack#
1## Tech Stack
2
3| Category | Technology |
4|----------|------------|
5| Framework | Next.js 14 (App Router) |
6| Language | TypeScript 5.3 |
7| Styling | Tailwind CSS 3.4 |
8| Database | PostgreSQL 15 |
9| ORM | Prisma 5.8 |
10| Auth | Clerk |
11| Payments | Stripe |
12| Testing | Vitest, Playwright |Project Structure#
1## Project Structure
2
3├── app/ # Next.js App Router
4│ ├── (auth)/ # Auth pages
5│ ├── (dashboard)/ # Dashboard pages
6│ ├── api/ # API routes
7│ └── layout.tsx # Root layout
8├── components/ # React components
9│ ├── ui/ # Base UI components
10│ └── features/ # Feature components
11├── lib/ # Utilities
12├── prisma/ # Database
13└── tests/ # Test filesConventions#
1## Conventions
2
3### Code Style
4- Use TypeScript strict mode
5- Prefer named exports
6- Use functional components
7- Follow Airbnb style guide
8
9### Naming
10- Components: PascalCase (UserProfile.tsx)
11- Functions: camelCase (getUserById)
12- Files: kebab-case (user-profile.tsx)
13- Constants: UPPER_SNAKE_CASE (API_BASE_URL)
14
15### Imports
161. External packages
172. Internal modules (@/)
183. Relative imports (./)Commands#
1## Commands
2
3| Command | Description |
4|---------|-------------|
5| `npm run dev` | Start development server |
6| `npm run build` | Build for production |
7| `npm run test` | Run tests |
8| `npm run lint` | Run linter |
9| `npm run db:push` | Push schema changes |Guidelines#
1## Guidelines
2
3- Use server components by default
4- API routes go in app/api/
5- Use Prisma for all database access
6- Handle errors with custom error classes
7- Include loading and error states in UIHow Detection Works#
Bootspring scans your project to detect:
Framework Detection#
| Files Detected | Framework |
|---|---|
next.config.* + app/ | Next.js 14 (App Router) |
next.config.* + pages/ | Next.js (Pages Router) |
vite.config.* | Vite + React/Vue |
gatsby-config.* | Gatsby |
remix.config.* | Remix |
nuxt.config.* | Nuxt |
angular.json | Angular |
Database Detection#
| Files Detected | Database |
|---|---|
prisma/schema.prisma | Prisma |
drizzle.config.* | Drizzle |
typeorm.config.* | TypeORM |
mongoose in package.json | MongoDB |
Auth Detection#
| Files/Packages | Provider |
|---|---|
@clerk/nextjs | Clerk |
next-auth | NextAuth |
@auth0/nextjs-auth0 | Auth0 |
@supabase/auth-helpers | Supabase |
Testing Detection#
| Files Detected | Framework |
|---|---|
vitest.config.* | Vitest |
jest.config.* | Jest |
playwright.config.* | Playwright |
cypress.config.* | Cypress |
Generating Context#
Initial Generation#
When you initialize Bootspring:
npx bootspring initThis creates CLAUDE.md automatically.
Manual Regeneration#
Regenerate anytime:
bootspring generateOr ask your AI assistant:
Regenerate the CLAUDE.md context file.
Force Regeneration#
Override existing context:
bootspring generate --forceCustomizing Context#
Custom Sections#
Add team-specific information in bootspring.config.js:
1module.exports = {
2 context: {
3 customSections: [
4 {
5 title: 'Team Conventions',
6 content: `
7 - Use conventional commits
8 - Require PR reviews from 2 developers
9 - Deploy on Fridays is forbidden
10 - All API changes need OpenAPI spec update
11 `,
12 },
13 {
14 title: 'Architecture Decisions',
15 content: `
16 - ADR-001: Use server components by default
17 - ADR-002: API routes handle auth via middleware
18 - ADR-003: All external calls go through lib/api.ts
19 - ADR-004: Feature flags managed via environment
20 `,
21 },
22 {
23 title: 'Domain Knowledge',
24 content: `
25 - Users belong to Organizations (multi-tenant)
26 - Projects contain Tasks and Documents
27 - Billing is per-seat with usage overage
28 `,
29 },
30 ],
31 },
32};Excluding Files#
Prevent certain files from being analyzed:
1module.exports = {
2 context: {
3 exclude: [
4 'node_modules/**',
5 '.git/**',
6 'dist/**',
7 'build/**',
8 'coverage/**',
9 '.env*',
10 '*.log',
11 '*.lock',
12 '__tests__/**',
13 '**/*.test.ts',
14 ],
15 },
16};Explicit Stack#
Override auto-detection:
1module.exports = {
2 stack: {
3 frontend: ['react', 'nextjs', 'tailwindcss'],
4 backend: ['nodejs'],
5 database: ['postgresql', 'prisma'],
6 testing: ['vitest', 'playwright'],
7 auth: ['clerk'],
8 payments: ['stripe'],
9 },
10};Include Extra Files#
Include additional context sources:
1module.exports = {
2 context: {
3 include: [
4 'docs/ARCHITECTURE.md',
5 'docs/API.md',
6 '.github/CONTRIBUTING.md',
7 'ADR/*.md',
8 ],
9 },
10};When to Regenerate#
Regenerate your context when:
| Change | Impact |
|---|---|
| New dependencies added | Stack detection |
| Project structure changed | Structure section |
| New coding standards | Conventions section |
| New team members | Custom guidelines |
| Major feature added | Project overview |
| Config files changed | Various sections |
Best Practices#
1. Commit CLAUDE.md#
git add CLAUDE.md
git commit -m "chore: update AI context"This ensures all team members share the same context.
2. Review Generated Content#
After generation, review for accuracy:
- Is the tech stack correct?
- Are conventions captured?
- Any missing patterns?
3. Add Domain Knowledge#
Help AI understand your business:
1customSections: [
2 {
3 title: 'Business Context',
4 content: `
5 We're building a B2B SaaS for HR teams.
6 Key entities: Employee, Department, Review, Goal
7 Main workflows: Performance reviews, Goal setting, 1:1 meetings
8 `,
9 },
10],4. Keep It Updated#
Set a reminder to regenerate:
- After sprints
- Before major features
- When onboarding team members
5. Don't Over-Include#
Keep context focused. Too much information can confuse AI assistants.
Viewing Context#
Via CLI#
# Show context summary
bootspring context show
# Show full context
bootspring context show --fullVia AI Assistant#
Show me the current project context.
Via File#
Simply open CLAUDE.md in your editor.
Troubleshooting#
Context Not Generated#
- Check you're in project root
- Ensure package.json exists
- Run with verbose:
bootspring generate --verbose
Wrong Stack Detected#
Override in config:
module.exports = {
stack: {
frontend: ['react', 'nextjs'],
},
};Context Too Large#
Add exclusions:
1module.exports = {
2 context: {
3 exclude: ['**/*.generated.ts', 'fixtures/**'],
4 maxSize: 50000, // Limit to 50KB
5 },
6};Missing Conventions#
Add custom sections for team-specific conventions.
Related#
- Understanding Context - Getting started guide
- bootspring_generate - Generation tool reference
- Configuration - Full config options