src/main/resources/targets/claude/skills/core/lib/x-lib-decompose-task/SKILL.md
Decomposes an implementation plan into tasks. Primary mode: derives tasks from test scenarios (x-plan-tests output) using TDD structure (RED/GREEN/REFACTOR). Fallback mode: uses Layer Task Catalog (G1-G7) when no test plan exists.
npx skillsauth add edercnj/ia-dev-environment x-lib-decompose-taskInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Decomposes an implementation plan into granular tasks. When a test plan exists (from x-plan-tests), derives tasks from test scenarios using TDD structure (RED/GREEN/REFACTOR) with a per-task Parallel flag. Falls back to the Layer Task Catalog (G1-G7) when no test plan is available, where tasks are additionally assigned to parallelism groups. Each task is assigned a model tier (Junior/Mid/Senior) and context budget.
| Caller Skill | Phase | Context | |-------------|-------|---------| | x-implement-story | Phase 1C | After the Architect produces the plan, BEFORE implementation | | (standalone) | N/A | When breaking down a plan into implementable tasks |
| Input | Path | Required |
|-------|------|----------|
| Architect's plan | ai/epics/epic-XXXX/plans/plan-story-XXXX-YYYY.md | Yes |
| Story requirements | Story file | Yes |
| Test plan (from x-plan-tests) | ai/epics/epic-XXXX/plans/tests-story-XXXX-YYYY.md | No |
Before any decomposition work, verify whether a valid task breakdown already exists:
ai/epics/epic-XXXX/plans/tasks-story-XXXX-YYYY.md (extract epic ID XXXX and story sequence YYYY from the story ID)mtime(story file) vs mtime(tasks file)mtime(story) <= mtime(tasks)): Log "Reusing existing task breakdown from {date}" and RETURN the existing file without regeneration. No subagent invocation needed.mtime(story) > mtime(tasks)): Log "Regenerating stale task breakdown for {story-id}" and proceed to STEP 0.5"Generating task breakdown for {story-id}" and proceed to STEP 0.5Rationale: Task breakdowns are expensive to generate (2-5 min, significant token cost). When a session is resumed after interruption, the existing breakdown should be reused if the story has not changed. This saves tokens and ensures continuity.
Idempotency Summary:
| Aspect | Behavior |
|--------|----------|
| Check | Compare mtime(story) vs mtime(tasks) |
| Skip | Reuse existing breakdown when mtime(story) <= mtime(tasks) |
| Override | Regenerate when story is newer than existing breakdown |
Before decomposing, read the project's architecture and layer definitions:
knowledge/architecture/architecture-principles.md — layer structure, dependency direction, package organizationknowledge/layer-templates.md — complete layer catalog with package locations, code templates, and checklist per layerThese files define the available layers for YOUR project. The Layer Task Catalog below is derived from them.
Read these files:
ai/epics/epic-XXXX/plans/plan-story-XXXX-YYYY.md (Architect's plan)Template Reference (RULE-007):
Read template at .claude/templates/_TEMPLATE-TASK-BREAKDOWN.md for required output format.
"Template not found, using inline format" and use the inline format defined in STEP 2A (test-driven) or STEP 2B (layer-based) of this skill. Execution continues normally without interruption.Note: The template contains
{{PLACEHOLDER}}markers. These are NOT rendered by the engine — they are filled by the LLM at runtime based on the decomposition results.
Check if test plan exists at ai/epics/epic-XXXX/plans/tests-story-XXXX-YYYY.md:
File exists AND has structured TPP scenario markers (scenario IDs like UT-01:, AT-01:, IT-01: at start of line under a dedicated scenarios section):
File exists but NO structured TPP markers (may mention TPP/UT/AT in prose but lacks scenario ID lines):
File absent:
Used when a test plan with TPP markers is available at
ai/epics/epic-XXXX/plans/tests-story-XXXX-YYYY.md.
For each test scenario in the test plan (ordered by TPP level):
Each generated task MUST contain:
| Field | Required | Description | |-------|----------|-------------| | Test Scenario | M | Reference to UT-N, IT-N, or AT-N from test plan | | TPP Level | M | 1-7 from TPP ordering | | RED | M | What the test asserts (expected behavior) | | GREEN | M | Minimum implementation to make test pass | | REFACTOR | O | Refactoring opportunities after green | | Layer Components | M | Which layers/classes are touched | | Parallel | M | yes/no — can run concurrently with other tasks | | Depends On | M | List of prerequisite TASK-N references | | Tier | M | Junior/Mid/Senior based on complexity | | Budget | M | S/M/L context budget |
A task is parallelizable when ALL of:
| Scenario Type | Task Marker | Dependency Rule |
|--------------|-------------|-----------------|
| UT (Unit Test) | [UT] | Depends on earlier TPP-level tasks that create shared components |
| AT (Acceptance Test) | [AT] | Depends on ALL related UT tasks |
| IT (Integration Test) | [IT] | Depends on UT tasks for involved components |
When using test-driven mode, generate tasks in this format:
### TASK-N: [UT-X/AT-X] scenario-name
- **TPP Level:** N
- **Type:** UT | AT | IT
- **Tier:** Junior | Mid | Senior
- **Budget:** S | M | L
- **Parallel:** yes | no
- **Depends On:** TASK-N, TASK-M (or "none")
**RED:** [What the test asserts — expected behavior]
**GREEN:** [Minimum implementation steps]
- Layer: component to create/modify
- Layer: component to create/modify
**REFACTOR:** [Optional refactoring opportunities]
**Layer Components:**
- domain.model: EntityName
- domain.port: PortName
- adapter.outbound: RepositoryName
After generating all TDD tasks, proceed to STEP 5 (Generate Output).
Used when no test plan with TPP markers is available.
For each section in the Architect's plan, check which architectural layers are involved. Mark each layer as active or inactive.
Used when no test plan with TPP markers is available.
For each active layer, create ONE task using the fixed catalog below.
Used when no test plan with TPP markers is available.
For complex domain logic tasks, read the Architect's plan carefully:
Save to: ai/epics/epic-XXXX/plans/tasks-story-XXXX-YYYY.md (extract epic ID XXXX and story sequence YYYY from the story ID). Ensure directory exists: mkdir -p ai/epics/epic-XXXX/plans.
Output format selection:
When to use: Only when no test plan with TPP markers exists at
ai/epics/epic-XXXX/plans/tests-story-XXXX-YYYY.md. Prefer test-driven decomposition when test plan is available.
Derive the task catalog from the layer-templates knowledge pack (knowledge/layer-templates.md). Each section in the knowledge pack corresponds to one task type. The table below shows the generic structure — adapt layer names and packages to match YOUR project's architecture rules (knowledge/architecture/architecture-principles.md).
| Task Type | Architecture Layer | Tier | Budget | Group | | ----------------------------- | ----------------------- | ------ | ------ | ----- | | Database Migration | migration | Junior | S | G1 | | Domain Models | domain model | Junior | S | G1 | | Ports (Inbound Interfaces) | domain port inbound | Junior | S | G2 | | Ports (Outbound Interfaces) | domain port outbound | Junior | S | G2 | | DTOs (Request/Response) | inbound adapter dto | Junior | S | G2 | | Domain Engine/Rules (simple) | domain engine | Mid | M | G2 | | Domain Engine/Rules (complex) | domain engine | Senior | L | G2 | | Persistence Entity | outbound adapter entity | Junior | S | G3 | | Entity Mapper | outbound adapter mapper | Junior | S | G3 | | DTO Mapper (Inbound) | inbound adapter mapper | Junior | S | G3 | | Repository | outbound adapter repo | Mid | M | G3 | | Use Case (Application) | application | Mid | M | G4 | | REST Resource/Controller | inbound adapter rest | Mid | M | G5 | | Exception Mapper | inbound adapter rest | Mid | M | G5 | | Protocol Handler | inbound adapter protocol| Senior | L | G5 | | Configuration | config | Junior | S | G5 | | Observability (Spans/Metrics) | cross-cutting | Mid | M | G6 | | Unit Tests | test | Follows tested layer | G7 | | Integration Tests | test | Mid | M | G7 | | API Tests | test | Mid | M | G7 | | E2E Tests | test | Mid | M | G7 |
Note: The exact package names (e.g.,
domain.model,adapter.outbound.entity) are defined inknowledge/architecture/architecture-principles.md. Consult that file for your project's specific package structure.
When to use: Only when no test plan with TPP markers exists at
ai/epics/epic-XXXX/plans/tests-story-XXXX-YYYY.md. Prefer test-driven decomposition when test plan is available.
The dependency direction follows the architecture rule: adapter.inbound → application → domain ← adapter.outbound. Groups are derived from this dependency chain:
G1: FOUNDATION (Migration + Domain Models) — PARALLEL
G2: CONTRACTS (Ports + DTOs + Engine) — PARALLEL, depends on G1
G3: OUTBOUND ADAPTERS (Entity + Mapper + Repository) — PARALLEL, depends on G1, G2
G4: ORCHESTRATION (Use Case) — SEQUENTIAL, depends on G2, G3
G5: INBOUND ADAPTERS (Controllers + Protocol Handlers + Config) — PARALLEL, depends on G4
G6: OBSERVABILITY — SEQUENTIAL, depends on G4, G5
G7: TESTS — PARALLEL (max 4 concurrent), depends on ALL previous
Note: Group contents may vary by project architecture. The principle is: inner layers first, then outer layers. Verify against
knowledge/architecture/architecture-principles.mdfor your project.
| Size | Range | Includes | | ---- | ------------ | ----------------------------------------------------- | | S | 100-200 lines| Plan section + inline rules + 1 template | | M | 250-400 lines| Plan section + rules files + dependency outputs | | L | 500-800 lines| Story + plan + rules + dependency outputs + existing code |
Each engineer's model tier = highest task tier in their review domain:
| Engineer | Relevant Task Types | | ------------- | -------------------------------------- | | Security | Domain Engine, TCP Handler, Repository | | QA | All test tasks | | Performance | Domain Engine, TCP Handler, Repository | | Database | Migration, Entity, Repository | | Observability | Observability task | | DevOps | Config task | | API | DTOs, REST Resource |
Tech Lead tier = story max task tier (highest across ALL tasks).
When a task fails compilation after 2 retries at its assigned tier:
Target: < 15% of tasks escalate.
| Scenario | Action |
|----------|--------|
| Architect's plan not found | Abort with message: "Plan file not found at expected path. Run planning phase first." |
| Story requirements file not found | Abort with message: "Story file not found. Verify story ID and epic directory." |
| Template _TEMPLATE-TASK-BREAKDOWN.md missing | Log warning, use inline format as fallback (RULE-012 — Graceful template fallback) |
| Test plan has no structured TPP markers | Fall back to layer-based decomposition (G1-G7) with warning |
| Escalation threshold exceeded (>15% tasks escalate) | Flag in output report for manual review |
| Skill | Relationship | Context | |-------|-------------|---------| | x-implement-story | called-by | Invoked during Phase 1C | | x-plan-tests | reads | Consumes test plan (Phase 1B output) when available | | x-implement-story Phase 2 | produces-for | Output consumed by group-based or TDD-based implementation |
ai/epics/epic-XXXX/plans/tasks-story-XXXX-YYYY.md existence and staleness before regenerating. Second invocation with unchanged story reuses existing breakdown..claude/templates/_TEMPLATE-TASK-BREAKDOWN.md for standardized output formattesting
Scaffolds a Helidon SE/MP service with routing, health, config, Dockerfile, and tests.
tools
Generates a Picocli @Command with subcommands, options, converters, and unit tests.
testing
Scaffolds a Micronaut service with @Controller, DI, health, Dockerfile, and tests.
testing
Scaffolds a Helidon SE/MP service with routing, health, config, Dockerfile, and tests.