Debug School

rakesh kumar
rakesh kumar

Posted on • Edited on

“What is CLAUDE.md? A Complete Guide to Using Claude AI for Software Development”

What is CLAUDE.md and Why Every Software Project Needs It
How CLAUDE.md Helps Developers Save Time and Reduce Coding Mistakes
CLAUDE.md vs Normal Prompt: What is the Difference?
How to Use Claude Code for Large Software Product Development
Best Folder Structure for Claude AI in Multi-Repo Projects
How to Create a Perfect CLAUDE.md File for Laravel Projects
Using Claude AI as a Coding Assistant for Old Legacy Projects
How Claude Code Helps in Microservices Development
How to Write Better Prompts for Claude Code
CLAUDE.md for Product Development: A Complete Beginner’s Guide
How to Use Claude AI for Keycloak Integration in Laravel Projects
Claude Code Best Practices for Safe Software Development
How to Build Project Documentation for Claude AI
Why AI Coding Tools Need Project Memory
Claude AI for Developers: How to Use It Without Breaking Existing Code
How to Use Claude Code with GitHub, Laravel, and Microservices
Common Mistakes Developers Make While Using Claude Code
How CLAUDE.md Improves Team Collaboration in Software Projects
Claude Code Workflow: Analyze, Plan, Implement, Test, and Report
How to Use Claude AI for Product Planning, Architecture, and Development

Best prompt for Claude

You are working on the HolidayLandmark project.

First read the project documentation before doing anything:
1. CLAUDE.md
2. docs/PRODUCT_REQUIREMENTS.md
3. docs/FEATURES.md
4. docs/AI_FEATURES.md
5. docs/ADMIN_PANEL.md
6. docs/ARCHITECTURE.md
7. docs/DATABASE_SCHEMA.md
8. docs/TESTING_CHECKLIST.md

Rules:
- Do not start coding immediately.
- First summarize the product, modules, current architecture, and development rules.
- Identify which files/modules are related to my task.
- Prepare a safe implementation plan.
- Mention risks before coding.
- Wait for my approval before making changes.
- Do not edit .env.
- Do not remove existing code without explaining why.
- Do not run migrations without asking.
- Keep existing functionality safe.

My task is:
[WRITE YOUR TASK HERE]
Enter fullscreen mode Exit fullscreen mode

Another

You are working in my Motoshare Flutter project.


Before making any change, please read and follow:
1. /CLAUDE.md for global project safety rules
2. /lib/CLAUDE.md because this task is inside Flutter app code
Enter fullscreen mode Exit fullscreen mode

Best workflow

Step 1: Read docs
Step 2: Understand existing project
Step 3: Summarize what you understood
Step 4: Create plan
Step 5: Ask approval
Step 6: Implement
Step 7: Test
Step 8: Final report
Enter fullscreen mode Exit fullscreen mode

Use of CLAUDE.md while developing a software product

  1. Gives Claude project context

It explains:

What is this product?
Which technology is used?
Which folders are important?
Which APIs, services, and modules exist?
Enter fullscreen mode Exit fullscreen mode

Example:

This is a Laravel-based travel booking platform.
Users can browse trips, organizers can create packages, and admins manage bookings.

This helps Claude understand the product before changing code.

  1. Prevents Claude from breaking existing logic

You can write rules like:

Do not remove existing routes.
Do not change database columns without migration.
Do not modify production .env files.
Do not break old login flow while adding Keycloak SSO.
Enter fullscreen mode Exit fullscreen mode

This is very useful in old projects where existing functionality must stay safe.

  1. Defines coding standards

You can tell Claude:

Use Laravel best practices.
Follow existing controller-service-repository pattern.
Keep Blade UI responsive.
Use proper validation.
Do not duplicate code.
Enter fullscreen mode Exit fullscreen mode

So the output becomes more consistent and professional.

  1. Helps in large product development

For products like Motoshare, MyHospitalNow, HolidayLandmark, DevOpsSchool, one codebase may have many modules.

CLAUDE.md can explain:

Admin module
User module
Booking module
Payment module
Notification module
SEO module
API module
Enter fullscreen mode Exit fullscreen mode

Then Claude can understand where to work instead of randomly editing files.

  1. Improves AI-generated prompts and implementation

Without CLAUDE.md, Claude needs full explanation every time.

With CLAUDE.md, you can simply say:

Fix the booking status issue as per project rules.

Claude will already know the architecture, rules, commands, testing steps, and safety limits.

  1. Useful for team development

If you commit CLAUDE.md in GitHub, every developer using Claude gets the same project instructions. Anthropic’s docs also mention that project Claude files can be committed to Git so the team can share them.

Best use in software product development

You should create CLAUDE.md in your project root:

/opt/lampp/htdocs/your-project/CLAUDE.md
Enter fullscreen mode Exit fullscreen mode

Example sections:

# Product Overview
# Tech Stack
# Folder Structure
# Database Rules
# Authentication Rules
# API Rules
# UI/UX Rules
# SEO Rules
# Testing Commands
# Deployment Safety Rules
# Do Not Touch
Enter fullscreen mode Exit fullscreen mode

Simple meaning

CLAUDE.md works like a developer guide for Claude.

Levels of claude.md file

  1. Root CLAUDE.md

Use this when you have multiple related repositories/microservices.

