Guidelines for creating, organizing, and maintaining documentation in the Battery Energy Trading project.
Last Updated: 2025-10-02
- Documentation Structure
- File Naming Conventions
- Directory Organization
- Writing Guidelines
- When to Archive Documentation
- Index Files
- Cross-References and Links
- Maintenance Workflow
Files in the project root should be:
- Essential project files: README.md, CHANGELOG.md, LICENSE, INSTALLATION.md
- Project meta-documentation: CLAUDE.md (AI guidelines), DOCUMENTATION_AUDIT.md (planning)
- Temporary project-specific: Keep to minimum, archive when complete
What NOT to put in root:
- ❌ Implementation logs (move to
docs/development/history/) - ❌ Temporary todo lists (use issue tracker instead)
- ❌ Refactoring notes (move to
docs/development/history/when done) - ❌ Test results logs (move to
docs/development/history/)
docs/
├── README.md # Master documentation index
├── TERMINOLOGY.md # Key concepts glossary
│
├── user-guide/ # End-user documentation
│ ├── README.md # User guide index
│ ├── dashboard-setup.md
│ └── dashboard-entity-reference.md
│
├── integrations/ # Third-party integration guides
│ ├── README.md # Integrations index
│ ├── sungrow.md
│ └── sungrow-reference.md
│
├── development/ # Developer documentation
│ ├── README.md # Development index
│ ├── testing.md
│ ├── manual-testing-checklist.md
│ ├── features.md
│ ├── release-process.md
│ │
│ └── history/ # Historical implementation logs
│ ├── README.md # History index
│ ├── dependency-modernization-2025-10.md
│ ├── refactoring-summary-2025-10.md
│ └── *.md
│
└── api/ # API reference documentation
├── README.md # API index
└── [future API docs]
- Use kebab-case:
dashboard-setup.md,getting-started.md - Be descriptive:
sungrow-integration-guide.mdnotsungrow.md - Avoid abbreviations:
configuration.mdnotconfig.md - Use
.mdextension: All documentation in Markdown format
Historical implementation logs use date-stamped naming:
Format: {topic}-{yyyy-mm}.md
Examples:
dependency-modernization-2025-10.mdrefactoring-summary-2025-10.mdmulti-peak-implementation-2025-10.md
When to use date stamps:
- Implementation logs/diaries
- Refactoring documentation
- Historical test results
- Migration documentation
When NOT to use date stamps:
- Current reference guides
- Ongoing feature documentation
- API documentation
- User guides
Every directory MUST have a README.md that serves as an index:
Purpose:
- Lists all documents in directory
- Provides brief description of each
- Links to related sections
- Guides navigation
Example structure:
# Section Title
Brief description of this documentation section.
## Available Documents
- **[Document Title](document-name.md)** - Brief description
- **[Another Document](another-document.md)** - Brief description
## Related Sections
- [User Guide](../user-guide/README.md)
- [Development](../development/README.md)Purpose: End-user documentation for installation, configuration, and usage
Contains:
- Installation guides
- Configuration wizards
- Dashboard setup
- Troubleshooting
- Entity reference lists
Does NOT contain:
- Code architecture
- Development setup
- Test documentation
- Implementation details
Purpose: Third-party integration guides (inverters, battery systems)
Contains:
- Integration setup guides
- Entity reference documentation
- Automation examples
- Hardware specifications
Naming pattern: {system-name}.md for guides, {system-name}-reference.md for entity references
Purpose: Developer documentation for contributing and extending
Contains:
- Development environment setup
- Testing guides
- Feature documentation
- Release process
- Architecture overview
Does NOT contain:
- Historical logs (use
history/subdirectory) - Temporary planning documents
- Implementation diaries
Purpose: Historical implementation logs and context
Contains:
- Completed implementation logs
- Refactoring documentation
- Migration guides (when complete)
- Test result archives
- Code review notes
When to move here:
- Implementation is complete
- Document is a log/diary format
- Information is context, not current guidance
- Document describes "how we got here" vs "how to do it"
Purpose: Technical API documentation and code reference
Contains (future):
- Class and method documentation
- API signatures and parameters
- Code examples
- Integration patterns
- Start with a title: Clear H1 heading
- Add metadata: Last updated date for reference docs
- Include TOC: For documents >100 lines
- Use sections: Clear H2/H3 hierarchy
- End with links: Related documentation, next steps
- Be concise: Get to the point quickly
- Use examples: Show, don't just tell
- Code blocks: Always specify language for syntax highlighting
- Screenshots: Use sparingly, describe in alt text
- Callouts: Use blockquotes for important notes
Example callout:
> **Note**: This feature requires Home Assistant 2024.1.0 or newer.- Use present tense: "The optimizer selects slots" not "will select"
- Use active voice: "Configure the entity" not "The entity should be configured"
- Be specific: "Set to 10kW" not "Set to a high value"
- Define terms: Link to
TERMINOLOGY.mdfor domain-specific terms
Always include:
- Language identifier:
python,yaml, ```bash - Comments: Explain non-obvious parts
- Complete examples: Show full context when possible
- Working code: Test examples before documenting
Good example:
# automation.yaml
automation:
- alias: "Battery - Forced Discharge"
trigger:
- platform: state
entity_id: binary_sensor.battery_energy_trading_forced_discharge
to: "on"
action:
- service: select.select_option
target:
entity_id: select.sungrow_ems_mode
data:
option: "Forced Mode"-
Implementation is complete
- Feature has been implemented and tested
- No ongoing development work
- Document served as planning/implementation log
-
Document is historical context
- Describes why decisions were made
- Implementation diary or log format
- Useful for understanding evolution, not current usage
-
Information is outdated
- Describes old implementation approach
- Superseded by newer documentation
- Still valuable as historical reference
-
Information is actively used
- Reference material for current features
- How-to guides for users/developers
- Part of daily workflow
-
Document will be updated
- Living documentation
- Ongoing feature documentation
- Current best practices
-
Required for onboarding
- New user setup guides
- Developer getting started
- Core concepts and architecture
Archive these:
- ✅ "Multi-peak Discharge Implementation Log (2025-10)"
- ✅ "Dependency Modernization Process"
- ✅ "Refactoring Summary - Base Entity Helpers"
- ✅ "Test Results - October 2025"
Keep these:
- ✅ "Testing Guide" (actively used)
- ✅ "Features Documentation" (living document)
- ✅ "Release Process" (ongoing workflow)
- ✅ "Dashboard Setup" (user onboarding)
Every directory MUST have a README.md index file.
- Section title - Clear H1 heading
- Section description - What this documentation covers
- Document list - All docs in directory with descriptions
- Navigation links - Links to parent/sibling sections
- Quick reference - Optional quick links for common tasks
# Section Title
Brief description of what this documentation section covers.
## Available Documents
- **[Document Title](document-name.md)** - Brief description
- **[Another Document](another-name.md)** - Brief description
## Quick Reference
Optional section for frequently accessed content.
## Related Sections
- [Parent Section](../README.md)
- [Sibling Section](../sibling/README.md)When to update:
- Adding new documentation
- Removing outdated documentation
- Restructuring sections
- Changing document names
What to update:
- Document list (add/remove entries)
- Descriptions (keep current)
- Links (verify still valid)
- Related sections (add new cross-refs)
Always use relative paths, not absolute URLs:
Good:
[Testing Guide](../development/testing.md)
[Installation](../../INSTALLATION.md)Bad:
[Testing Guide](https://github.com/Tsopic/battery_energy_trading/blob/main/docs/development/testing.md)Link to specific sections when possible:
[Installation Prerequisites](../../INSTALLATION.md#prerequisites)
[Running Tests](../development/testing.md#running-tests)When moving/renaming files:
- Use search to find all references
- Update all cross-references
- Verify links work after move
- Update index files
Search command:
# Find all references to a file
grep -r "sungrow.md" docs/-
Choose correct directory
- User guide? →
docs/user-guide/ - Integration? →
docs/integrations/ - Developer? →
docs/development/ - API? →
docs/api/
- User guide? →
-
Follow naming convention
- Kebab-case:
feature-name.md - Descriptive:
sungrow-integration-guide.md - Historical:
implementation-2025-10.md
- Kebab-case:
-
Update index file
- Add entry to directory
README.md - Include brief description
- Maintain alphabetical or logical order
- Add entry to directory
-
Update master index
- Add to
docs/README.mdif major document - Update relevant section index
- Add to
-
Cross-reference
- Link from related documents
- Add to relevant navigation
-
Move to history
mv docs/development/implementation-log.md \ docs/development/history/implementation-log-2025-10.md
-
Update date stamp
- Add
{yyyy-mm}to filename - Update "Last Updated" metadata
- Add
-
Update index files
- Remove from current section index
- Add to history index
- Update master index if needed
-
Update cross-references
- Search for references to file
- Update or remove links
- Add "archived" note if keeping reference
-
Add archive note
- Add note at top of archived file:
> **Note**: This document has been archived as of 2025-10-02. > For current documentation, see [Testing Guide](../testing.md).
- Add note at top of archived file:
-
Verify safe to delete
- Check for cross-references
- Confirm no valuable unique info
- Ensure content exists elsewhere
-
Search for references
grep -r "filename.md" docs/ -
Remove references
- Update index files
- Remove cross-references
- Update navigation
-
Delete file
rm docs/path/to/file.md
Quarterly review:
- Verify all links work
- Update outdated information
- Archive completed implementation logs
- Remove temporary documentation
- Update index files
- Check for duplicate content
Before each release:
- Update CHANGELOG.md
- Review user-facing documentation
- Update version numbers
- Verify installation guide is current
- Test all code examples
✅ Clear structure:
# Dashboard Setup Guide
Complete guide for installing and configuring the dashboard.
## Prerequisites
- Battery Energy Trading integration installed
- Nord Pool integration configured
## Installation
1. Copy dashboard YAML...✅ Descriptive filenames:
dashboard-setup-guide.mdsungrow-integration-guide.mdmanual-testing-checklist.md
✅ Proper archiving:
docs/development/history/refactoring-summary-2025-10.mddocs/development/history/test-results-2025-10.md
❌ Poor structure:
# Setup
Here's how to setup...
(no prerequisites, no sections, jumps right in)❌ Vague filenames:
guide.mdsetup.mdnotes.md
❌ Root clutter:
REFACTORING_NOTES.md(should be archived)todo.md(should be in issue tracker)TEST_RESULTS.md(should be archived)
Use this checklist when creating or updating documentation:
- File in correct directory (
user-guide/,development/, etc.) - Follows naming convention (kebab-case, descriptive)
- Has clear title (H1)
- Includes TOC if >100 lines
- Uses proper markdown formatting
- Code examples have language specified
- Updated directory
README.mdindex - Updated
docs/README.mdmaster index (if major doc) - Links use relative paths
- Cross-referenced from related docs
- Moved to
docs/development/history/ - Added date stamp to filename (
-2025-10.md) - Added archive note at top of document
- Updated all cross-references
- Removed from current section index
- Added to history index
- Verified no broken links
- Verified safe to delete (content exists elsewhere)
- Searched for all references
- Updated/removed cross-references
- Updated index files
- Committed deletion with clear message
For questions about documentation:
- Check existing documentation in
docs/ - Review this guidelines document
- Look at recent commits for examples
- Ask in GitHub Discussions
For suggesting improvements to these guidelines:
- Open a GitHub Issue with label
documentation - Submit a Pull Request with proposed changes