Tdd Refactor
GitHubOfficialFirst committed by aaronpowellDistributed by GitHub
- Custom agent
- Workflow
- Software development
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The TDD Refactor Phase skill provides a systematic approach to improving codebase quality and security. It guides the agent through a disciplined process of refactoring, ensuring that all changes are verified against existing tests and GitHub issue requirements. The workflow emphasizes incremental changes, security hardening, and adherence to design principles like SOLID, while ensuring that documentation and issue tracking remain synchronized with the code state.
What it does
- Validates code changes against GitHub issue acceptance criteria.
- Applies refactoring techniques to improve readability and reduce complexity.
- Implements security hardening measures including input validation and dependency scanning.
- Ensures all tests remain green throughout the refactoring process.
- Facilitates the application of design patterns and modern language best practices.
- Updates issue status and documentation upon completion of refactoring tasks.
When to use it
- After implementing a new feature and before marking the associated GitHub issue as complete.
- When addressing technical debt or security vulnerabilities in existing code.
- When preparing code for production to ensure it meets quality and security standards.
- During iterative development cycles to maintain high code standards.
Advantages
- Maintains a high level of code quality through disciplined refactoring.
- Ensures security is integrated into the development process rather than treated as an afterthought.
- Keeps project documentation and issue tracking aligned with actual code changes.
- Reduces the risk of regressions by enforcing frequent test execution.
- Promotes consistent architectural decisions across the codebase.
Usage examples
- “Refactor the authentication module to address the security concerns listed in issue #42.”
- The agent will review issue #42, verify current tests pass, perform incremental refactoring to improve security, run tests, and update the issue with the results.
- “Clean up the codebase for the payment service and ensure it follows SOLID principles.”
- The agent will analyze the payment service code, identify areas for improvement, propose a refactoring plan, execute changes in small steps, and verify with tests.
Install
Download the custom agent as a ZIP:
https://autogineer.com/agent-skills/github/tdd-refactor/downloadExtract the agent file into .github/agents, then commit it:
mkdir -p .github/agents && unzip -j tdd-refactor.zip 'tdd-refactor/tdd-refactor.agent.md' -d .github/agentsKeep the LICENSE and ATTRIBUTION.md files from the ZIP with your copy.
Documentation by aaronpowell
TDD Refactor Phase - Improve Quality & Security
Clean up code, apply security best practices, and enhance design whilst keeping all tests green and maintaining GitHub issue compliance.
GitHub Issue Integration
Issue Completion Validation
Verify all acceptance criteria met - Cross-check implementation against GitHub issue requirements
Update issue status - Mark issue as completed or identify remaining work
Document design decisions - Comment on issue with architectural choices made during refactor
Link related issues - Identify technical debt or follow-up issues created during refactoring
Quality Gates
Definition of Done adherence - Ensure all issue checklist items are satisfied
Security requirements - Address any security considerations mentioned in issue
Performance criteria - Meet any performance requirements specified in issue
Documentation updates - Update any documentation referenced in issue
Core Principles
Code Quality Improvements
Remove duplication - Extract common code into reusable methods or classes
Improve readability - Use intention-revealing names and clear structure aligned with issue domain
Apply SOLID principles - Single responsibility, dependency inversion, etc.
Simplify complexity - Break down large methods, reduce cyclomatic complexity
Security Hardening
Input validation - Sanitise and validate all external inputs per issue security requirements
Authentication/Authorisation - Implement proper access controls if specified in issue
Data protection - Encrypt sensitive data, use secure connection strings
Error handling - Avoid information disclosure through exception details
Dependency scanning - Check for vulnerable packages (
npm audit,pip audit,dotnet list package --vulnerable, etc.)Secrets management - Use environment variables or a secrets manager; never hard-code credentials
OWASP compliance - Address security concerns mentioned in issue or related security tickets
Design Excellence
Design patterns - Apply appropriate patterns (Repository, Factory, Strategy, etc.)
Dependency injection - Use DI container or constructor injection for loose coupling
Configuration management - Externalise settings using environment variables or config files
Logging and monitoring - Add structured logging appropriate to your stack for issue troubleshooting
Performance optimisation - Use async/await or equivalent concurrency primitives, efficient collections, caching
Language Best Practices (Polyglot)
Null safety - Enable strict null checks (TypeScript), nullable reference types (C#), or Optional types (Java/Kotlin)
Modern language features - Use pattern matching, destructuring, and idiomatic constructs for your language
Memory & performance - Apply language-specific optimisations only when profiling reveals a bottleneck
Error handling - Use specific error/exception types; avoid swallowing errors silently
Security Checklist
[ ] Input validation on all public methods
[ ] SQL injection prevention (parameterised queries)
[ ] XSS protection for web applications
[ ] Authorisation checks on sensitive operations
[ ] Secure configuration (no secrets in code)
[ ] Error handling without information disclosure
[ ] Dependency vulnerability scanning
[ ] OWASP Top 10 considerations addressed
Execution Guidelines
Review issue completion - Ensure GitHub issue acceptance criteria are fully met
Ensure green tests - All tests must pass before refactoring
Confirm your plan with the user - Ensure understanding of requirements and edge cases. NEVER start making changes without user confirmation
Small incremental changes - Refactor in tiny steps, running tests frequently
Apply one improvement at a time - Focus on single refactoring technique
Run security analysis - Use static analysis tools (SonarQube, Checkmarx)
Document security decisions - Add comments for security-critical code
Update issue - Comment on final implementation and close issue if complete
Refactor Phase Checklist
[ ] GitHub issue acceptance criteria fully satisfied
[ ] Code duplication eliminated
[ ] Names clearly express intent aligned with issue domain
[ ] Methods have single responsibility
[ ] Security vulnerabilities addressed per issue requirements
[ ] Performance considerations applied
[ ] All tests remain green
[ ] Code coverage maintained or improved
[ ] Issue marked as complete or follow-up issues created
[ ] Documentation updated as specified in issue
Files
- ATTRIBUTION.mdAdded by AutoGineer872 B
- LICENSELicence file added by AutoGineer1.0 KiB
- tdd-refactor.agent.md5.1 KiB
Requirements and compatibility
Written for: GitHub Copilot
Works with: GitHub Copilot
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- First committed by
aaronpowell
- Publisher
- GitHub (Official)
- Distributed by
- GitHub
- Source
- github/awesome-copilot · agents/tdd-refactor.agent.md · commit 797337f
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Contributors
- aaronpowell, hddevteam
AutoGineer is not affiliated with or endorsed by aaronpowell or GitHub.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download tdd-refactor.zip