Example path:

/opt/lampp/htdocs/myhospitalnow/CLAUDE.md
/opt/lampp/htdocs/motoshare/CLAUDE.md
/opt/lampp/htdocs/devopsschool/CLAUDE.md
Enter fullscreen mode Exit fullscreen mode

Content of root CLAUDE.md

This file should contain information that is common for the full product.

# Product Overview

This product is a multi-service Laravel-based platform.
It contains multiple microservices that work together for user, admin, booking, notification, payment, and authentication flows.

# System Architecture

Explain how all repositories are connected.

Example:
- main-web handles public website and customer-facing pages.
- admin-ms handles admin management.
- user-ms handles user profile and login-related data.
- notification-ms handles email, SMS, and WhatsApp notifications.
- file-management-ms handles uploaded documents and images.
- Keycloak is used as centralized identity provider.

# Cross-Repo Workflow

When a feature affects more than one repo, first analyze all impacted services before coding.

Example:
- Login issue may affect frontend, backend API, Keycloak, and user database.
- Booking issue may affect web, admin, payment, and notification services.

# Shared Coding Rules

- Do not break existing functionality.
- Do not remove old fields unless explicitly asked.
- Do not modify production `.env`.
- Do not run database migrations without confirmation.
- Keep backward compatibility.
- Use safe migrations only.
- Always check existing routes, controllers, models, and database columns before changing logic.

# Shared Git Rules

- Create small, meaningful commits.
- Do not push directly to production branch unless instructed.
- Show changed files before final response.
- Mention testing commands performed.

# Shared Tech Stack

- Laravel
- MySQL / MariaDB
- Blade
- REST APIs
- Keycloak SSO
- Apache / LAMPP
- GitHub
- Flutter app if applicable

# Shared Security Rules

- Never expose secrets.
- Never print client secrets, database passwords, or API keys.
- Do not commit `.env`.
- Validate all user input.
- Protect admin routes.
- Maintain authentication and authorization checks.

# Shared Testing Commands

Before final report, run when applicable:

Enter fullscreen mode Exit fullscreen mode


bash
php -l path/to/changed/file.php
php artisan route:list
php artisan config:clear
php artisan cache:clear
composer dump-autoload
git diff --stat
git diff
Final Response Format

After every implementation, provide:

Files changed
Logic changed
Commands run
Testing checklist
Rollback steps
Pending issues



# 2. Per-repo `CLAUDE.md`

Use this inside each specific repository.

Example:

Enter fullscreen mode Exit fullscreen mode


bash
/opt/lampp/htdocs/myhospitalnow/doc-core-ma/CLAUDE.md
/opt/lampp/htdocs/myhospitalnow/mydoc-doctors-ms/CLAUDE.md
/opt/lampp/htdocs/motoshare.in/motoshare-web/CLAUDE.md
/opt/lampp/htdocs/devopsschool/ds-student-ms/CLAUDE.md

Content of per-repo CLAUDE.md

This file should explain only that repo.

# Repository Overview

This repository is responsible for [specific module name].

Example:
This repo handles doctor listing, doctor profile, doctor login, doctor dashboard, and doctor-related APIs.

# Folder Structure

Important folders:

- app/Http/Controllers
- app/Models
- app/Services
- routes/web.php
- routes/api.php
- resources/views
- database/migrations
- public
- config

# Main Entry Points

Mention important files:

- routes/web.php contains web routes.
- routes/api.php contains API routes.
- DoctorController handles doctor profile logic.
- AuthController handles login and callback logic.
- resources/views/pages contains frontend Blade pages.

# Repo-Specific Rules

- Do not change unrelated modules.
- Follow existing controller and service pattern.
- Keep old login working while improving SSO.
- Do not remove legacy columns.
- Add migration only if column is missing.
- Check existing database structure before writing new query.

# Authentication Rules

Example:
- Public listing pages should remain open.
- Dashboard pages require authentication.
- Keycloak user ID should be preferred where available.
- Legacy email/user_id fallback should remain for old data.

# Database Rules

- Do not rename existing columns directly.
- Use nullable columns for safe backward compatibility.
- Always check `Schema::hasColumn()` in safe migrations.
- Never run migration without user approval.

# API Rules

- Keep existing API response format.
- Do not break mobile app compatibility.
- Add new fields without removing old fields.
- Validate request parameters.

# UI/UX Rules

- Keep existing layout functional.
- Improve design without breaking Blade variables.
- Mobile responsive design is mandatory.
- Do not remove existing form fields unless instructed.

# Performance Rules

- Avoid duplicate queries.
- Use eager loading where needed.
- Cache only safe public data.
- Do not cache user-specific sensitive data incorrectly.

# Local Commands



bash
php artisan route:list
php artisan config:clear
php artisan cache:clear
php artisan view:clear
composer dump-autoload
Enter fullscreen mode Exit fullscreen mode

Known Gotchas

Example:

Storage permission issues may cause view/log errors.
.env should not be edited directly.
Some old users may not have keycloak_user_id.
Some APIs are used by mobile app, so response format must remain stable.
Enter fullscreen mode Exit fullscreen mode

Final Report Required

Claude must always provide:

Summary of changes

Files changed
Commands run
Testing result
Risk areas
Rollback steps

Enter fullscreen mode Exit fullscreen mode

Top comments (0)