Skip to content

Instantly share code, notes, and snippets.

@UserAd
Created March 24, 2025 07:21
Show Gist options
  • Save UserAd/9ac8a3393ef86cd769dd25c144f59f3d to your computer and use it in GitHub Desktop.
Save UserAd/9ac8a3393ef86cd769dd25c144f59f3d to your computer and use it in GitHub Desktop.

Codebase Analysis for Cline's Memory Bank Generation

I need you to thoroughly analyze my codebase and create a comprehensive Memory Bank following Cline's structure. This Memory Bank is CRITICAL - it's the ONLY way Cline can understand the project after memory resets.

Step 1: Carefully analyze the entire codebase

Before writing any documentation, spend time understanding:

  1. Project architecture and organization
  2. Core technologies and frameworks
  3. Key design patterns and programming paradigms
  4. Business domain and purpose
  5. API structures and data flows
  6. State management approaches
  7. UI/UX patterns and user flows

Think step-by-step through the codebase:

  • Identify entry points
  • Trace execution paths
  • Examine file organization
  • Note naming conventions
  • Understand data structures
  • Identify component relationships

Step 2: Create the Memory Bank files

Generate these core files in Markdown format:

1. projectbrief.md

# Project Brief: [Project Name]

## Overview
[Concise 2-3 sentence description]

## Core Requirements
- [Requirement 1]
- [Requirement 2]
...

## Project Scope
- [Include/Exclude 1]
- [Include/Exclude 2]
...

## Success Criteria
- [Criterion 1]
- [Criterion 2]
...

## Timeline
[If apparent from codebase]

2. productContext.md

# Product Context

## Problem Statement
[Define the core problems this project solves]

## User Personas
[Derive from codebase - who uses this?]

## Key User Flows
[Describe 3-5 primary user journeys]

## Business Rules
[Document critical business logic]

## User Experience Goals
[What experience should users have?]

3. systemPatterns.md

# System Patterns

## Architecture Overview
[Text-based architecture diagram]

```mermaid
[Include architectural diagram]

Component Hierarchy

[Describe major components and their relationships]

Design Patterns

[List and explain key patterns used]

Data Flow

[Describe how data moves through the system]

State Management

[Explain state management approach]

Error Handling

[Document error handling strategies]


### 4. techContext.md
```markdown
# Technical Context

## Technology Stack
- Languages: [List with versions]
- Frameworks: [List with versions]
- Libraries: [List key libraries]

## Environment Setup
[Document development environment requirements]

## External Dependencies
[List APIs, services, and integrations]

## Database Structure
[Document data models and relationships]

## Build & Deployment
[Describe the build pipeline and deployment process]

5. activeContext.md

# Active Context

## Current Focus
[Identify active development areas]

## Recent Changes
[Document recent updates and their purpose]

## In-Progress Work
[List features currently being implemented]

## Next Steps
[Identify logical next development tasks]

## Active Decisions
[Document ongoing technical decisions]

6. progress.md

# Project Progress

## Completed Features
- [Feature 1]: [Brief description]
- [Feature 2]: [Brief description]
...

## Pending Implementation
- [Task 1]: [Priority & description]
- [Task 2]: [Priority & description]
...

## Known Issues
- [Issue 1]: [Severity & description]
- [Issue 2]: [Severity & description]
...

## Test Coverage
[Assess current test coverage]

## Performance Status
[Note any performance considerations]

7. .clinerules

# Project Intelligence

## Coding Standards
[Document project-specific standards]

## Naming Conventions
[Document pattern for variables, functions, classes, etc.]

## File Organization
[Document project structure patterns]

## Implementation Patterns
[Document common approaches to recurring problems]

## Critical Paths
[Identify key execution paths]

## Project Preferences
[Note evident preferences in implementation style]

Step 3: Evaluation and refinement

After creating each file, ask yourself:

  1. Is this comprehensive enough for someone with NO prior context?
  2. Have I captured both explicit and implicit patterns?
  3. Is the documentation clear, concise, and accurate?
  4. Have I used examples where appropriate?
  5. Have I noted areas where more information is needed?

Output Format

For each file:

  1. Use the exact filename as header (e.g., "# projectbrief.md")
  2. Provide complete markdown content following templates above
  3. Include a brief explanation of your analysis process
  4. Indicate any assumptions made or areas needing clarification

Important Guidelines

  • Be thorough but concise - these files will be read at the start of EVERY session
  • Include specific examples from the codebase to illustrate patterns
  • Create visual diagrams using mermaid syntax where appropriate
  • Label any uncertain information as "Needs clarification: [specific question]"
  • Focus on capturing unwritten assumptions that would be crucial for a developer
  • For activeContext.md, prioritize recent changes based on file timestamps or git history

The Memory Bank's quality directly impacts Cline's effectiveness - it must contain all context needed to continue development with no additional information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment