/extract
Extract a function, component, or module from existing code into its own unit.
$ npx -y skills add rohitg00/awesome-claude-code-toolkit --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/extract
Context preview
What this command does when you run it.
Extract a function, component, or module from existing code into its own unit.
Command definition
extract.mdExtract a function, component, or module from existing code into its own unit.
Steps
1. Identify the code block to extract from the argument (file path and line range, or description). 2. Read the target file and analyze the selected code:
- Determine all variables used within the block that are defined outside it (parameters).
- Determine all variables modified within the block that are used after it (return values).
- Identify side effects (I/O, mutations, DOM manipulation).
3. Choose the extraction type:
- **Function**: Pure logic with clear inputs and outputs.
- **Component**: UI rendering with props interface (React, Vue, Svelte).
- **Module**: Related functions that form a cohesive unit.
- **Hook**: Stateful logic with lifecycle concerns (React hooks).
- **Class method**: Logic belonging to a specific class.
4. Create the extracted unit:
- Name it descriptively based on its purpose.
- Define a clear parameter interface (TypeScript types, Python type hints).
- Add a return type annotation.
5. Replace the original code with a call to the extracted unit. 6. Update imports in the original file and any files that need the new export. 7. Run tests to verify the refactoring preserves behavior.
Format
Extracted: <type> <name> from <source-file>
To: <destination-file>
Parameters: <param-list>
Returns: <return-type>
Lines replaced: <start>-<end>
Tests: <pass/fail>
Rules
- The extraction must be behavior-preserving; run tests before and after.
- Choose names that describe the purpose, not the implementation.
- Keep the extracted unit's parameter count under 5; use an options object if more.
- Maintain the same error handling behavior in the extracted code.
- Update all call sites if moving a function to a different module.
Read more
Extract a function, component, or module from existing code into its own unit.
Steps
1. Identify the code block to extract from the argument (file path and line range, or description). 2. Read the target file and analyze the selected code:
- Determine all variables used within the block that are defined outside it (parameters).
- Determine all variables modified within the block that are used after it (return values).
- Identify side effects (I/O, mutations, DOM manipulation).
3. Choose the extraction type:
- **Function**: Pure logic with clear inputs and outputs.
- **Component**: UI rendering with props interface (React, Vue, Svelte).
- **Module**: Related functions that form a cohesive unit.
- **Hook**: Stateful logic with lifecycle concerns (React hooks).
- **Class method**: Logic belonging to a specific class.
4. Create the extracted unit:
- Name it descriptively based on its purpose.
- Define a clear parameter interface (TypeScript types, Python type hints).
- Add a return type annotation.
5. Replace the original code with a call to the extracted unit. 6. Update imports in the original file and any files that need the new export. 7. Run tests to verify the refactoring preserves behavior.
Format
Extracted: <type> <name> from <source-file> To: <destination-file> Parameters: <param-list> Returns: <return-type> Lines replaced: <start>-<end> Tests: <pass/fail>
Rules
- The extraction must be behavior-preserving; run tests before and after.
- Choose names that describe the purpose, not the implementation.
- Keep the extracted unit's parameter count under 5; use an options object if more.
- Maintain the same error handling behavior in the extracted code.
- Update all call sites if moving a function to a different module.
The most comprehensive toolkit for Claude Code -- 135 agents, 35 curated skills (+400,000 via SkillKit), 42 commands, 176+ plugins, 20 hooks, 15 rules, 7 templates, 15 MCP configs, 26 companion apps, 53 ecosystem entries, and more.
Repo: rohitg00/awesome-claude-code-toolkit
Other commands on rohitg00-claude-code-toolkit.
- /adr
Write an Architecture Decision Record documenting a significant technical decision.
Open command - /design-review
Conduct a structured design review of a module, feature, or system component.
Open command - /diagram
Generate Mermaid diagrams from codebase analysis or description.
Open command - /migrate
Plan and execute a framework or library migration incrementally.
Open command - /plan
Create a structured implementation plan for the requested feature or change.
Open command - /refactor
Perform a systematic refactoring of the specified code area.
Open command

