agentleFS
Hive-AcademyHive-Academy/ptah-extension/.claude/skills/extract-and-relocate-angular-component-feature/SKILL.md

extract-and-relocate-angular-component-feature

Skill29 starsChanged 2 months agoMITView on GitHub

Extract a UI feature (buttons, forms, state, methods) from one Angular component into a new self-contained component, then wire it into the destination component. Use when moving a feature between components in an Angular monorepo to eliminate duplication and improve encapsulation.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    All state signals (signal(), computed()) used only by this feature

    line 16
  2. Distinctive:

    All event handler methods scoped to the feature

    line 17
  3. Distinctive:

    Import the extracted component

    line 23
  4. Very specific:

    Add it to the imports array

    line 24
  5. Distinctive:

    All state and methods tied solely to the feature

    line 32
  6. Distinctive:

    Keep read-only guards or banners that affect the input flow

    line 33
  7. Distinctive:

    Shared dependencies: If the feature's state is used elsewhere in the source, leave it there.

    line 37

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Steps

  1. Identify source and destination components — Locate the component currently rendering the feature and where it needs to move. Review both templates and identify the feature block (template markup + related state + event handlers).
  2. Clarify scope and context — If the destination renders only in certain contexts (e.g., grid mode vs. detail panel), ask whether the feature should follow the destination's visibility or render in both. This prevents silent regressions.
  3. Create a new self-contained component — In the same library, create a new component file with:
    • Descriptive kebab-case name (e.g., send-message.component.ts)
    • @Input() properties for required data (e.g., tabId, sessionId)
    • @Output() event emitters for parent-state changes (instead of injecting parent services)
    • All state signals (signal(), computed()) used only by this feature
    • All event handler methods scoped to the feature
    • Template markup copied from the source
  4. Export from the library barrel — Add the new component to the library's index.ts so it's importable by other libraries.
  5. Wire into the destination component — In the destination:
    • Import the extracted component
    • Add it to the imports array
    • Render it in the template at the intended location
    • Bind required inputs using bracket notation
    • Subscribe to outputs if the feature emits state changes
  6. Clean the source component — Remove:
    • The feature's template block (HTML)
    • Imports specific only to that feature
    • All state and methods tied solely to the feature
    • Keep read-only guards or banners that affect the input flow

Gotchas

  • Shared dependencies: If the feature's state is used elsewhere in the source, leave it there; extract only isolated features.
  • Portability via outputs: Emit parent-state changes via @Output() rather than injecting the parent service — keeps the component reusable.
  • Barrel exports are critical: Omit the barrel export and consumers won't find the component.
  • Context changes cause regressions: Silent visibility changes (feature hidden in one mode but rendered in another) are easy to miss—always clarify.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.