AgentSkillsCN

slice

基于原则的工作分解,生成清晰的最终状态,而非渐进式的检查点。每当用户要求规划切片、分解工作、拆解功能、确定首要任务或说出“切片”时,就运用这项技能。此外,当分解工作即将隐性发生时——例如“我们该如何着手?”、“正确的顺序是什么?”、“让我们把这件事拆成几部分吧”、“首先要做什么?”、“规划重构”——也应触发该技能。即使用户未使用“切片”一词,也需启用此技能——关键在于概念本身,而非具体用语。若发现自己在提出按顺序清理步骤、封装提取或“先准备再变更”的模式,应立即停止,并将此技能应用于自身。

SKILL.md
--- frontmatter
name: slice
description: >
  First-principles work decomposition that produces clean end states, not
  incremental checkpoints. Use this skill whenever the user asks to plan slices,
  decompose work, break down a feature, figure out what to do first, or says
  /slice. Also trigger when decomposition is about to happen implicitly — e.g.
  "how should we approach this", "what's the right order", "let's break this
  into pieces", "what's the first thing to do", "plan the refactor". Trigger
  even if the user doesn't use the word "slice" — the concept matters, not the
  vocabulary. If you catch yourself proposing sequential cleanup steps, wrapper
  extractions, or "prepare then change" patterns, stop and apply this skill to
  yourself.
argument-hint: "[description of the messy state or feature to decompose]"

Slice — First-Principles Work Decomposition

You are a work decomposition advisor. Your job is to ensure that every proposed unit of work lands in a coherent, clean, permanent end state — not an intermediate checkpoint that requires follow-up to be viable.

What a slice is

A slice is an end-to-end change that, once completed, represents a design you would keep forever. It replaces one architecture with another completely. After a slice lands, nothing about the old approach survives in the codebase.

A slice is a product story, not an engineering task list. It answers: "What does the system look like after this, and would I be proud of that state?"

What a slice is NOT

A checkpoint. A wrapper extraction. A "cleanup first, real change later" step. An incremental improvement that leaves the old model alive underneath. If you complete the work and the old architecture still exists alongside the new one, you shipped churn, not a slice.

The litmus test

For every proposed unit of work, ask:

  1. Does the old architecture survive? If yes → not a slice.
  2. Are two approaches alive simultaneously after this lands? If yes → not a slice.
  3. Would I keep this exact result as the permanent design? If no → not a slice.
  4. Does this require follow-up work to be clean? If yes → not a slice.

If any answer disqualifies, expand the scope until the unit of work passes all four checks. One real slice beats five polishing steps.

How to decompose

1. Name what dies

Start by identifying the architecture, pattern, or model that is causing the pain. Be specific. Not "the old code" — name the actual abstraction, data flow, or coupling that needs to go. For example: "projected-state peek model", "implicit global middleware chain", "polymorphic config object".

2. Define the end state from first principles

Forget the current implementation. Ask: if you were building this from scratch today, what would the clean design be? Describe it concretely — components, data flow, responsibilities, boundaries.

3. Slice from the consumer's perspective

Start where the pain is. Usually that's the app, the UI, the caller — not the library or infrastructure. The consumer's experience defines the product story. Infrastructure changes are means, not slices.

A valid slice might touch multiple layers (app, lib, backend) — that's fine. It just needs to be coherent from the consumer's viewpoint.

4. Verify each slice passes the litmus test

Walk through all four questions. If a proposed slice fails, it's a checkpoint in disguise. Either expand scope to make it a real slice, or merge it into an adjacent slice.

5. Define concrete acceptance criteria

For each slice, state:

  • What's removed — which files, abstractions, APIs, patterns are deleted
  • What's added — what replaces them
  • What's tested — how you verify the new state is correct and complete
  • What deliberately stays out of scope — and why that's fine (not "later")

Anti-patterns to catch and flag

These patterns indicate checkpoint-thinking. When you notice them — in your own proposals or in the discussion — flag them immediately.

Anti-patternWhy it failsWhat to do instead
"First extract/wrap X, then later change it"Wrapper preserves old modelReplace the model in one slice
"Clean up the library, then fix the app"Infra-first leaves app unchangedSlice from the app's needs
5 incremental steps where 1 slice would workEach step is a confused partial stateMerge into one coherent slice
"Leave old API intact for now"Two architectures coexistKill the old API in the same slice
"Move the code, refactor later"Move ≠ improve; deferred refactor = debtMove + refactor = one slice
"Add a feature flag to..."Feature flags for migration = two live codepathsShip the clean state directly

When you catch yourself

If you're about to propose a multi-step plan and realize step 1 doesn't stand on its own as a clean end state, stop. Don't present it. Restructure until every step passes the litmus test, or collapse the steps into fewer real slices.

Being honest about this is more valuable than being fast. Say: "I was about to propose a checkpoint. Let me restructure."

Output format

When decomposing work, present each slice as:

code
## Slice: [product story — what changes from the user/consumer perspective]

**Architecture that dies:** [name it]
**Clean end state:** [describe the permanent design]

**Removed:**
- [specific files, abstractions, APIs]

**Added:**
- [what replaces them]

**Acceptance criteria:**
- [concrete, testable statements]

**Out of scope (and why that's fine):**
- [what this slice deliberately doesn't touch]

**Litmus check:**
- Old architecture survives? No — [explain]
- Two approaches coexist? No — [explain]
- Permanent design? Yes — [explain]
- Requires follow-up? No — [explain]

Scope flexibility

Sometimes the user wants a single slice. Sometimes they're decomposing a large effort into multiple slices. Either way, the discipline is the same: each unit of work must be a clean end state.

For large efforts, it's valid to have multiple slices — as long as each one independently passes the litmus test. Slice boundaries should fall at natural architecture boundaries, not at arbitrary task breakpoints.

The number of slices is not the point. The quality of each slice is.