Extract service
Skill hungv47/meta-skills/forsvn-dev/skills/product/extract-service
Extracts repeated operational mechanics (SDK, API, file-system, or network logic copy-pasted across handlers or actions) into a shared service layer — produces a stepwise migration plan, then applies it caller-by-caller with verification at each step. Use when the same "how" recurs across 2+ callers. Not for behavioral cleanup or dead code (use clean-code) or designing a system from scratch (use architect-system). For a quality review after migrating, see review-work.From its SKILL.md
npx -y skills add hungv47/meta-skills --skill extract-serviceAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 14 stars14 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
6.6 KB, ~1.4k tokens by cl100k_base, as published. Nobody here has run it
Extract Service — Service-Layer Extraction Orchestrator
Multi-agent. Lifts repeated operational mechanics (SDK / API / file-system / network logic copy-pasted across handlers) out of N callers into one shared service layer, then migrates caller-by-caller with verification — no observable behavior change.
Core Question: "Is this purely structural — same behavior, fewer copies of the same 'how'?"
Why, methodology, when NOT to extract:
references/playbook.md[PLAYBOOK].
When To Use
- Same operational mechanics (SDK setup, API calls, file-system access, network/retry logic, auth boilerplate) copy-pasted across 2+ handlers, actions, or route files.
- Bug had to be fixed in N places, or was fixed in some-but-not-all.
When NOT: 1 caller (G6); orchestration/domain logic not mechanics (G7); behavioral cleanup → clean-code; new system design → architect-system; no tests AND behavior must be preserved → write tests first; red baseline → BLOCKED (G8). Exits: references/anti-patterns.md [ANTI-PATTERN].
Critical Gates — Read First
Critic verifies all 8 before any change. G1-5 = clean-code's 5 Golden Rules (preserve behavior · small incremental steps · check existing conventions · verify after each caller · rollback awareness). G6-8 extract-service-specific:
- G6 Extraction threshold — <2 real callers →
NEEDS_CONTEXT. - G7 Two-layer purity — service holds only the shared how; orchestration + domain rules stay in callers.
- G8 Baseline-green — red tests/build →
BLOCKED.
Operator-approval gate (plan → apply): plan shown IN FULL; ask Apply this migration? [y/N]. No code edited until operator confirms. N/no response → plan-only DONE, stop. Not skipped under --fast. Full text + critic-FAIL recovery: references/procedures/critical-gates.md [PROCEDURE].
Before Starting
Per references/_shared/before-starting-check.md [PLAYBOOK]:
| Artifact | Source | Use |
|---|---|---|
.forsvn/index/manifest.json | (any) | Check prior run, staleness |
docs/forsvn/experience/technical.md | (any) | Prior conventions |
architecture/system-architecture.md | architect-system | Service-layer placement |
Mode + Pre-Dispatch + Dispatch
budget: standard — auto-downgrades to Single-Agent Fallback for ≤3-caller scopes; --fast forces single-agent (safety gates still fire). Per references/_shared/mode-resolver.md.
Session execution profile (single-vs-multi): inherit per references/_shared/execution-policy.md.
Pre-Dispatch (references/_shared/pre-dispatch-protocol.md [PROCEDURE]) — needed dimensions: target, caller count, mechanics that repeat, tech stack + test runner, conventions. Confirm ≥2 callers via grep (G6) before scan. Cold Start: ask which mechanics repeat + roughly how many callers. Write back to docs/forsvn/experience/technical.md.
Dispatch — 4 sub-agents (scanner → planner → migration → critic) across 3 layers + operator-approval gate. Roster + layers + protocol + routing + Single-Agent Fallback: references/procedures/dispatch-mechanics.md [PROCEDURE]. TS walkthrough: references/examples/extraction-walkthrough.md [EXAMPLE].
Artifact Contract
- Path:
docs/forsvn/artifacts/product-extract-service-<YYYY-MM-DD>-<slug>.md(flat v2; re-run same slug same day →.v[N]). - Lifecycle:
snapshot. - Frontmatter:
skill,version,date,status(DONE/DONE_WITH_CONCERNS/BLOCKED/NEEDS_CONTEXT),stack(=product),review_surface(=none —decision_state: not_required),lifecycle,produced_by,provenance. Schema:references/_shared/artifact-contract-template.md. - Two halves: Migration Plan (interface + caller order, pre-approval) + Applied Migration (per-caller results + critic verdict, post-apply). Plan-only ships just the first.
- Consumed by:
review-work,clean-artifacts, operator. Template:references/report-template.md[PROCEDURE].
Anti-Patterns
Re-read before any change that smells off: references/anti-patterns.md [ANTI-PATTERN] — extracting at 1 caller; service with if (caller === 'x'); batch-migrating; domain rules sliding into the service.
Durable Rules (protected)
<!-- SLOW_UPDATE_START --> <!-- No pinned rules yet. Populate via the slow-update workflow (see references/slow-update-fence.md). Each pinned rule must (a) be procedural not instance-specific, (b) be earned from a regression or critic-flagged failure, (c) cite the artifact / decision record that justified pinning. --> <!-- SLOW_UPDATE_END -->Completion Status
- DONE — plan approved, every caller migrated, behavior preserved (tests + build PASS), critic PASS. Also DONE when operator declined the approval gate and a plan-only artifact shipped.
- DONE_WITH_CONCERNS — applied but verification skipped (no test suite, uncovered callers, manual), or a subset migrated and rest flagged pending.
- BLOCKED — pre-existing test/build failure (G8); or critic FAIL with offending caller not cleanly revertible.
- NEEDS_CONTEXT — <2 callers (G6); or how/why-when split ambiguous.
Next Step
/review-work for a fresh-eyes review of migrated code. Re-run triggers: 3rd+ caller appears; interface needs a new param; prior run stopped with callers pending.
References
references/{playbook, service-layer-pattern, migration-checklist, anti-patterns, report-template}.mdreferences/procedures/{critical-gates, dispatch-mechanics}.mdreferences/examples/extraction-walkthrough.mdreferences/_shared/{pre-dispatch-protocol, before-starting-check, mode-resolver, manifest-spec, anti-sycophancy, artifact-contract-template}.md
What ships with it: 23 files
230.4 KB alongside SKILL.md, 3 of them executable
agents/
- critic-agent.md6.4 KB
- migration-agent.md6.0 KB
- planner-agent.md6.8 KB
- scanner-agent.md5.5 KB
references/
- anti-patterns.md5.2 KB
- examples/extraction-walkthrough.md7.2 KB
- migration-checklist.md3.9 KB
- playbook.md6.6 KB
- procedures/critical-gates.md2.4 KB
- procedures/dispatch-mechanics.md3.9 KB
- report-template.md4.4 KB
- service-layer-pattern.md8.4 KB
- _shared/anti-sycophancy.md6.5 KB
- _shared/artifact-contract-template.md28.8 KB
- _shared/before-starting-check.md9.8 KB
- _shared/execution-policy.md7.0 KB
- _shared/manifest-spec.md29.2 KB
- _shared/mode-resolver.md11.0 KB
- _shared/pre-dispatch-protocol.md20.2 KB
scripts/
- bootstrap-experience.tsruns3.6 KB
- lib/path-parser.tsruns11.6 KB
- manifest-sync.tsruns33.1 KB
- routing.yaml3.0 KB