A track & traceable library of best practices for using GitHub Copilot to support ioBroker adapter development
This repository provides comprehensive guidance and best practices for leveraging GitHub Copilot in ioBroker adapter development. By using these standardized instructions, developers can:
- Accelerate development with AI-powered code suggestions tailored for ioBroker
- Maintain consistency across different adapter projects
- Follow established patterns and avoid common pitfalls
- Improve code quality through proven best practices
- Reduce learning curve for new ioBroker adapter developers
ioBroker is a powerful integration platform for the Internet of Things (IoT), designed to connect various smart home devices, services, and systems into a unified automation platform. Adapters are the core components that enable ioBroker to communicate with different technologies and services.
-
Integrate Copilot Instructions (Recommended)
- If you already have a
.github/copilot-instructions.mdfile, merge the content from this template rather than replacing it - Use GitHub Copilot to help you merge the instructions: "Merge my existing copilot instructions with the template from https://github.com/DrozmotiX/ioBroker-Copilot-Instructions maintaining project-specific context"
- Add the template version reference to track updates
- If you already have a
-
New Repository Setup
- Download the latest version of
template.md - Save it as
.github/copilot-instructions.mdin your adapter repository's.github/folder - Customize sections marked with
[CUSTOMIZE]for your specific adapter requirements
- Download the latest version of
-
Enable GitHub Copilot
- Ensure GitHub Copilot is enabled for your repository
- The instructions will automatically be used by Copilot when working in your codebase
For repositories with existing Copilot instructions:
# Navigate to your ioBroker adapter repository
cd your-iobroker-adapter
# Ask GitHub Copilot to merge the instructions
# Use the following prompt in your editor:
# "Merge my existing .github/copilot-instructions.md with the ioBroker template
# from https://github.com/DrozmotiX/ioBroker-Copilot-Instructions/blob/main/template.md
# Keep project-specific content and add version: 0.4.0"
# NOTE: Exclude the HTML comment block at the top of the template"For new repositories:
# Navigate to your ioBroker adapter repository
cd your-iobroker-adapter
# Create .github directory if it doesn't exist
mkdir -p .github
# Download the latest template
curl -o .github/copilot-instructions.md https://raw.githubusercontent.com/DrozmotiX/ioBroker-Copilot-Instructions/main/template.md
# Remove the template comment block at the top (lines starting with <!--)
sed -i '/^<!--$/,/^-->$/d' .github/copilot-instructions.md
# Commit the changes
git add .github/copilot-instructions.md
git commit -m "Add GitHub Copilot instructions for ioBroker development"
git pushTo ensure you're using the latest best practices and that your local copy stays synchronized with improvements:
- Latest Version: v0.4.0
- Template Location:
template.md - Last Updated: September 2025
You can validate your local template version by checking the version header in your .github/copilot-instructions.md file:
**Version:** 0.4.0
**Template Source:** https://github.com/DrozmotiX/ioBroker-Copilot-InstructionsTo update to the latest version:
- Check for updates in this repository
- Compare versions between your local copy and the latest release
- Download the new template and replace your local version
- Review changes to understand what improvements were made
- Test to ensure compatibility with your project
You can use the provided script to check your template version:
# Download and run the version check script
curl -s https://raw.githubusercontent.com/DrozmotiX/ioBroker-Copilot-Instructions/main/scripts/check-template-version.sh | bashThis repository includes comprehensive version management scripts that automatically handle version consistency across all documentation:
# Show current versions across all files
./scripts/manage-versions.sh show
# Check for version inconsistencies
./scripts/manage-versions.sh check
# Sync documentation with current template version (updates dates and versions dynamically)
./scripts/manage-versions.sh sync
# Update to a new version across all files
./scripts/manage-versions.sh update 0.3.2These scripts ensure that:
- Version numbers are dynamically pulled from the template
- Documentation dates stay current
- All cross-references remain consistent
- Manual version updates are no longer needed
This repository includes a comprehensive automated testing framework that ensures all scripts and automations work correctly:
# Run all tests (54 total tests)
./tests/test-runner.sh
# Run specific test file
./tests/test-runner.sh tests/test-extract-version.sh
# Tests are automatically run in CI/CD via GitHub ActionsTest Coverage:
- Unit Tests: Individual script functions and parameter validation
- Integration Tests: Cross-script workflows and end-to-end scenarios
- Error Handling Tests: Missing files, invalid parameters, network failures
- Consistency Tests: Version synchronization and file state validation
Key Features:
- Isolated Test Environments: Each test run uses temporary directories to prevent interference
- Comprehensive Reporting: Color-coded output with detailed error messages and debugging information
- CI/CD Integration: Automated testing on all repository changes via
.github/workflows/test-scripts.yml - Developer Friendly: Simple commands with clear documentation in
TESTING.md
All repository scripts are thoroughly tested to prevent regressions and ensure reliability for the ioBroker community.
You can set up a GitHub Action to periodically check if your template is up-to-date:
# .github/workflows/check-copilot-template.yml
name: Check Copilot Template Version
on:
schedule:
- cron: '0 0 * * 0' # Weekly check
workflow_dispatch:
jobs:
check-template:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check template version
run: |
CURRENT_VERSION=$(grep "Version:" .github/copilot-instructions.md | head -1 | sed 's/.*Version:\s*//')
LATEST_VERSION=$(curl -s https://raw.githubusercontent.com/DrozmotiX/ioBroker-Copilot-Instructions/main/template.md | grep "Version:" | head -1 | sed 's/.*Version:\s*//')
if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then
echo "Template is outdated. Current: $CURRENT_VERSION, Latest: $LATEST_VERSION"
exit 1
fiThe Copilot instruction template covers:
- Unit testing with Jest framework
- Official @iobroker/testing framework - Complete integration testing patterns following official guidelines
- Mocking strategies for ioBroker adapters
- Error handling test scenarios
- API testing with credentials - Password encryption and demo credential patterns
- Enhanced test failure handling - Clear, actionable error messages for debugging
- CI/CD integration - Separate jobs for credential-based API testing
- Required documentation sections
- Multi-language support guidelines
- Configuration documentation patterns
- User-friendly examples and usage instructions
- Mandatory PR documentation - WORK IN PROGRESS section requirements
- Standardized changelog format - Consistent categorization and user-focused descriptions
- Best practices for npm package management
- Security and audit guidelines
- Preferred libraries and alternatives
- Version management strategies
- Modern admin interface development
- Configuration schema patterns
- Validation and error handling
- User experience guidelines
- Preference for native Node.js APIs (like
fetchoveraxios) - Minimal dependency strategies
- Performance considerations
- Security best practices
By integrating GitHub Copilot with these specialized instructions, ioBroker adapter developers benefit from:
- Context-aware suggestions specific to ioBroker development patterns
- Consistent code style across the ioBroker ecosystem
- Best practice enforcement through AI-guided development
- Reduced development time with intelligent code completion
- Knowledge transfer from experienced to new developers
- Quality assurance through established patterns and practices
We welcome contributions to improve these instructions! Please:
- Fork this repository
- Create a feature branch
- Make your improvements
- Run the test suite:
./tests/test-runner.shto ensure all tests pass - Update documentation: Add changelog entries and update README if needed
- Test with real ioBroker adapter development
- Submit a pull request with a clear description of changes
- All new scripts must have corresponding tests in the
tests/directory - Changes to existing scripts require updating relevant test cases
- Follow the testing patterns documented in
TESTING.md - Ensure all 54 tests pass before submitting PRs
- @ticaki - For providing comprehensive lessons learned and best practices for ioBroker integration testing framework
- ioBroker Community - For continuous feedback and real-world testing scenarios
- GitHub Copilot Team - For enabling AI-powered development assistance
This project is licensed under the MIT License - see the LICENSE file for details.
- ioBroker Official Website
- ioBroker GitHub Organization
- ioBroker Developer Documentation
- GitHub Copilot Documentation
- Issues: Report bugs or request features in GitHub Issues
- Discussions: Join conversations in GitHub Discussions
- ioBroker Community: Visit the ioBroker Forum