claude-code-dev
CLAUDE.md1 starsChanged 15 months agoMITView on GitHub
⚠️ CRITICAL: AI agents MUST read the Project Structure documentation before attempting any task to understand the complete technology stack, file tree and project organization. [Project Name] follows a [describe architecture pattern]. For the complete tech stack and file tree structure, see docs/ai-context/project-structure.md.
We split this CLAUDE.md into the rules it gives an agent
37 rules. About 0 are common, 34 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈34
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
When updating documentation, keep updates concise and on point to prevent bloat.
- Distinctive: line 20
Write code following KISS, YAGNI, and DRY principles.
- Distinctive: line 21
When in doubt follow proven best practices for implementation.
- Distinctive: line 22
Do not commit to git without user approval.
- Distinctive: line 23
Do not run any servers, rather tell the user to run servers for testing.
- Distinctive: line 24
Always consider industry standard libraries/frameworks first over custom implementations.
- Distinctive: line 25
Never mock anything. Never use placeholders.
- Distinctive: line 33
Default to creating multiple small, focused files rather than large monolithic ones
- Distinctive: line 35
Keep files under 350 lines when possible - split larger files by extracting utilities, constants, types, or logical components into …
- Distinctive: line 37
Prefer composition over inheritance - use inheritance only for true 'is-a' relationships, favor composition for 'has-a' or behavior mixing
- Distinctive: line 39
Follow existing project structure and conventions - place files in appropriate directories.
- Distinctive: line 40
Use well defined sub-directories to keep things organized and scalable
- Distinctive: line 42
Import/export properly - design for reusability and maintainability
- Distinctive: line 45
Always: use type hints for function parameters and return values
- Very specific: line 46
Use from typing import for complex types
- Very specific: line 47
Prefer Optional[T] over Union[T, None]
- Distinctive: line 48
Use Pydantic models for data structures
- Distinctive: line 72
Every module needs a docstring
- Distinctive: line 73
Every public function needs a docstring
- Distinctive: line 95
Never trust external inputs - validate everything at the boundaries
- Distinctive: line 96
Keep secrets in environment variables, never in code
- Distinctive: line 99
Use Row Level Security (RLS) to enforce data isolation between users
- Distinctive: line 101
Use secure authentication patterns for your platform
- Distinctive: line 106
Use specific exceptions over generic ones
- Distinctive: line 107
Always log errors with context
- Distinctive: line 112
Every request needs a correlation ID for debugging
- Distinctive: line 120
Keep conversation history lightweight (text, not audio)
- Distinctive: line 124
Use HTTP status codes correctly
- Distinctive: line 127
Use consistent JSON response format:
- Distinctive: line 182
Important: Treat Gemini's responses as advisory feedback.
- Distinctive: line 215
After completing any coding task, follow this checklist:
- Distinctive: line 218
Run the appropriate commands based on what was modified:
- Distinctive: line 219
Python projects: Run mypy type checking
- Very specific: line 220
TypeScript projects: Run tsc --noEmit
- Distinctive: line 221
Other languages: Run appropriate linting/type checking tools
- Distinctive: line 224
Ensure all type checks pass before considering the task complete
- Distinctive: line 225
If type errors are found, fix them before marking the task as done
≈ “Common” is an estimate: at least 1 in 5 of the 25,680 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
[PROJECT NAME] - AI Context Template (claude-master)
1. Project Overview
- Vision: [Describe your project's vision and goals]
- Current Phase: [Current development phase and status]
- Key Architecture: [High-level architecture description]
- Development Strategy: [Development approach and strategy notes]
2. Project Structure
⚠️ CRITICAL: AI agents MUST read the Project Structure documentation before attempting any task to understand the complete technology stack, file tree and project organization.
[Project Name] follows a [describe architecture pattern]. For the complete tech stack and file tree structure, see docs/ai-context/project-structure.md.
3. Coding Standards & AI Instructions
General Instructions
- Your most important job is to manage your own context. Always read any relevant files BEFORE planning changes.
- When updating documentation, keep updates concise and on point to prevent bloat.
- Write code following KISS, YAGNI, and DRY principles.
- When in doubt follow proven best practices for implementation.
- Do not commit to git without user approval.
- Do not run any servers, rather tell the user to run servers for testing.
- Always consider industry standard libraries/frameworks first over custom implementations.
- Never mock anything. Never use placeholders. Never omit code.
- Apply SOLID principles where relevant. Use modern framework features rather than reinventing solutions.
- Be brutally honest about whether an idea is good or bad.
- Make side effects explicit and minimal.
- Design database schema to be evolution-friendly (avoid breaking changes).
File Organization & Modularity
- Default to creating multiple small, focused files rather than large monolithic ones
- Each file should have a single responsibility and clear purpose
- Keep files under 350 lines when possible - split larger files by extracting utilities, constants, types, or logical components into separate modules
- Separate concerns: utilities, constants, types, components, and business logic into different files
- Prefer composition over inheritance - use inheritance only for true 'is-a' relationships, favor composition for 'has-a' or behavior mixing
- Follow existing project structure and conventions - place files in appropriate directories. Create new directories and move files if deemed appropriate.
- Use well defined sub-directories to keep things organized and scalable
- Structure projects with clear folder hierarchies and consistent naming conventions
- Import/export properly - design for reusability and maintainability
Type Hints (REQUIRED)
- Always use type hints for function parameters and return values
- Use
from typing importfor complex types - Prefer
Optional[T]overUnion[T, None] - Use Pydantic models for data structures
# Good
from typing import Optional, List, Dict, Tuple
async def process_audio(
audio_data: bytes,
session_id: str,
language: Optional[str] = None
) -> Tuple[bytes, Dict[str, Any]]:
"""Process audio through the pipeline."""
passNaming Conventions
- Classes: PascalCase (e.g.,
VoicePipeline) - Functions/Methods: snake_case (e.g.,
process_audio) - Constants: UPPER_SNAKE_CASE (e.g.,
MAX_AUDIO_SIZE) - Private methods: Leading underscore (e.g.,
_validate_input) - Pydantic Models: PascalCase with
Schemasuffix (e.g.,ChatRequestSchema,UserSchema)
Documentation Requirements
- Every module needs a docstring
- Every public function needs a docstring
- Use Google-style docstrings
- Include type information in docstrings
def calculate_similarity(text1: str, text2: str) -> float:
"""Calculate semantic similarity between two texts.
Args:
text1: First text to compare
text2: Second text to compare
Returns:
Similarity score between 0 and 1
Raises:
ValueError: If either text is empty
"""
passSecurity First
- Never trust external inputs - validate everything at the boundaries
- Keep secrets in environment variables, never in code
- Log security events (login attempts, auth failures, rate limits, permission denials) but never log sensitive data (audio, conversation content, tokens, personal info)
- Authenticate users at the API gateway level - never trust client-side tokens
- Use Row Level Security (RLS) to enforce data isolation between users
- Design auth to work across all client types consistently
- Use secure authentication patterns for your platform
- Validate all authentication tokens server-side before creating sessions
- Sanitize all user inputs before storing or processing
Error Handling
- Use specific exceptions over generic ones
- Always log errors with context
- Provide helpful error messages
- Fail securely - errors shouldn't reveal system internals
Observable Systems & Logging Standards
- Every request needs a correlation ID for debugging
- Structure logs for machines, not humans - use JSON format with consistent fields (timestamp, level, correlation_id, event, context) for automated analysis
- Make debugging possible across service boundaries
State Management
- Have one source of truth for each piece of state
- Make state changes explicit and traceable
- Design for multi-service voice processing - use session IDs for state coordination, avoid storing conversation data in server memory
- Keep conversation history lightweight (text, not audio)
API Design Principles
- RESTful design with consistent URL patterns
- Use HTTP status codes correctly
- Version APIs from day one (/v1/, /v2/)
- Support pagination for list endpoints
- Use consistent JSON response format:
- Success:
{ "data": {...}, "error": null } - Error:
{ "data": null, "error": {"message": "...", "code": "..."} }
- Success:
4. Multi-Agent Workflows & Context Injection
Automatic Context Injection for Sub-Agents
When using the Task tool to spawn sub-agents, the core project context (CLAUDE.md, project-structure.md, docs-overview.md) is automatically injected into their prompts via the subagent-context-injector hook. This ensures all sub-agents have immediate access to essential project documentation without the need of manual specification in each Task prompt.
5. MCP Server Integrations
Gemini Consultation Server
When to use:
- Complex coding problems requiring deep analysis or multiple approaches
- Code reviews and architecture discussions
- Debugging complex issues across multiple files
- Performance optimization and refactoring guidance
- Detailed explanations of complex implementations
- Highly security relevant tasks
Automatic Context Injection:
- The kit's
gemini-context-injector.shhook automatically includes two key files for new sessions:/docs/ai-context/project-structure.md- Complete project structure and tech stack/MCP-ASSISTANT-RULES.md- Your project-specific coding standards and guidelines
- This ensures Gemini always has comprehensive understanding of your technology stack, architecture, and project standards
Usage patterns:
# New consultation session (project structure auto-attached by hooks)
mcp__gemini__consult_gemini(
specific_question="How should I optimize this voice pipeline?",
problem_description="Need to reduce latency in real-time audio processing",
code_context="Current pipeline processes audio sequentially...",
attached_files=[
"src/core/pipelines/voice_pipeline.py" # Your specific files
],
preferred_approach="optimize"
)
# Follow-up in existing session
mcp__gemini__consult_gemini(
specific_question="What about memory usage?",
session_id="session_123",
additional_context="Implemented your suggestions, now seeing high memory usage"
)Key capabilities:
- Persistent conversation sessions with context retention
- File attachment and caching for multi-file analysis
- Specialized assistance modes (solution, review, debug, optimize, explain)
- Session management for complex, multi-step problems
Important: Treat Gemini's responses as advisory feedback. Evaluate the suggestions critically, incorporate valuable insights into your solution, then proceed with your implementation.
Context7 Documentation Server
Repository: Context7 MCP Server
When to use:
- Working with external libraries/frameworks (React, FastAPI, Next.js, etc.)
- Need current documentation beyond training cutoff
- Implementing new integrations or features with third-party tools
- Troubleshooting library-specific issues
Usage patterns:
# Resolve library name to Context7 ID
mcp__context7__resolve_library_id(libraryName="react")
# Fetch focused documentation
mcp__context7__get_library_docs(
context7CompatibleLibraryID="/facebook/react",
topic="hooks",
tokens=8000
)Key capabilities:
- Up-to-date library documentation access
- Topic-focused documentation retrieval
- Support for specific library versions
- Integration with current development practices
6. Post-Task Completion Protocol
After completing any coding task, follow this checklist:
1. Type Safety & Quality Checks
Run the appropriate commands based on what was modified:
- Python projects: Run mypy type checking
- TypeScript projects: Run tsc --noEmit
- Other languages: Run appropriate linting/type checking tools
2. Verification
- Ensure all type checks pass before considering the task complete
- If type errors are found, fix them before marking the task as done
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/cursor_rules.mdcCursor rule
- .cursor/rules/self_improve.mdcCursor rule
- .cursor/rules/taskmaster/dev_workflow.mdcCursor rule
- .cursor/rules/taskmaster/taskmaster.mdcCursor rule
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

