Every project must be completely regenerable from its specification:
- CLAUDE.md contains complete technical specification and AI instructions
- All architectural decisions, APIs, and implementation details documented
- Specification updated immediately when changes are made
- AI should be able to recreate the entire project from CLAUDE.md alone
All significant decisions must be documented:
- DECISIONS.md maintained with standardized format
- Every architectural choice logged immediately when made
- Rationale, alternatives, and impact documented
- Decision numbers referenced in code and commits
Tests are not optional:
- Write tests before implementing features
- Maintain 90%+ test coverage
- Update tests immediately when changing functionality
- Include negative test cases and edge conditions
- Performance benchmarks for critical paths
Three distinct documentation files with clear purposes:
- CLAUDE.md: Technical specification for regeneration
- README.md: End-user focused documentation
- DECISIONS.md: Architectural decision history
project-name/
├── CLAUDE.md # Regenerable technical specification
├── README.md # End-user documentation
├── DECISIONS.md # Architectural decision log
├── src/ # Source code
├── tests/ # Test suites
│ ├── unit/
│ ├── integration/
│ ├── e2e/
│ └── helpers/
├── docs/ # Additional documentation
├── config/ # Configuration files
├── scripts/ # Build/deployment scripts
└── package.json # Dependencies and scripts
- Projects:
kebab-casewith meaningful prefixes (mcp-mycelium,api-gateway) - Files:
kebab-case.extensionfor consistency - Functions:
camelCasefor JavaScript/TypeScript - Constants:
SCREAMING_SNAKE_CASE - Types/Interfaces:
PascalCase
- Strict mode enabled always
- No
anytypes without explicit justification - Complete type definitions for all public APIs
- JSDoc comments for all exported functions
- Every operation must have appropriate error handling
- Error messages should be AI-friendly and descriptive
- Use structured error types with context
- Log errors with sufficient debugging information
- Unit Tests: All core modules and utilities
- Integration Tests: API interactions and data flows
- End-to-End Tests: Complete user workflows
- Performance Tests: Critical paths and scalability
- Regression Tests: All bug fixes must include tests
- Profile critical paths and optimize for expected load
- Establish performance benchmarks and monitor
- Memory usage should scale predictably
- Response times documented and monitored
- Always reference current CLAUDE.md for project context
- Require decision logging for any architectural changes
- Insist on test coverage for new functionality
- Validate that changes maintain specification compliance
- Update documentation before considering features complete
- Start with project context: "I'm working on [project] which [brief description]"
- Reference standards: "Following my coding standards from [repo]"
- Be explicit about requirements: "This must include tests and decision logging"
- Request documentation updates: "Update CLAUDE.md to reflect these changes"
- CLAUDE.md updated with every architectural change
- README.md updated when user-facing features change
- DECISIONS.md updated immediately when decisions are made
- All three files version-controlled alongside code
Before merging any feature:
- Tests pass and coverage maintained
- Documentation updated appropriately
- Architectural decisions logged if applicable
- Code follows established patterns
- Performance impact assessed
Periodically verify regeneration capability:
- Create new project from CLAUDE.md specification alone
- Compare against existing implementation
- Identify and fix specification gaps
- Update specification with missing details
- TypeScript for type safety and tooling
- Node.js for server-side applications
- Modern frameworks with active communities
- Established libraries over bleeding-edge options
- Docker for containerization and deployment
- Configuration-driven setup over hardcoded values
- Environment-based configuration management
- Structured logging with appropriate levels
- Structured logs in JSON format
- Performance metrics for critical operations
- Error tracking with context and stack traces
- Health checks for all services
Document any decision that:
- Changes public APIs or interfaces
- Affects architecture or major code organization
- Chooses between significant alternatives
- Impacts testing strategy or deployment
- Resolves design problems or technical constraints
Evaluate options based on:
- Maintainability: Can future developers understand and modify?
- Testability: Can we write comprehensive tests?
- Performance: Does it meet expected load requirements?
- Documentation: Can we document it clearly?
- Regenerability: Does it support complete project recreation?
- Functions longer than 50 lines without clear justification
- Classes with more than 10 public methods
- Nested conditionals deeper than 3 levels
- Magic numbers or strings without named constants
- Copy-paste code without refactoring
- Out-of-date specifications that don't match implementation
- Missing decision rationale for architectural choices
- User documentation that assumes technical knowledge
- API documentation without examples
- Tests that depend on external services
- Flaky tests that pass/fail randomly
- Tests that test implementation details instead of behavior
- Missing edge case coverage
These standards should evolve based on project experience:
- Add new patterns that prove successful
- Remove or modify patterns that cause problems
- Update based on new technology capabilities
- Incorporate lessons learned from project retrospectives
Document changes to standards in this repo's own DECISIONS.md file.