library-extraction-stabilisation
Skill4 starsChanged 10 months agoMITView on GitHub
Use when shared code is used by 3+ components, user asks about extracting library, or code is copied across services. Ensures stability, ownership, versioning, and governance before extraction.
In this repository67 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agents-onboardingSkill
- agent-workitem-automationSkill
- architecture-testingSkill
- aspire-integration-testingSkill
- automated-standards-enforcementSkill
- best-practice-introductionSkill
- branching-strategy-and-conventionsSkill
- broken-windowSkill
- change-risk-rollbackSkill
- ci-cd-conformanceSkill
- component-boundary-ownershipSkill
- contract-consistency-validationSkill
- csharp-best-practicesSkill
- deployment-provenanceSkill
- documentation-as-codeSkill
- documentation-scaffoldSkill
- dotnet-bespoke-code-minimisationSkill
- dotnet-best-practicesSkill
- dotnet-domain-primitivesSkill
- dotnet-efcore-practicesSkill
- dotnet-healthchecksSkill
- dotnet-logging-serilogSkill
- dotnet-mapping-standardSkill
- dotnet-open-source-first-governanceSkill
- dotnet-source-generation-firstSkill
- dotnet-specification-patternSkill
- dotnet-testing-assertionsSkill
- environment-traceabilitySkill
- finishing-a-development-branch-iddSkill
- greenfield-baselineSkill
- impacted-scope-enforcementSkill
- incremental-change-impactSkill
- incremental-deploymentSkill
- innersource-governance-bootstrapSkill
- issue-driven-deliverySkill
- local-dev-experienceSkill
- markdown-authorSkill
- modern-csharp-coding-standardsSkill
- monorepo-orchestration-setupSkill
- observability-logging-baselineSkill
- pair-programmingSkill
- persona-switchingSkill
- process-skill-routerSkill
- quality-gate-enforcementSkill
- release-tagging-planSkill
- repo-best-practices-bootstrapSkill
- repository-foundation-bootstrapSkill
- requirements-gatheringSkill
- runtime-tooling-validationSkill
- safe-brownfield-refactorSkill
- scoped-colocationSkill
- security-processesSkill
- selective-build-testSkill
- semantic-version-impactSkill
- session-awareSkill
- skills-first-workflowSkill
- static-analysis-securitySkill
- structured-review-workflowSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 33
If not ready: Document alternative and re-evaluation criteria
- Distinctive: line 71
Use this matrix to evaluate whether extraction is appropriate:
- Distinctive: line 160
If migration fails for any consumer:
- Distinctive: line 165
If repeated failures: consider consumer-specific fork or delay
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Library Extraction Stabilisation
Overview
Extract shared code into libraries only after proven stability and with clear ownership. Prevent premature abstraction, version chaos, and orphaned libraries.
REQUIRED: superpowers:brainstorming (before extraction decision)
When to Use
- Shared functionality used by 3+ components
- User asks "should I extract this as a library?"
- Code duplication across services/components
- User proposes creating shared package/library
- Existing internal library needs stabilization
Core Workflow
- Count consumers (need 3+ for extraction)
- Assess stability (change frequency over 3 months)
- Define ownership (team with capacity)
- Define versioning (SemVer, breaking change policy)
- Plan migration (incremental, rollback strategy)
- If not ready: Document alternative and re-evaluation criteria
Extraction Readiness Criteria
| Criterion | Threshold | Action if Not Met |
| Consumers | 3+ | Wait for 3rd consumer |
| Stability | <2 changes/month for 2 months | Defer until stable |
| Ownership | Team identified with capacity | Identify owner first |
| Support | SLA or best-effort defined | Define support model |
Red Flags - STOP
- "Already used in 2 places, should extract"
- "Keep changing in multiple places, must extract"
- "DRY principle requires extraction"
- "Library will force stability"
All mean: Apply readiness assessment before proceeding.
Rationalizations Table
| Excuse | Reality |
| "DRY says extract now" | DRY applies after proven need. 2 uses isn't proof. |
| "Easier to maintain in one place" | Only if stable. Volatile library causes upgrade fatigue. |
| "Library will force stability" | Backwards. Stability enables libraries. |
| "Tech lead said create library" | Clarify. Share stability/ownership concerns. |
| "Best practice is shared libraries" | Microservices tolerate duplication over coupling. |
Reference Documents
- Governance Models - Ownership and support models
- Versioning Strategy - SemVer, breaking changes
- Migration Planning - Consumer migration guide
Decision Matrix Template
Use this matrix to evaluate whether extraction is appropriate:
# Library Extraction Decision: [Component Name]
**Date**: YYYY-MM-DD
**Evaluator**: [Name]
## Readiness Assessment
| Criterion | Current State | Threshold | Pass? |
| -------------------------------- | -------------------------- | ---------- | ----- |
| Consumer count | [N] | ≥ 3 | ☐ |
| Change frequency (last 3 months) | [N/month] | < 2/month | ☐ |
| Defined owner | [Team/None] | Named team | ☐ |
| Support model | [SLA/Best-effort/None] | Defined | ☐ |
| API stability | [Stable/Evolving/Volatile] | Stable | ☐ |
| Test coverage | [N]% | ≥ 80% | ☐ |
## Consumer Analysis
| Consumer | Integration Type | Impact if Breaking Change |
| --------- | ----------------- | ------------------------- |
| Service A | Direct dependency | High - core functionality |
| Service B | Transitive | Medium - feature subset |
| Service C | Direct dependency | High - multiple endpoints |
## Risk Assessment
| Risk | Likelihood | Impact | Mitigation |
| --------------------------------- | ---------- | ------- | --------------------------------------- |
| Breaking change during extraction | [H/M/L] | [H/M/L] | Semantic versioning, deprecation period |
| Ownership vacuum | [H/M/L] | [H/M/L] | Assign team before extraction |
| Version sprawl | [H/M/L] | [H/M/L] | Enforce upgrade policy |
## Decision
☐ **Proceed with extraction** - All criteria met
☐ **Defer extraction** - Criteria not met, re-evaluate on [date]
☐ **Alternative approach** - [Describe: shared module, copy, etc.]
**Rationale**: [Brief explanation of decision]Migration Plan Checklist
Phase 1: Preparation (Week 1)
- Document current API surface
- Identify all consumers (direct and transitive)
- Establish version numbering scheme (SemVer)
- Create library repository with CI/CD
- Set up package publishing (NuGet, npm, PyPI, etc.)
- Document breaking change policy
- Assign ownership team with on-call rotation
Phase 2: Initial Release (Week 2)
- Extract code into library repository
- Ensure test coverage ≥ 80%
- Create API documentation
- Publish v1.0.0 (or appropriate version)
- Migrate first consumer (lowest risk)
- Verify functionality in staging environment
- Document migration steps for other consumers
Phase 3: Consumer Migration (Weeks 3-4)
- Notify all consumers of migration timeline
- Provide migration guide with examples
- Support each consumer during migration
- Track migration progress:
| Consumer | Status | Migration Date | Issues |
| Service A | ☐ Pending / ☐ In Progress / ☐ Complete | ||
| Service B | ☐ Pending / ☐ In Progress / ☐ Complete | ||
| Service C | ☐ Pending / ☐ In Progress / ☐ Complete |
Phase 4: Stabilisation (Week 5+)
- Remove original code from source locations
- Monitor library usage metrics
- Address any post-migration issues
- Establish regular release cadence
- Document lessons learned
Rollback Plan
If migration fails for any consumer:
- Consumer reverts to previous version (before library dependency)
- Library team investigates and patches
- Consumer re-attempts migration with patched version
- If repeated failures: consider consumer-specific fork or delay
Success Criteria
- All consumers successfully migrated
- No production incidents attributed to library
- Library version published and consumable
- Original code removed from source repositories
- Documentation complete and accessible
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

