This skill reviews the current chat session and GitHub Copilot instructions to identify user-reported issues that should become new lessons, detect violations of existing instructions, and update...
This skill performs meta-analysis on the current conversation and project instructions to continuously improve code and process quality and adherence to established patterns.
This skill helps maintain and improve the quality of AI-assisted development by:
Use this skill when:
Objective: Review the current chat session to identify learning opportunities.
Scan the conversation history for:
For each correction, determine:
Classify lessons by domain and type:
Objective: Verify compliance with existing standards and constitutions.
Read all relevant constitution and standards documents:
AGENTS.md - Agent architecture, behavior patterns, and operational guidelinesSDD files (Software Design Documents) - System design principles and requirements.github/constitution.md, docs/constitution.md).copilot-instructions.md or similar instruction filesDocument Discovery Strategy:
AGENTS.md in project root and docs folders*SDD.md, *design*.md, requirements.md).github/, docs/, or root directoryReview actions and outputs from the session against constitutions:
Compare user corrections with existing constitutions:
Objective: Formalize lessons learned into actionable constitutions.
Update Strategy:
For each identified gap or violation:
Structure:
## [Category]: [Specific Rule]
**Context**: [When does this apply?]
**Rule**: [What should be done?]
**Rationale**: [Why is this important?]
**Example** (if helpful):
```code
// Bad
[anti-pattern]
// Good
[correct pattern]
Related Instructions: [Link to related rules]
#### 3.2 Update Existing Constitutions
**In-Place Update Process**:
For violations of existing constitution rules:
- Clarify ambiguous language
- Add concrete examples relevant to the domain
- Strengthen weak guidelines (e.g., "should" → "must")
- Add cross-references to related rules
- Add "Common Mistakes" or "Anti-Patterns" sections
**Skill-Based Updates** (if available):
1. **Check for update skills**: Search for skills related to the constitution document
- `openspec-constitution-guard` for OpenSpec constitutions
- `agents-constitution-updater` for AGENTS.md
- Document-specific updater skills
2. **Invoke update skill**: If found, call the skill with:
- The lesson learned
- The violation context
- Proposed update text
- Rationale for the change
3. **Fallback to direct update**: If no skill exists, update the file directly
#### 3.3 Create New Constitution Entries
For lessons that don't fit existing documents, create or update appropriate constitution files:
**Location Options**:
- `.github/constitution.md` - General project principles
- `AGENTS.md` - Agent-specific behaviors and patterns
- `docs/constitution.md` - Domain-specific guidelines
- Skill-specific constitutions in `skills/[skill-name]/constitution.md`
**Format**:
```markdown
# Project Constitution
This document captures project-specific principles and lessons learned.
## [Principle Name]
**Date Added**: YYYY-MM-DD
**Origin**: [What situation led to this principle?]
**Principle**: [Clear statement of the rule]
**Application**: [How to apply this in practice]
**Examples**: [Concrete examples]
Objective: Ensure updates are effective and non-disruptive.
Provide a summary:
## Retrospect Summary
### Lessons Learned
1. [Lesson 1]: [What was learned and why]
2. [Lesson 2]: [What was learned and why]
### Instructions Updated
- **File**: [filename]
- **Section**: [section name]
- **Change**: [what was changed]
- **Reason**: [why it was changed]
### New Violations Detected
1. [Violation 1]: [Description and location]
2. [Violation 2]: [Description and location]
### Recommendations
- [Action item 1]
- [Action item 2]
The retrospect process should produce:
Retrospect Report (printed to console):
Updated Constitution Files:
AGENTS.md with updated agent behaviors and principlesconstitution.md files with clarifications and new rulesAction Items:
Constitutions
User Correction: "Don't skip the validation step - always validate inputs before processing"
Analysis:
Constitution Update (AGENTS.md):
### Input Validation Protocol
**Context**: All agent operations that accept external inputs
**Rule**: Input validation MUST occur before any processing or state changes.
**Rationale**: Prevents cascading errors and ensures data integrity throughout the system.
**Process**:
1. Receive input
2. Validate structure and constraints
3. Transform to internal representation
4. Process validated data
**Anti-Pattern**: Processing data before validation
**Related**: See "Error Handling Standards" and "State Management"
User Correction: "This agent shouldn't be making decisions about deployment - that's the DevOps agent's responsibility"
Analysis:
Constitution Update (AGENTS.md):
### Agent Responsibility Boundaries
**Context**: Multi-agent system with defined roles
**Rule**: Each agent MUST operate only within its defined domain. Cross-domain decisions require delegation to the appropriate agent.
**[AgentName] Responsibilities**:
- [Primary responsibility 1]
- [Primary responsibility 2]
**NOT Responsible For**:
- Deployment decisions → DevOps Agent
- Security policies → Security Agent
- Resource allocation → Resource Manager Agent
**Delegation Protocol**: When encountering a task outside your domain:
1. Identify the appropriate agent
2. Format the delegation request
3. Hand off with full context
4. Wait for response or acknowledgment
**Rationale**: Maintains clear separation of concerns and prevents conflicting decisions.
AGENTS.mdspec/ or docs/.github/constitution.md, docs/constitution.mdskills/openspec-constitution-guard/, skills/*/constitution.mdThis skill itself should evolve:
The meta-goal is to make AI-assisted development increasingly accurate and aligned with project standards over time.