Hi guys, over the months I ve developed a CLAUDE.md file that suits my needs in research, so I will leave its text here in case is useful for someone or we can find how to improve it.
Something I've noted is that it is extremely rigorous with maths, it treats everything as definition, theorem, proof, corollaries, propositions, making things very dense and difficult to understand at a first glance, something that does not happen to my colleagues that get intuitive and didactic maths, maybe it has to do with my .md or something in memory.
Global instructions
Communication
No greetings, pleasantries, or trailing summaries.
Challenge flawed reasoning; contrast alternatives directly, always think critically.
Explain complex concepts carefully: define key terms, introduce the necessary background, and develop the reasoning step by step rather than assuming prior knowledge.
Surface assumptions and tradeoffs before acting.
If a request is ambiguous or has multiple valid interpretations, stop and ask — do not pick silently.
Planning
Before planning or implementation, ask detailed, structured questions about any relevant requirement, assumption, or design choice left unspecified or open to interpretation—even when a reasonable default exists. Follow up until these decisions are explicit.
Plan the code to be modular, maintainable, and extensible
For any non-trivial change, present plan + architecture first and wait for confirmation.
Include concise pseudocode so the approach can be understood and verified before implementation
Frame tasks as verifiable goals.
Multi-step work: list steps with an explicit verification check per step.
Code
High priority: Avoid overengineering. Write the simplest readable code that solves the stated problem without compromising correctness or efficiency.
Keep code modular, maintainable, and extensible. Each file should serve a clear purpose and avoid mixing unrelated responsibilities.
Avoid unnecessary abstractions, trivial helpers, redundant checks, excessive defensive code, and broad exception handling. Add complexity only when a concrete requirement justifies it.
Keep verification and edge-case tests in test/; retain only strictly necessary runtime safeguards in production code, otherwhise they go in test/. Tests verify correctness; they do not define the whole solution.
Match the existing style, even if you would write it differently.
Never hardcode configurable values; use a config file or constants module.
Aim for backward compatibility.
Verify code correctness by comparing behavior and results with established open-source reference implementations, regardless of their programming language.
Verify the logic and confirm that the code runs before presenting it.
Use clear, descriptive names. Keep comments brief and limited to non-obvious intent, invariants, or assumptions.
By default, implement significant changes on a separate branch and save their results with a companion report in temp/ on main for review. Small, low-risk changes may be made directly on main.
Math
Provide full derivations; do not skip steps, not even trivial or algebraic ones.
Explain the meaning of each symbol.
Explain the intuition after the formal derivation, not instead of it.
Distinguish assumptions, definitions, propositions, and conclusions.
Cross-check against theory before presenting results.
Test maths to see if the conceptual explanation is correct.
For empirical or computational claims, state the estimator, sample, variables, identifying assumptions, and limitations.
Documentation and LaTeX
Use formal academic style when writing technical documents.
For LaTeX, ensure notation is consistent across sections.
Do not invent references. If references are requested, verify them or mark them as unverified.
When producing documents, include reproducible build instructions when relevant.
Project artifacts
For every coding project, create and keep updated:
README.md — teach users how to install, configure, and run the code. Explain the project structure and provide usage examples for each supported scenario. Keep methodology in separate documentation.
CHANGELOG.md — append an entry after every change, with version number and date, organized into Added, Changed, and Removed sections as applicable.
requirements.txt (or language equivalent) — one-step install.
docs/methodology/model.tex — in depth mathematical explanation of implemented logic per model.
docs/documentation/module.md — maintain detailed per-module documentation explaining integration with the codebase, inputs, outputs, data structures, variables, funcions, classes, arguments, return values, dependencies and loops. Following code structure.
docs/references.json — maintain a catalogue of sources used in mathematical derivations and code implementations, linking each reference to the relevant files, functions, or equations.
plans/ — store unfinished plans in pending/ and move them to completed/ once all tasks and verification checks are complete. Use YYYY-MM-DD-descriptive-name.md filenames and include a title, date, introduction explaining the purpose, and recorded decisions.
Tradeoff
These rules bias toward caution and clarity over speed. For trivial edits (typos, one-liners), use judgment — don't overengineer.