Automated Feature Implementation: Step-by-Step Guide
GitHub Copilot: Automating Feature Implementation
Hey there, fellow coders! This guide is all about how GitHub Copilot can autonomously implement features from the features.md file. It's designed to streamline the development process, making it easier and faster to bring new features to life in your project. Let's dive in and see how it works!
Instructions for Copilot: Your Step-by-Step Guide
Feature Selection: Choosing the Right Feature
The first step is for Copilot to select a feature from the features.md file located at /home/runner/work/community-simulation/community-simulation/features.md. But how does it decide which one? Here's the priority list:
- High Priority (Quick Wins): Features marked as "Hohe Priorität (Quick Wins)" get top billing. These are the ones we want to knock out first.
- Simpler Features: Next, Copilot looks for features that are easy to implement with minimal changes. The goal is to keep things simple and efficient.
- No External Dependencies: Features that don't require external dependencies or major architectural changes are favored. This helps keep the implementation process clean and focused.
- Feature Order: Finally, features from the "Neue Features" section are prioritized over those in the "Code-Verbesserungen" section.
After selecting a feature, the Copilot will clearly document its choice in the PR description.
Before Implementation: Planning is Key
Before diving into the code, Copilot needs to do a bit of planning. This involves:
- Feature Identification: Stating the selected feature's ID and Name.
- Rationale: Explaining why this feature was chosen. This provides context and helps understand the decision-making process.
- Implementation Plan: Outlining the implementation plan as a checklist. This ensures a structured approach to the development process.
This upfront planning helps make sure the implementation goes smoothly.
Implementation Requirements: The Nitty-Gritty
Here's where the real work happens. Copilot needs to follow these requirements:
- Copilot Guidelines: Adhere to all guidelines specified in
copilot-instructions.md. - Minimal Changes: Make only the necessary changes to implement the feature, avoiding unnecessary modifications to other parts of the code.
- Testing: Write tests for the new feature to ensure it works as expected. This includes both unit and integration tests.
- Test Compatibility: Make sure all existing tests still pass. This ensures that the new feature doesn't break existing functionality.
- Documentation: Add documentation (inline doc comments) to explain the code and how it works.
These requirements ensure a high-quality, well-tested implementation.
After Implementation: The Final Steps
Once the feature is implemented, there are a few critical steps:
- Feature Removal: CRITICAL: The implemented feature must be completely removed from
features.md. Not just commented out, but entirely deleted. This includes the title, description, benefits, and implementation notes. This ensures the features list stays up-to-date. - README.md Update: If the feature is user-facing, add a brief mention in
README.mdunder a "Recent Features" or "Features" section. - PR Description Update: Update the PR description with implementation details, including any challenges or interesting aspects of the implementation.
- Example Usage: Include example usage in the PR description so users can quickly understand how to use the new feature.
These final steps ensure the code is clean, well-documented, and easy to understand.
Success Criteria: How to Know You've Succeeded
The feature implementation is considered complete when the following criteria are met:
- [ ] Feature selected and documented in PR
- [ ] Code compiles without errors:
cargo build --verbose - [ ] All tests pass:
cargo test --verbose - [ ] Code formatted:
cargo fmt - [ ] Code linted:
cargo clippy --all-targets --all-features -- -D warnings -A deprecated(must pass without errors) - [ ] Feature tested manually with example run
- [ ] Documentation added (doc comments for public APIs)
- [ ] Feature completely removed from
features.md(not commented out, not marked as implemented - DELETED) - [ ] If user-facing: Feature mentioned in
README.md - [ ] No regressions in existing functionality
Meeting these criteria ensures a successful and well-integrated feature implementation.
Build and Test Commands: Your Toolkit
Here are the commands you'll use throughout the process:
# Build
cargo build --verbose
# Test
cargo test --verbose
# Format
cargo fmt
# Lint (REQUIRED - must pass before completing development)
cargo clippy --all-targets --all-features -- -D warnings -A deprecated
# Run simulation with feature
./target/debug/simulation-framework -s 100 -p 10 -o /tmp/test.json
These commands are essential for building, testing, formatting, and linting your code. Make sure you use them regularly to keep your code in top shape.
Feature Selection Guidelines: Making the Right Choice
Here's how to prioritize your feature selection:
Prioritize in this order:
- High Priority (Quick Wins) from features.md: These are the features you should tackle first.
- Logging-System implementieren
- Erweiterte Tests schreiben
- Dokumentation vervollständigen
- CLI mit Progress Bar verbessern
- YAML/TOML Konfiguration
- Simple features that add value without complexity: Features that provide value without overcomplicating things.
- Single-field additions to existing structs
- New configuration options
- Analysis/statistics features
- Documentation improvements
- Avoid Initially: Features to avoid at the beginning.
- Features requiring new external dependencies
- Major architectural changes (Plugin-System, Event-System)
- Features requiring complex algorithms
- Features with unclear specifications
Following these guidelines will help you choose the right features to implement and keep the development process efficient.
Implementation Workflow: The Step-by-Step Process
This workflow outlines the steps to take when implementing a feature:
- Explore & Plan (use
report_progressto share your plan)- Read features.md and select ONE feature
- Review existing code architecture
- Create an implementation checklist
- Core Implementation
- Add data structures (if needed)
- Implement core logic
- Integrate with existing code
- Add configuration (if needed)
- Testing
- Write unit tests
- Write integration tests
- Run all tests
- Test manually
- Quality & Documentation
- Run
cargo fmt - Run
cargo clippy --all-targets --all-features -- -D warnings -A deprecated(must pass) - Add doc comments
- Update README.md (if user-facing)
- COMPLETELY REMOVE feature from features.md (delete the entire section, do NOT comment out or mark as "IMPLEMENTED")
- Run
- Validation & Review
- Build release:
cargo build --release - Final manual test
- Request code review using
code_reviewtool - After addressing code review feedback:
- Re-run
cargo fmt --all - Re-run
cargo clippy --all-targets --all-features -- -D warnings -A deprecated - Re-run
cargo build --verbose - Re-run
cargo test --verbose
- Re-run
- Run security checks using
codeql_checkertool
- Build release:
This workflow ensures a systematic and thorough approach to feature implementation.
Code Review Requirements: Quality Assurance
CRITICAL: After addressing ANY code review feedback, you MUST re-run the complete validation suite:
# 1. Format code
cargo fmt --all
# 2. Lint code (must pass without errors)
cargo clippy --all-targets --all-features -- -D warnings -A deprecated
# 3. Build project
cargo build --verbose
# 4. Run all tests
cargo test --verbose
Even minor changes require full validation to prevent any regressions. This rigorous approach maintains code quality.
Copilot-Specific Instructions: Read Carefully!
Here are some special instructions for Copilot:
- Minimal Changes: Make the smallest possible changes to implement the feature.
- Existing Patterns: Study and follow existing code patterns.
- Testing: Add tests using
#[cfg(test)] mod tests { ... }pattern. Use fixed seeds for deterministic tests. - Configuration: Update
Argsstruct inmain.rsandSimulationConfiginconfig.rsif adding CLI args. - JSON Output: Add fields to
SimulationResultwith properserdeserialization if the feature produces output. - Progress Reporting: Use the
report_progresstool frequently. - Feature Removal: After successful implementation, COMPLETELY DELETE the feature section from
features.md. Do NOT comment it out or mark as "IMPLEMENTED". - README Update: If the feature is user-facing, add a brief note in README.md.
These instructions help Copilot understand and follow the project's guidelines.
Reference Documentation: Where to Find More Info
- Project Architecture: See
.github/copilot-instructions.md - Build/Test Commands: See
.github/copilot-instructions.md - Feature List: See
features.md(select ONE to implement) - Example Implementation: See
.github/ISSUE_TEMPLATE/EXAMPLE.md
This documentation provides all the information needed to understand and implement features.
Example Feature Selection: See It in Action
Here's a good example:
Selected Feature: 3.2 Reputation und Vertrauen
- Feature ID: 3.2
- Category: Soziale Netzwerke und Beziehungen
- Why: Simple field addition to Person struct, minimal changes required
- Implementation: Add `reputation: f64` field, update it based on successful trades
And here's an example of what to avoid:
Selected Feature: 4.4 Geografische Komponente
- Why NOT: Requires major changes (Location struct, distance calculations, trade cost modifications)
- Better to start with simpler features first
These examples show the kind of features Copilot should choose and the ones to avoid.
---This is the end of the article, guys! I hope you found it helpful and that it gives you a solid understanding of how Copilot can help you automate feature implementation. Happy coding! Remember, the goal is to make the development process smoother and more efficient. Let me know if you have any questions!
Note: This template enables autonomous feature implementation by Copilot. No manual feature specification is required - Copilot will select and implement a feature from features.md automatically.