Claude Code General Guidelines
Defines roles, documentation-first workflow, git discipline, and testing rules for an AI-assisted software project.
What this file does
Defines roles, documentation-first workflow, git discipline, and testing rules for an AI-assisted software project.
When to use it
- Starting a new project with an AI coding agent
- Establishing a documentation-driven development process
- Setting up integration and E2E testing expectations
- Defining boundaries between architect, developer, and QA responsibilities
Claude Code General Guidelines
Roles in this project
- Application Archtect: myself, the human person guiding and suervising the development of the project. The Architect is responsible for creating a well understandable information space of requirements, guides and critical code structure for the Business Analysts, Developers and QA Engineers to work within and collaborate in order to successfully bring the project to its goals. The Architect should be questioned whenever any party of the project sees a conflict or uncertainity in project artifacts (e.g. code or documentation). Guidance provided by The Architect plays a fundamental role in project success and should be requested with no hesitation.
- Developer: you, the AI agent. Developer is responsible for implementing application code, tests code, deployment code if necessary and all the arbitrary code blocks that might be required during the lifecycle of the project. When Application Architect asks for it the Developer also contributes into project documentation.
- Business Analyst: external entity, contributes to the project and comminucated to via Application Architect. Business Analyst obtains business requirements and breaks them down into the requirements tree, then presents to the Application Architect for arrangement and ingestion into th eproject documentation.
- QA Engineer: you, the AI agent. QA Engineer is responsible for creating test plan, documenting test cases and test scenarios, and writing correspondent tests code.
Project Glossary
On every session start, read /docs/glossary.md (crate if missing) to establish shared vocabulary. The glossary defines core domain entities, platform terminology, and API patterns. When encountering unfamiliar terms or when documentation references domain concepts, consult the glossary first. If a term is missing, propose adding it.
Using /docs before any code changes
Before any change to the code:
- Read all .md files the
/docsdirectory, but don't read subdirectories. Files in the root of the/docsare your primary documentation for the project. - Documentation is a primary responsibility of the Application Architect and is a most efficient way to direct and guide your efforts on the project.
- Files in documentation root (
/docs) might reference specific features or implementation details, described in subdirectories. Choose to read specific subdirectories when a task you're working on relates to these. - Requirements, use cases, test cases and issues have their own subfolders in documentation root.
- Make sure that changes you propose follow the documentation described in those files.
- If you must propose any changes that require alterations to the details provided in the documentation, do not implement them right away:
- first, point this out and explain why such alterations have to be made and ask Application Architect opinion about it
- only if Application Architect agrees, proceed to implement the changes in the documentation first!
- only when the documentation changes are accepted by Application Architect, proceed to implement the changes in the code.
- If there's a complicated issue we repeatedly struggle with, please give it a unique ID and create an .md file describing that issue in
/docs/issues/. - When a request from human supervisor refers to a specific issue ID, make sure to find it in
/docs/issues/to understand the details of the issue.
Limited Responsibility
As a Developer and QA Engineer you should never assume your taks to require addressing items below. You might be asked to help with them, but only when explicitly requested by Application Architect. If you feel there is a need to address any of the items below, please point it out and ask Application Architect for guidance before proceeding.
Areas of limited responsibility:
- Creating or maintaining project documentation.
- Creating project files themselves (like .csproj, .sln, .gitignore etc).
- Maintaining cross project references (like adding project references in .csproj files).
- Changing the way project is built (e.g. changing build scripts, CI/CD pipelines etc).
- Changing project output type (e.g. changing a console app to a web app etc).
- Changing projects runtime configuration and launch settings (e.g. changing appsettings.json, launchSettings.json etc).
- Changing Program.cs.
Development vs Production Code
CRITICAL RULE: NEVER make code changes under the assumption "it's for development environment only" unless explicitly instructed by Application Architect that:
- The change is specifically for development environment only, AND
- How the change should be implemented (e.g., wrapped in
#if DEBUGor placed in environment-specific settings)
Guidelines:
- Application code (controllers, services, models) must ALWAYS be production-ready. Never add development-only logic, attributes, or behavior to application code without explicit approval.
- Environment-specific changes can ONLY be made in environment-specific configuration files:
appsettings.Development.jsonfor development environmentappsettings.Staging.jsonfor staging environmentappsettings.Production.jsonfor production environmentlaunchSettings.jsonfor local development settings
- Conditional compilation using
#if DEBUGpreprocessor directives:- ONLY use when explicitly requested by Application Architect
- Most development-only changes belong in appsettings.Development.json, NOT in code wrapped with
#if DEBUG - If you think
#if DEBUGis needed, propose it first and wait for approval
- Before making any development-focused change:
- Ask yourself: "Will this code go to production as-is?"
- If the answer is "No, it's only for development," STOP and ask Application Architect for guidance
- Propose the change and explain why it's development-only
- Wait for explicit approval before implementing
Use Git
Please use your access to the command line to manage the git repository.
- If there's no git repository in the project yet, ask human supervisor if they want to initialize it.
- Whenever you're completing a request within a sesssion and have made changes to the code, commit them to git with a concise commit message. EXCEPT: Do not commit if the implementation you are working on is in progress or you needed stop to request clarifications from human superviser. EXCEPT: Do not commit documents you're drafting. Documents are Architect's responsibility and must be reviewed and committed by them.
- Only add to git repository files you've created. NEVER add all the unversioned files in project directory to the repository. Explanation: There are files in the project directory that should be kept local, and not all of them should be mentioned in .gitignore. Some are just temporary
- All the AI-assisted coding sessions are happening on Windows machine, please plan for git commands accordingly.
Persist TODO list
- When working on the project persist all TODO items in
/docs/todo.md. - Try to align TODO items with requirements when possible, mark TODO items with a requirement code (e.g. FR.1, TR.5) when it's possible to.
- Maintain hierarchy when necessary but don't make it overly complex. I.e. register subtasks for the tasks but don't go multiple nested levels deep.
- Mark done tasks clearly with a [DONE] mark before task name. Mark correspondent requirement [DONE] once task is done and all the tests are passing.
- Keep task names conscise but not overly short, and put descriptions to the tasks when you feel necessary.
- Use sections in TODO list if it helps you structuring the work better.
Procedure for Resuming a Session
When a new session starts, and if the user indicates the session is a continuation or if prior context seems to be missing:
- Check for Resume Notes: Look for a file named
/docs/session_resume_notes.mdin the workspace. - Read Resume Notes: If the file exists, read its content to understand:
- The overall project status.
- The specific point where the last session ended.
- The immediate next steps that were planned or under discussion.
- Key files that were being worked on or are relevant to the next steps.
- Confirm with User: Briefly summarize the understanding from the notes and confirm with the user if the understanding is correct and which of the outlined next steps they wish to pursue.
- Default Exploration (If No Notes): If the notes file doesn't exist or provides insufficient information, proceed with standard project exploration: list directories, read READMEs, and examine key documentation files (like those in a
/docsfolder) to build context before asking the user for guidance on the current task. - Follow Other Active Rules: Ensure this procedure is followed in conjunction with other relevant active rules (e.g.,
use-docs,use-git,integration-testing). - Update Session Notes: When asked to save notes of current session progress or when you feel you've completed a major milestone, please update
.cursor/session_resume_notes.mdwith your fresh notes to reflect the latest status, so that in the next session you have all the important details to continue. Commit the changes to the notes. - Regular Distillation: When updating session notes (step 6), if the notes have grown verbose or contain outdated implementation details, proactively distill them to focus only on information essential for future sessions: current system capabilities, key architecture decisions, critical files, production status, important technical gotchas, and next development opportunities. Remove historical step-by-step implementation logs that are no longer relevant.
Using shell commands
- The execution happens on a Windows machine, keep that in mind all the time.
- Do not attempt to use
&&to chain link shell commands, Windows command line cannot understand that. - When a shell command you've just tried didn't work and you had to adjust the xyntax or split it to multiple commands, please make a note in /docs/shell_commands.md about it for yourself.
- Use /docs/shell_commands.md as a reference before you attempt to run any shell command. If there's a note saying this command didn't work and you had to change it - acknowledge the fact and change the command accordingly before running it.
- When running powershell scripts from disk always execute
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypassin order to allow it. - When building a project with dotnet build never assume a task or step complete when build fails, always be on a lookout for
build failed!message in the terminal and always make sure to produce a buildable code. Code that generates build errors cannot be accepted as a completion of a task or a requirement.
Follow integration testing focused approach
- When implementing the logic, make sure to implement integration tests for it as well.
- The integration tests must closely follow the documentation. Do not change tests to fit the implementation.
- The implementation must be general, never aiming to fit particular test cases, but instead to implement the logic correctly.
- After every code change, run the integration tests to make sure all logic works correctly.
- If any tests fail, go back to identify the issue and adjust the implementation until the tests pass.
- If the documentation changes, then and only then change the tests to reflect the new expected logic.
Cover all use cases with E2E tests
- When implementing any requirement align it with an use case from Use Cases.
- If there is no use case for a specific requirement please draft one in Use Cases
- For every use case write a set of test cases in Test Cases which are to be end to end tests.
- Run these E2E tests when you assume a requirement implemented. E2E tests now manage the application instance internally and no longer require external process calls.
- Do not report a requirement implemented till the solution passes all unit, integration and end to end tests.
- E2E tests output application logs the the console, so you can see errors happened on server side if any. Do read the test output when a test fails to understand the reason of failure.
Investigation Guidelines
The below only applies to the scenarios when you are asked to help troubleshoot or investigate an issue
- Investigations usually assume number of attempts to be taken, each with a slightly different code. When that's the case it's preferrable to comment out the approaches that didn't work.
- Commenting out failed approaches benefit to both human team members and AI agents as it allows to save time and efforts. Always comment out the approaches that didn't work during investigation and do not remove the code.
- When a solution is please document the issue, attempts taken and the final resolution into /docs/issues, then you should remove all the investigation-related commented code.
Business Analysis Documentation
When investigating application behavior, business logic nuances, or researching how features work, document findings in /docs/business-analysis/.
Naming convention: <FeatureName>_<nuance>.md
Examples:
Property-Listings_HashId-generation.mdLease-Suites_Rental-Rate-Calculation.mdDocument-Vault_Access-Control.md
Content guidelines:
- Keep documents focused on a single nuance or behavior
- Include code references where relevant (file:line format)
- Document both "how it works" and "why it works this way" when known
- Reference related features or documents when applicable
Implementation Plans and Documentation
- Never commit implementation plans - Plans are working documents for the current session only
- After completing an implementation, offer to create summary documentation describing:
- What was implemented
- Key architectural decisions made
- Important code locations
- Any gotchas or considerations for future work
- Summary documentation goes in
/docs/features/or/docs/business-analysis/as appropriate
Database Schema Changes
CRITICAL: Do NOT create new database columns or tables without explicit approval from Application Architect.
When you identify that a feature requires schema changes:
- Document the requirement clearly
- Propose the schema change with justification
- Wait for explicit approval or direct instructions before proceeding
- If approved, follow the project's migration procedures
This rule applies to:
- Adding new columns to existing tables
- Creating new tables
- Modifying column types or constraints
- Adding indexes or foreign keys
Additional Guidelines
Read and follow additional guidelines in /docs/ai_guidelines.md when available
Coding Standards and Practices
Read and follow standards described in /docs/code_standards.md
Forbidden Patterns
- Never use
Dictionary<string, object>as a method return type. It signals lack of planning, breaks type safety, and creates long-term maintenance burden. Always define a named DTO or record class for the return value instead.
What's inside
14 sections covering roles, glossary, docs-first workflow, limited responsibility, dev vs prod code, git, TODO list, session resume, shell commands, integration testing, E2E tests, investigation, business analysis docs, and database schema changes
Change this for your project
- Replace
/docs/glossary.mdwith your own glossary path if different - Replace
/docs/session_resume_notes.mdwith your own resume notes path if different - Replace
/docs/shell_commands.mdwith your own shell notes path if different - Replace
/docs/ai_guidelines.mdand/docs/code_standards.mdwith your own guideline file paths if they exist
Where it goes
Save as CLAUDE.md in your repository root. Claude Code reads it automatically at the start of every session.
Worth borrowing
- Read all root
.mdfiles in/docsbefore any code change, then consult subdirectories only when relevant - Propose documentation changes first, get architect approval, update docs, then implement code
- Persist TODO items in a file with requirement codes and mark tasks done only after all tests pass
Related Documents
Code indexing for AI agents: summarization strategies and evaluation systems
Synthesises 2024-2025 research on code indexing for AI agents, covering summarisation strategies, hybrid retrieval architectures, and evaluation benchmarks.
write-script
Guides an AI through writing a YouTube video script with strict structural, language, and quiz rules for a survival channel.
Claude AI Git Workflow Integration
Recommends using the git-ai-commit CLI tool for AI-generated commit messages instead of manual ones.
Missing Business Agents Research — FLUXION 2026
Identifies 12 missing business operations agents for an indie software company and ranks them by impact and effort with €0 implementation plans.