Skip to content
Back to skills

Extract Function

ASecurity

Extracts a code block into a named function with proper types and tests

  • 10 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 1, 2026
ai-agentstypescript

Security analysis

A100/100

Scanned June 1, 2026

npx -y skills add berkcangumusisik/claude-code-practices --skill extract-function --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Extract Function?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Extract Function
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/berkcangumusisik-extract-function/badge)](https://www.skillsdirectory.com/skills/berkcangumusisik-extract-function)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: extract-function
description: Extracts a code block into a named function with proper types and tests
argument-hint: <file-path> <line-start>-<line-end>
user-invocable: true
allowed-tools: Read Edit
effort: low
---

## Extract Function

File: **$1**
Lines: **$2**

1. Read the file, locate the specified lines.

2. Analyze the block:
   - What are the inputs? (variables read from outer scope)
   - What are the outputs? (values written to or returned)
   - What is the single responsibility of this block?

3. Propose a function name that describes what it does (verb phrase).

4. Show the extracted function with:
   - Proper TypeScript/language types
   - JSDoc if the file uses JSDoc
   - The call site replacement

5. Ask for confirmation, then:
   - Add the new function (above the calling function, or in a utils file if appropriate)
   - Replace the original block with the function call

6. Note if this function would be useful elsewhere in the codebase.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…