mayurpise/draft/decompose

Claude Code and agent skill by mayurpise/draft

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Decompose project or track into modules with dependency mapping. Project scope updates architecture.md and derives .ai-context.md. Track scope generates hld.md (always) and lld.md (when --lld or High-complexity module triggers it) — design-mandated artifacts that drive implement, deploy-checklist, and upload sign-off.

Install

npx vskill@latest install mayurpise/draft/decompose

SKILL.md

The same SKILL.md was published earlier as mayurpise/draft/decompose.

Decompose

You are decomposing a project or track into modules with clear responsibilities, dependencies, and implementation order.

MANDATORY GRAPH LOOKUP (read before any analysis)

First resolve the bundled helpers:

bash
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
# is not exported into skill Bash). See core/shared/tool-resolver.md.
DRAFT_TOOLS="${DRAFT_PLUGIN_ROOT:-$(cat ~/.cache/draft/plugin-root 2>/dev/null)}/scripts/tools"
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"

When draft/graph/schema.yaml exists, this skill must follow the graph-first lookup contract in core/shared/graph-query.md §Mandatory Lookup Contract. Module identification (Step 3) and dependency mapping (Step 4) start from the graph:

  1. Query "$DRAFT_TOOLS/graph-arch.sh" --repo . for the authoritative module list and fan-in/out.
  2. Run "$DRAFT_TOOLS/hotspot-rank.sh" --repo . to identify candidate modules to split.
  3. Use "$DRAFT_TOOLS/graph-callers.sh"/"$DRAFT_TOOLS/graph-impact.sh" on demand for symbols/callers inside a candidate module.
  4. Run "$DRAFT_TOOLS/cycle-detect.sh" --repo . to enumerate existing cycles before proposing new boundaries.

Filesystem grep/find for module discovery is only permitted after a documented graph miss, using the fallback sentence Graph returned no match for <X>; falling back to grep. and recorded in the Graph Usage Report.

Red Flags - STOP if you're

See shared red flags — applies to all code-touching skills. In particular, the Ground-Truth Red Flags are load-bearing for decompose: HLD/LLD are design-mandated artifacts and TBD citations on Modified modules fail review.

Template contract: HLD/LLD/Plan emissions conform to core/shared/template-contract.md and core/shared/template-hygiene.md. The _TBD_<field>_ sentinel convention replaces Author1 / xxx@example.com / [name] placeholders. After decompose runs, the verification gate chain in core/shared/verification-gates.md must pass clean on the regenerated set. Plan.md must back-link to ./discovery.md Phase 0 (Hotspots row IDs) per core/shared/discovery-schema.md.

Skill-specific:

  • Defining modules without understanding the codebase
  • Creating modules with circular dependencies
  • Making modules too large (>3 files, excluding test files) or too small (single function)
  • Skipping dependency analysis
  • Not waiting for developer approval at checkpoints
  • Emitting Citation: TBD for a module marked Status: Modified or Status: Existing (see §Step 5 Mandatory Citation Gate below)
  • Leaving HLD §Checklist sections (Performance / Scale / Security / Resiliency / Multi-tenancy / Upgrade / Cost) as raw - placeholders instead of structured TBD bullets (see §Step 5a Checklist Scaffolding)

Standard File Metadata

ALL generated files MUST include the standard YAML frontmatter. This enables refresh tracking, sync verification, and traceability.

Gathering Git Information

Use the deterministic git-metadata.sh script (preferred) or the manual commands — both documented in core/shared/git-report-metadata.md, which contains the canonical resolver pattern for locating the script in any install layout. Both produce the same field set used in the YAML template below.

For track-scoped decomposition, also derive the human-readable track title used in the hld.md / lld.md H1:

  • {TRACK_TITLE} — first-level heading text from the active track's spec.md (the # ... line). If spec.md has no H1, fall back to the {TRACK_ID}.

Also extract from spec.md frontmatter:

  • classification.criticality, classification.data_classification, classification.deployment_surface — copy verbatim into hld.md frontmatter.
  • approvers.* — pre-fill the HLD Approvals table (tech_leads, arb_leads, cloudops_leads, qa_leads, pm_leads) and LLD Approvals table (team_leads, tech_leads, qa). If a field is empty in spec.md, leave the table cell empty — do not invent names.
Metadata Template

Insert this stable YAML frontmatter at the top of every generated file. Git state lives in tracks/<track_id>/metadata.json — never in per-file frontmatter (WS-8).

yaml
---
project: "{PROJECT_NAME}"
module: "{MODULE_NAME or 'root'}"
track_id: "{TRACK_ID or null}"
generated_by: "draft:decompose"
generated_at: "{ISO_TIMESTAMP}"
# Stable frontmatter only (WS-8). Ephemeral fields live in metadata.json
# and render via <!-- META:<key> --> directives.
links:
spec: "./spec.md"
---
Note: generated_by uses draft:command format (not /draft:command) for cross-platform compatibility.
After writing HLD/LLD, update tracks/<track_id>/metadata.json with current git state and synced_to_commit.

Step 1: Determine Scope

Parse $ARGUMENTS for flags first, then strip them before interpreting the remaining text as scope:

  • --lld → LLD mode — generate Section 6 (Low-Level Design) in addition to HLD. Strip from arguments before scope detection.

Scope detection (on stripped arguments):

  • project or no argument with no active track → Project-wide decomposition → draft/architecture.md + draft/.ai-context.md
  • Track ID or active track exists → Track-scoped decomposition → draft/tracks/<id>/hld.md (always) + draft/tracks/<id>/lld.md (when triggered)

