| name | init-context |
| description | Analyze the codebase and generate context rules for Cursor. Use when setting up or populating .cursor/rules/ files. |
Cursor Code Discovery - Automated Workflow
You are tasked with analyzing this codebase and completing Cursor rules files.
Inputs
- Target directory (optional) - A particular directory within the codebase to focus on. If not provided, analyze the entire codebase.
Steps
- Analyze the Codebase (or Directory) - Examine the codebase and gather information.
- Populate Instruction Files - Use the existing files in
.cursor/rules/.
- Update Glob Patterns - If a target directory is provided, adjust the
alwaysApply: true glob patterns accordingly.
- Review Created Files - Confirm everything is accurate (make sure everything mentioned actually exists in the codebase).
- Validate Formatting - Ensure proper formatting is followed based on the Guidelines below.
Key Analysis Areas
- Overview: Business domain, key concepts, primary user types, integration points, key business workflows
- Architecture & Patterns: Folder structure, module boundaries, layer dependencies, communication patterns, external service integrations
- Stack Best Practices: Language-specific idioms, framework patterns, dependency injection patterns, error handling and validation patterns
- Anti-Patterns: Logging of sensitive data, hardcoded secrets, non-parameterized SQL queries
- Data Models: Core domain entities and relationships, key value objects and DTOs, data validation rules, database migration patterns
- Security & Configuration: Environment variable management, secrets handling (1Password, vaults, etc.), authentication/authorization flow, API security patterns, compliance requirements
- Commands & Scripts: Build scripts, deployment scripts, database migration commands, custom CLI tools
Guidelines
- Each file MUST be 40 lines or fewer (including frontmatter)
- Use bullet points and concise language
- Preserve critical technical details
- Include specific examples from THIS codebase
- Adjust glob patterns as needed if a target directory is provided
- Content should be specific to this repository, not generic advice