Primer
Auto-generate AI agent instructions from your codebase
Primer
Primer analyzes your codebase and automatically generates optimized instructions for all 32 AI agents. No more manual configuration—let SkillKit detect your tech stack, coding patterns, and project structure.
Quick Start
# Analyze current project
skillkit primer
# Generate for specific agents
skillkit primer --agent claude,cursor,windsurf
# Generate for all 32 agents
skillkit primer --all-agents
# Preview without writing files
skillkit primer --dry-runWhat Primer Detects
Tech Stack
- Frameworks: React, Next.js, Vue, Angular, Svelte, etc.
- Languages: TypeScript, JavaScript, Python, Go, Rust, etc.
- Build Tools: Vite, Webpack, Turbopack, esbuild
- Package Managers: npm, pnpm, yarn, bun
Project Patterns
- Architecture: Monorepo, microservices, serverless
- Code Style: Formatting rules, naming conventions
- Directory Structure: Feature-based, layer-based, domain-driven
- Dependencies: Key libraries and their versions
Best Practices
- Testing Setup: Jest, Vitest, Playwright, Cypress
- Linting: ESLint, Prettier, TypeScript strict mode
- Documentation: JSDoc, TSDoc, README patterns
- Git Workflow: Branch strategy, commit conventions
Generated Instructions
Primer creates agent-specific instructions for:
Claude Code
.claude/
└── CLAUDE.md # Full project contextCursor
.cursor/
└── .cursorrules # IDE-specific rulesGitHub Copilot
.github/
└── copilot-instructions.mdAll 32 Agents
Each agent gets optimized instructions in their native format.
Example Output
$ skillkit primer
🔍 Analyzing project...
Detected:
Framework: Next.js 14 (App Router)
Language: TypeScript (strict mode)
Styling: Tailwind CSS v3
Testing: Vitest + Playwright
Package Manager: pnpm
✅ Generated instructions for:
- Claude Code (.claude/CLAUDE.md)
- Cursor (.cursor/.cursorrules)
- Codex (.codex/instructions.md)
+ 29 more agents
💡 Tip: Run `skillkit sync` to apply changesCustomization
Configuration File
Create .skillkit/primer-config.json:
{
"include": {
"techStack": true,
"codeStyle": true,
"testingPatterns": true,
"customRules": [
"Always use async/await over promises",
"Prefer functional components in React",
"Use Zod for runtime validation"
]
},
"exclude": {
"directories": ["node_modules", "dist", ".next"],
"patterns": ["*.test.ts", "*.spec.ts"]
},
"agents": {
"priority": ["claude", "cursor", "windsurf"],
"customize": {
"claude": {
"tone": "detailed",
"examples": true
},
"cursor": {
"tone": "concise",
"shortcuts": true
}
}
}
}Template Overrides
Override default templates in .skillkit/primer-templates/:
.skillkit/primer-templates/
├── claude.template.md
├── cursor.template.md
└── shared/
├── header.md
└── footer.mdUpdate Strategies
Incremental Updates
# Update only when changes detected
skillkit primer --incremental
# Force regeneration
skillkit primer --forceGit Integration
# Auto-generate on git hooks
cat > .git/hooks/post-checkout << 'EOF'
#!/usr/bin/env bash
skillkit primer --incremental
EOF
chmod +x .git/hooks/post-checkoutCI/CD Pipeline
# .github/workflows/primer.yml
name: Update Agent Instructions
on:
push:
branches: [main]
paths:
- 'package.json'
- 'tsconfig.json'
- 'src/**'
jobs:
primer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npx skillkit primer --all-agents
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "chore: update agent instructions"Programmatic API
import { analyzeProject, generateInstructions } from '@skillkit/core';
// Analyze project
const analysis = await analyzeProject('./my-project');
console.log(analysis.techStack);
// { framework: 'Next.js', language: 'TypeScript', ... }
// Generate instructions
const instructions = await generateInstructions(analysis, {
agents: ['claude', 'cursor'],
includeExamples: true,
tone: 'detailed',
});
// Write to files
for (const [agent, content] of Object.entries(instructions)) {
await writeAgentFile(agent, content);
}Best Practices
When to Run Primer
- Initial Setup - First time configuring agents
- Major Changes - New frameworks or architecture changes
- Team Onboarding - New developers joining the project
- Agent Migration - Switching to new AI coding tools
What to Commit
# Commit generated instructions
.claude/
.cursor/
.github/copilot-instructions.md
# Don't commit
.skillkit/cache/
.skillkit/primer-temp/Combining with Skills
Primer generates base instructions. Layer on specific skills:
# 1. Generate base instructions
skillkit primer --all-agents
# 2. Install domain-specific skills
skillkit install anthropics/skills --skill pdf,xlsx
# 3. Sync everything
skillkit syncComparison
| Method | Setup Time | Accuracy | Maintenance |
|---|---|---|---|
| Manual Writing | Hours | Variable | Manual updates |
| AI Generation | Minutes | High | Auto-detect changes |
| Copy/Paste | Minutes | Low | Stale quickly |
| Primer | Seconds | Very High | Auto-incremental |
Troubleshooting
Primer Not Detecting Framework
# Specify manually
skillkit primer --framework nextjs --language typescript
# Check detection logs
skillkit primer --verboseGenerated Instructions Too Generic
Customize with primer-config.json:
{
"tone": "detailed",
"includeExamples": true,
"customRules": [
"Your specific coding guidelines..."
]
}Instructions Out of Sync
# Force regeneration
skillkit primer --force
# Clean cache
rm -rf .skillkit/cache/primerNext Steps
- Memory System - Capture learnings from sessions
- Skills - Install domain-specific skills
- Translation - Convert between agent formats
- Team Collaboration - Share instructions with your team