LLD auto-trigger: Even without --lld, LLD is generated automatically when any module in Step 3 is marked Complexity: High. Tell the developer when this triggers: "One or more modules are High complexity — generating LLD automatically."

No legacy `track-architecture.md`: That artifact has been retired. New tracks always use hld.md (and lld.md when triggered). Existing tracks that have a track-architecture.md are not migrated automatically — leave them alone; new tracks get the new format.

Pre-Generation Sanity Checks (Track-Scoped Only)

Before Step 2, run these checks and prompt the developer when triggered. Do not silently proceed.

  1. Spec readiness — read draft/tracks/<id>/spec.md frontmatter and first 20 lines:
  • If spec.md is missing → ERROR: "No spec.md for track <id>. Run /draft:new-track first." Halt.
  • If spec.md contains Status: [ ] Drafting or spec-draft.md still exists → WARN: "Spec for <id> is still in draft. HLD generated against a draft spec will need rework. Continue anyway? [y/N]" — default No.
  • If classification.criticality is unset or still placeholder ({...}) → WARN: "Classification not set in spec.md frontmatter — HLD Approvals gate (/draft:upload) will not engage correctly for high-criticality tracks. Continue? [y/N]".
  1. Existing artifacts — check what already exists:
  • If hld.md exists → ASK: "hld.md already exists for <id>. (1) Overwrite, (2) Skip HLD and only generate LLD, (3) Cancel." Default (3).
  • If lld.md exists and LLD will be regenerated → ASK same 3-way choice.

Only proceed to Step 2 after the developer resolves each prompt.

Step 2: Load Context

  1. Read draft/product.md for product understanding
  2. Read draft/tech-stack.md for technical patterns
  3. If track-scoped:
  • Read track's spec.md for requirements
  • Read track's plan.md for existing task breakdown

For brownfield projects, scan the existing codebase using these concrete steps:

Codebase Scanning Patterns

Directory structure — Map top-level organization:

bash
ls -d src/*/ lib/*/ app/*/ packages/*/ 2>/dev/null

Entry points — Find main files and exports:

  • Look for: index.ts, main.ts, app.ts, mod.rs, __init__.py, main.go
  • Check package.json main/exports fields, pyproject.toml entry points, go.mod module path

Existing module boundaries — Identify by:

  • Directory-per-feature patterns (e.g., src/auth/, src/users/)
  • Package files (package.json in subdirs, __init__.py, go package declarations)
  • Barrel exports (index.ts re-exporting from a directory)

Dependency patterns — Trace imports:

  • Search for import / require / from statements across source files
  • Identify which directories import from which other directories
  • Flag cross-cutting imports (e.g., utils/ imported everywhere)

File type filters by language:

LanguageSource ExtensionsConfig Files
TypeScript/JS*.ts, *.tsx, *.js, *.jsxtsconfig.json, package.json
Python*.pypyproject.toml, setup.py, requirements.txt
Go*.gogo.mod, go.sum
Rust*.rsCargo.toml

What to ignore: node_modules/, __pycache__/, target/, dist/, build/, .git/, vendored dependencies. Always respect .gitignore and .claudeignore.

Graph-Accelerated Discovery (MANDATORY when draft/graph/ exists)

When graph data is available, the graph is the primary (not optional) source for module discovery — manual scanning above is reserved for the graph-miss fallback path:

  • Module boundaries: Query "$DRAFT_TOOLS/graph-arch.sh" --repo . — module list with node counts and per-language file counts
  • Dependency edges: Weighted inter-module dependencies with exact include counts — replaces manual import tracing
  • Cycle detection: Circular dependency paths already computed — use for identifying tight coupling and decomposition candidates
  • Hotspots: Run "$DRAFT_TOOLS/hotspot-rank.sh" --repo . — high-complexity files that may need further decomposition
  • Per-module detail: query "$DRAFT_TOOLS/graph-callers.sh"/"$DRAFT_TOOLS/graph-impact.sh" for symbol/call detail within modules of interest

This data is deterministic and exhaustive. The manual scanning recipes above only run after the graph misses on the concept the user named — and the miss must be reported in the Graph Usage Report footer. See core/shared/graph-query.md §Concept-to-Files Recipe.

Step 3: Module Identification

Propose a module breakdown through dialogue:

For each module, define:

  • Name - Short, descriptive identifier
  • Responsibility - One sentence: what this module owns
  • Files - Expected source files (existing or to be created)
  • API Surface - Public functions, classes, or interfaces
  • Dependencies - Which other modules it imports from
  • Complexity - Low / Medium / High
Module Guidelines (see core/agents/architect.md)
  1. Each module should have a single responsibility
  2. Target 1-3 files per module
  3. Every module needs a clear API boundary
  4. Minimal Coupling — communicate through interfaces, not internals
  • Modules should be testable in isolation
  • Each module typically contains: API, control flow, execution state, functions
CHECKPOINT (MANDATORY)

STOP. Present the module breakdown to the developer.

yaml
---
MODULE BREAKDOWN
---
Scope: [Project / Track: <track-id>]
MODULE 1: [name]
Responsibility: [one sentence]
Files: [file list]
API: [public interface summary]
Dependencies: [none / module names]
Complexity: [Low/Medium/High]
MODULE 2: [name]
...
---

Wait for developer approval. Developer may add, remove, rename, or reorganize modules.

Step 4: Dependency Mapping

After modules are approved:

This is the start of the file. Read the full SKILL.md on GitHub.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
39
Repository forks
5
7-day trend score
18

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/mayurpise/draft/decompose/badge)](https://verified-skill.com/skills/mayurpise/draft/decompose)

Something wrong with this skill or its page? Tell us.