Ai staged-content-refinement
Consolidate and refine extracted skills and docs from multiple projects into unified, project-agnostic patterns. Use when staging folder has content from multiple projects ready for consolidation. Triggers on "refine staged content", "consolidate staged skills", "process staging", "merge extracted patterns".
git clone https://github.com/wpank/ai
T=$(mktemp -d) && git clone --depth=1 https://github.com/wpank/ai "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/refinement" ~/.claude/skills/wpank-ai-staged-content-refinement && rm -rf "$T"
skills/refinement/SKILL.mdStaged Content Refinement
Process extracted skills and docs from multiple projects into consolidated, project-agnostic patterns.
Installation
OpenClaw / Moltbot / Clawbot
npx clawhub@latest install refinement
Before Starting
-
Verify staging has content from multiple projects:
— Extracted skillsai/staging/skills/
— Extracted methodology docsai/staging/docs/
-
Load quality criteria:
../extraction/references/skill-quality-criteria.md
Refinement Process
Phase 1: Inventory
Scan all staged content and catalog what exists.
For skills:
ai/staging/skills/ ├── [project-a]-[category]/ ├── [project-b]-[category]/ └── ...
For docs:
ai/staging/docs/ ├── [project-a]-summary.md ├── [project-a]-design-system.md ├── [project-b]-summary.md └── ...
Create inventory:
| Source Project | Type | Content | Common Patterns? |
|---|---|---|---|
| project-a | skill | design-system | Yes - colors, typography |
| project-b | skill | design-system | Yes - similar token structure |
| project-a | doc | summary | Methodology insights |
Phase 2: Pattern Analysis
Identify patterns that appear across multiple projects.
Look for:
-
Design system patterns (highest priority)
- Common token structures
- Similar aesthetic approaches
- Shared color/typography patterns
-
Architecture patterns
- Similar folder structures
- Common component organization
- Shared data flow patterns
-
Workflow patterns
- Common Makefile targets
- Similar CI/CD approaches
- Shared dev setup patterns
-
Methodology insights
- Decision-making patterns
- Trade-offs that appear repeatedly
- Common anti-patterns discovered
Questions to answer:
- What patterns appear in 2+ projects?
- What's project-specific vs generalizable?
- What methodology insights can update the main docs?
Phase 2.5: Conflict Detection
Before consolidating, check for conflicts with existing skills.
Scan existing skills:
ls ai/skills/*/
For each staged skill, check:
| Check | How |
|---|---|
| Duplicate name | Does a skill with same name exist in ? |
| Similar purpose | Does description overlap with existing skill? |
| Overlapping triggers | Do "When to Use" triggers conflict? |
Conflict resolution:
| Conflict Type | Resolution |
|---|---|
| Exact duplicate | Skip staged skill, keep existing |
| Similar but better | Update existing skill with new insights |
| Similar but different | Keep both, clarify distinct purposes |
| No conflict | Proceed with promotion |
Run overlap check:
/check-overlaps
Document conflicts:
- Note which existing skills overlap
- Decide: merge into existing vs create new
- Update existing skills if merging
Phase 3: Consolidation
Merge similar patterns into unified, project-agnostic skills.
For each pattern group:
- Identify the core — What's common across all instances?
- Strip project specifics — Remove project names, specific values
- Generalize — Make it applicable to any project
- Enhance — Add insights learned from seeing multiple implementations
Example consolidation:
Staged: ├── project-a-design-system/ (retro-futuristic tokens) ├── project-b-design-system/ (video game UI tokens) └── project-c-design-system/ (minimal dark tokens) Consolidated: └── design-system-patterns/ (how to build distinctive design systems) - Token structure patterns - Aesthetic direction documentation - Common anti-patterns across projects
Consolidation rules:
| Scenario | Action |
|---|---|
| Same pattern, different values | Create pattern skill with examples |
| Same pattern, same approach | Merge into single skill |
| Unique pattern, high value | Keep as standalone skill |
| Unique pattern, low value | Archive or discard |
Phase 4: Methodology Updates
Extract insights to update the main methodology docs.
Review staged docs for:
- New patterns not in current methodology
- Refinements to existing approaches
- Anti-patterns discovered across projects
- Decision rationale worth capturing
Update locations:
| Insight Type | Update Location |
|---|---|
| Design philosophy | → Design & Visual Philosophy |
| Tech patterns | → Patterns to Extract |
| Workflow improvements | |
| Architecture patterns | |
Phase 5: Promotion
Move refined skills to active locations.
Skill promotion:
# From staging to active mv ai/staging/skills/[refined-skill]/ ai/skills/[refined-skill]/
Doc updates:
- Update main docs with methodology insights
- Archive or delete processed staging content
Post-promotion:
- Verify skills have proper descriptions
- Test skill activation with sample prompts
- Clean up staging folder
Phase 6: Testing
After promotion, verify skills work correctly.
Activation testing: For each promoted skill, test that it activates on expected triggers:
Test: "I need to [trigger from When to Use]" Expected: Skill should be suggested/activated
Quality verification:
- Description triggers correctly
- Code examples are valid and runnable
- NEVER Do section is actionable
- Related skills are linked correctly
Rollback if issues:
# If skill has problems, move back to staging mv ai/skills/[category]/[skill]/ ai/staging/skills/
Document test results:
- Note any activation issues
- Record false positives (activates when shouldn't)
- Record false negatives (doesn't activate when should)
Error Handling
| Issue | Resolution |
|---|---|
| Staging empty | Nothing to refine; run extraction first |
| No common patterns | Promote as individual skills if quality passes |
| Merge conflict | Document conflict, keep both versions temporarily |
| Quality check fails | Return to Phase 3 to improve skill |
| Activation test fails | Revise description keywords |
Output Locations
Refined skills go to:
ai/skills/ # Cursor-specific skills ai/skills/ # Claude Code skills (if applicable)
Methodology updates go to:
docs/ ├── METHODOLOGY.md # Philosophy and approach ├── TECH-STACK.md # Technology patterns ├── ARCHITECTURE.md # Skill/agent architecture └── WORKFLOW.md # Processes
Staging cleanup:
ai/staging/skills/ # Clear after processing ai/staging/docs/ # Clear after processing ai/archive/ # (optional) Keep for reference
Consolidation Examples
Design Systems
Before (3 project-specific skills):
— Retro-futuristic tokensproject-a-design-system
— Video game UI tokensproject-b-design-system
— Cyberpunk terminal tokensproject-c-design-system
After (1 consolidated skill):
— How to create design systems with personalitydistinctive-design-systems- Token structure patterns
- Aesthetic documentation approach
- Anti-patterns (generic bootstrap, "clean" without personality)
- Examples from different aesthetic directions
Architecture
Before (multiple docs):
project-a-architecture.mdproject-b-architecture.md
After:
- Update
with common patternsdocs/ARCHITECTURE.md - Create skill only if patterns are unique enough
NEVER Do
- NEVER keep project-specific details in consolidated skills
- NEVER create redundant skills — Merge similar patterns
- NEVER skip methodology updates — Insights should flow back to docs
- NEVER promote low-quality skills — Must pass quality criteria
- NEVER leave staging cluttered — Clean up after processing
Quality Check
Before finishing refinement:
- All staged content reviewed?
- Conflict detection completed (Phase 2.5)?
- Common patterns identified and consolidated?
- Consolidated skills are project-agnostic?
- Methodology docs updated with insights?
- Refined skills promoted to active locations?
- Activation testing completed (Phase 6)?
- Staging folder cleaned up?
Related Skills
- Agent:
— Autonomous refinement workflowai/agents/refinement/ - Command:
— Quick refinement command/refine-staged - Command:
— Single skill promotion/promote-skill - Previous step:
— Pattern extractionai/skills/extraction/ - Quality criteria:
../extraction/references/skill-quality-criteria.md