---
name: drop-module
description: Removes a federated admin module project from an admin-modules workspace — deletes projects/<name>/, removes its angular.json registration, and cleans up workspace-level references. Wraps the `ws-drop-module` bin.
when_to_use: Activates when removing a federated remote project from a workspace, when the user types `npx ws-drop-module <name>` or says "delete module <name>", "remove project <name>", "drop module".
allowed-tools:
  - Read
  - Edit
  - Write
  - Bash
---

Language: English only.

This skill is used to remove a federated admin module project from a workspace via `ws-drop-module`. The bin is the inverse of `ws-generate-module` — it deletes the project tree under `projects/<name>/`, unregisters from `angular.json`, and removes any workspace-level references.

## When this skill applies

- "remove the `<name>` module from this workspace"
- "delete project `<name>`"
- "drop the federated remote `<name>`"
- User runs `npx ws-drop-module <name>`
- After a generate-module mistake that needs a clean retry

## How it works

Entry point: `/Users/ph/projects/ws-admin-aux/admin-kit/bin/ws-drop-module.js`. Implementation: `/Users/ph/projects/ws-admin-aux/admin-kit/lib/drop-module.js`.

Steps the bin performs:

1. Validates `projects/<name>/` exists; aborts with an error if not.
2. Removes the project directory entirely (`rm -rf projects/<name>`).
3. Removes the project's entry from `angular.json#projects`.
4. Removes any sibling-path entry from `tsconfig.federation.json#paths` (if present).
5. Removes the symlink at `<workspace>/node_modules/<name>` (if it exists — usually it doesn't for workspace-local projects, but `ws-sync-paths` may have created one).

Usage:

```
npx ws-drop-module <name>
```

## Behavior contract (the agent MUST follow this when this skill is active)

- **Announce on load (MUST).** The first time this skill informs a response in a session, begin that response with the line `🧩 skill: drop-module` (combine as `🧩 skills: a, b` when several load together). Once per skill per session — it's a load marker, not a summary; do not repeat it on later turns.
- MUST verify the module name matches a real project under `projects/` before invoking (cheap typo guard).
- MUST warn the user when other modules in the workspace import from the one being dropped (grep for `from '<name>'` across other projects' `src/`) — proceeding will break those consumers.
- MUST also call [clean-workflow](../clean-workflow/SKILL.md) for the dropped module against the bonded fiddle if it was previously deployed, OR remind the user to do so — leaving the deployed artifact in the fiddle creates a phantom module that the host will still try to load and fail on.
- MUST NOT delete the project files manually before invoking the bin — the bin's unregistration steps depend on a complete project tree being present to look up references.

## Common pitfalls

- **Other modules still import from this one.** Drop the importing modules first, OR refactor the importers to not depend on it, OR keep this one alive. Dropping a depended-on module breaks the entire workspace's typecheck.
- **Stale deploy in the fiddle.** Dropping locally doesn't remove the deployed jar/ext entry. Run [clean-workflow](../clean-workflow/SKILL.md) explicitly OR use `ws-clean` to scrub deploy artifacts before drop.
- **Forgetting `tsconfig.federation.json`.** The bin handles it, but if a manual edit happened earlier the bin may leave stale entries. Verify after drop: `grep '<name>' tsconfig.federation.json` should return nothing.
- **`adminModules` in modules.json still lists the dropped module.** `ws-wire-setup-modules` will warn (or prompt to remove). Update the fiddle's modules.json separately.

## Out of scope

- This skill does NOT clean up the bonded fiddle's deployed artifacts — see [clean-workflow](../clean-workflow/SKILL.md).
- Does NOT remove the module from `<fiddle>/modules.json.adminModules`. The fiddle operator does that.
- Does NOT touch the module's git history if it lived as a separate repo (it doesn't normally — projects live inside their workspace's repo).

## Cross-links

- [generate-module/SKILL.md](../generate-module/SKILL.md) — inverse: scaffold a new module
- [clean-workflow/SKILL.md](../clean-workflow/SKILL.md) — scrub the deployed artifacts from the fiddle
- [wire-setup-modules/SKILL.md](../wire-setup-modules/SKILL.md) — updates needed in `modules.json.adminModules` after drop
