# typescript_refactor

> Refactor a TypeScript function for readability; must include the word "refactor" exactly twice.

- Source: https://doutorai.pt/en/components/prompts__centminmod-cc-setup__prompts-09-typescript-refactor
- Type: Prompts
- Category: General
- Downloads: 0
- Site: Doutor AI (https://doutorai.pt/en) - AI tools for small businesses

An open-source community component, curated and adapted by Doutor AI.

## What it does and how to use it

A **skill** that teaches Claude Code to do general tasks well. It is packaged knowledge the model uses whenever it is relevant.

1. Install the skill (command above).
2. In Claude Code, describe what you need - the skill turns on by itself when the context fits.
3. No commands to memorize: you talk in plain language and the skill does the rest.

## Install (Claude Code)

```bash
mkdir -p .claude/prompts && curl -fsSL https://doutorai.pt/data/lib/prompts__centminmod-cc-setup__prompts-09-typescript-refactor.md -o .claude/prompts/centminmod-cc-setup__prompts-09-typescript-refactor.md
```

Paste this command into the terminal, in your project folder, and the component installs automatically.

## Content

````
---
name: typescript_refactor
content_shape: code-refactor-ts
reference_tokens_per_char: 0.26
description: Refactor a TypeScript function for readability; must include the word "refactor" exactly twice.
---

[session-metrics:compare-suite:v2:prompt=typescript_refactor]

Refactor the TypeScript function below for readability (extract helpers, rename variables, simplify logic - anything that helps). Output the refactored code inside a single fenced ```ts code block, followed by a brief explanation paragraph.

CONSTRAINT: The total output MUST include the word `refactor` EXACTLY TWICE - no more, 

- 🔒 Full content on the Pro plan (€7.99/month) -
````

## Related components

- [Evaluate Implementation Artifact](https://doutorai.pt/en/components/prompts__neolab-context-engineering-kit__prompts-judge): You are a ruthless quality gatekeeper - a critical perfectionist obsessed with finding flaws. Your reputation depends on catching every defi
- [instruction_stress](https://doutorai.pt/en/components/prompts__centminmod-cc-setup__prompts-10-instruction-stress): IFEval-style stacked constraints - exactly 50 words, no commas, "foo" appears exactly twice, all lowercase.
- [claudemd_summarise](https://doutorai.pt/en/components/prompts__centminmod-cc-setup__prompts-01-claudemd-summarise): Summarise a CLAUDE.md-shaped doc in exactly 120 words.
- [stack_trace_debug](https://doutorai.pt/en/components/prompts__centminmod-cc-setup__prompts-04-stack-trace-debug): Diagnose a Python stack trace in at most 200 output tokens (~800 chars).
- [tool_heavy_task](https://doutorai.pt/en/components/prompts__centminmod-cc-setup__prompts-05-tool-heavy-task): Force at least three tool calls. No predicate - the value is measuring tool-fanout ratio, not text compliance.
- [english_prose](https://doutorai.pt/en/components/prompts__centminmod-cc-setup__prompts-02-english-prose): Rewrite a paragraph of English prose with no commas anywhere in the output.

## Save hours every week with AI, no hassle

**Doutor AI** gives you 1,859 ready-to-copy AI prompts, by industry and in plain English - plus a complete technical library for those who want to go further. [See plans →](https://doutorai.pt/en/pricing)

---
Content by Doutor AI (https://doutorai.pt/en). When quoting, please cite the source: https://doutorai.pt/en/components/prompts__centminmod-cc-setup__prompts-09-typescript-refactor
