plugins/developer-toolkit/skills/code-intelligence/codebase-context-builder/SKILL.md
Use this skill when preparing context for AI coding assistants. Activate when the user wants to help AI understand their codebase, provide better context for code generation, improve AI responses, create context files, set up CLAUDE.md or similar context documents, or optimize prompts for code tasks.
npx skillsauth add latestaiagents/agent-skills codebase-context-builderInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Prepare optimal context so AI assistants understand your codebase deeply.
┌─────────────────────────────────────────┐
│ Level 1: Project Context (Always Load) │
│ - Tech stack, conventions, structure │
│ - CLAUDE.md / AGENTS.md files │
└─────────────────────────────────────────┘
↓
┌─────────────────────────────────────────┐
│ Level 2: Domain Context (Task-Specific) │
│ - Related files, types, interfaces │
│ - Existing patterns to follow │
└─────────────────────────────────────────┘
↓
┌─────────────────────────────────────────┐
│ Level 3: Task Context (Per-Request) │
│ - Specific requirements │
│ - Examples of expected output │
└─────────────────────────────────────────┘
Place in project root. AI assistants read this automatically.
# Project: [Name]
## Tech Stack
- **Frontend:** React 19, TypeScript 5.4, Tailwind CSS 4.0
- **Backend:** Node.js 22, Express 5, PostgreSQL 16
- **Testing:** Vitest, Playwright
- **Package Manager:** pnpm 9
## Project Structure
src/ ├── components/ # React components (PascalCase) ├── hooks/ # Custom hooks (use* prefix) ├── services/ # API clients and business logic ├── types/ # TypeScript interfaces ├── utils/ # Pure utility functions └── pages/ # Route components
## Code Conventions
### Naming
- Components: PascalCase (`UserProfile.tsx`)
- Hooks: camelCase with `use` prefix (`useAuth.ts`)
- Utils: camelCase (`formatDate.ts`)
- Types: PascalCase with `I` prefix for interfaces (`IUser`)
### Patterns
- Use functional components with hooks
- Prefer `const` arrow functions for components
- Use named exports, not default exports
- Error handling with custom `AppError` class
### Imports Order
1. External packages
2. Internal modules (absolute paths)
3. Relative imports
4. Styles
## API Conventions
- Base URL: `/api/v1`
- Auth: Bearer token in Authorization header
- Errors: `{ error: { code, message, details } }`
## Testing
- Unit tests: `*.test.ts` colocated with source
- E2E tests: `e2e/*.spec.ts`
- Run: `pnpm test` (unit), `pnpm test:e2e` (e2e)
## Common Commands
```bash
pnpm dev # Start development
pnpm build # Production build
pnpm test # Run tests
pnpm lint # Lint code
src/services/api.ts - API client with interceptorssrc/hooks/useAuth.ts - Authentication hooksrc/types/index.ts - Shared type definitions
## Building Task-Specific Context
### Step 1: Identify Relevant Files
```bash
# Find files related to your task
# For a "user profile" feature:
# Find existing user-related code
grep -r "user" --include="*.ts" -l src/
# Find related types
grep -r "interface.*User" --include="*.ts" src/types/
# Find similar components
ls src/components/ | grep -i profile
When asking AI to modify code, include:
Example prompt structure:
## Context Files
### src/types/user.ts
[paste file content]
### src/services/userService.ts
[paste file content]
### src/components/UserCard.tsx (similar component)
[paste file content]
## Task
Create a UserProfile component that displays user details
and allows editing. Follow the patterns in UserCard.
## Expected Output Example
The component should look similar to this pattern:
```tsx
export const UserProfile: React.FC<UserProfileProps> = ({ userId }) => {
const { data, isLoading } = useUser(userId);
if (isLoading) return <Skeleton />;
return (
<Card>
{/* Component content */}
</Card>
);
};
Include:
1. CLAUDE.md (project context)
2. Similar existing feature (as reference)
3. Relevant types and interfaces
4. API endpoint documentation
5. Design requirements or mockups
Include:
1. The buggy code
2. Error message / stack trace
3. Expected vs actual behavior
4. Related test files
5. Recent changes to the file (git log)
Include:
1. Current implementation
2. Target patterns/architecture
3. All usages of the code being refactored
4. Migration examples if changing APIs
Include:
1. Code to be tested
2. Existing test patterns in the project
3. Test utilities and mocks
4. Coverage requirements
# Agent Configuration
## Available Agents
- **code-reviewer**: Reviews code for best practices
- **test-writer**: Generates comprehensive tests
- **doc-generator**: Creates documentation
## Shared Context
All agents have access to:
- Project structure in CLAUDE.md
- Type definitions in src/types/
- Coding standards in .eslintrc
## Agent-Specific Instructions
### code-reviewer
Focus on:
- Security vulnerabilities
- Performance issues
- Code style violations
- Missing error handling
### test-writer
Requirements:
- Minimum 80% coverage
- Include edge cases
- Mock external dependencies
- Use existing test utilities
{
"contextFiles": [
"CLAUDE.md",
"src/types/index.ts",
"docs/API.md"
],
"excludePatterns": [
"node_modules",
"dist",
"*.test.ts"
]
}
## UserService Summary
- Location: src/services/userService.ts
- Methods: getUser, updateUser, deleteUser, listUsers
- Uses: apiClient, UserSchema validation
- Auth: Requires authenticated user context
- Key pattern: All methods return Promise<Result<T, AppError>>
Ask the AI a simple question about your codebase conventions. If it answers correctly, your context is working.
"What naming convention should I use for a new React hook in this project?"
Expected: "Use camelCase with 'use' prefix, like useAuth.ts"
development
Test skills for correct activation, content quality, and regression — both automated checks (frontmatter validity, lint) and manual verification (query-suite activation testing). Covers CI integration and how to catch skill regressions before users do. Use this skill when adding skills to a repo, setting up CI for a skill library, or debugging "the skill exists but doesn't work". Activate when: test skills, validate skills, skill CI, skill linting, skill activation test, skill regression.
documentation
Write the YAML frontmatter for a SKILL.md file so it activates reliably — name, description, and activation keywords that the model matches against. Covers length, tone, and the most common frontmatter mistakes. Use this skill when authoring a new skill, fixing a skill that isn't auto-activating, or reviewing skills for publication. Activate when: SKILL.md frontmatter, skill description, skill activation, skill YAML, write a skill, author a skill.
development
Design skills that fire at the right moment — neither over-eager (noise) nor under-eager (silent). Covers activation specificity, trigger phrases, disambiguation between overlapping skills, and debugging activation. Use this skill when multiple skills could fire on the same query, a skill never fires, or a skill fires too often. Activate when: skill won't activate, skill over-activates, overlapping skills, skill triggers, skill selection, skill disambiguation.
development
Structure SKILL.md content so the model reads just enough — concise summary up front, progressively deeper detail, examples on demand. Covers section ordering, length budgets, when to split into multiple skills. Use this skill when writing or refactoring a skill body, one skill has grown too long, or a skill is wordy but not useful. Activate when: SKILL.md structure, skill content, skill too long, split skill, progressive disclosure, skill body.