Skip to content

Instantly share code, notes, and snippets.

@artalar
Created September 19, 2025 11:54
Show Gist options
  • Select an option

  • Save artalar/fe7e458c0ed942eddede6d14ac61efb0 to your computer and use it in GitHub Desktop.

Select an option

Save artalar/fe7e458c0ed942eddede6d14ac61efb0 to your computer and use it in GitHub Desktop.
Example of AI refactorign proper prompt

You need to find all files recursively in the project folder "js" with this pattern inside file code: "memo(_" (not regexp, strict comparison) and for each file run separate subtack with following instructions:


You need to refactor the component declaration and move the "memo" decorator to the original component, removing extra "_Component" variable. For components with TypeScript generics use import { memoGeneric } from '@/js/libs/memo';

Examples:

// FROM const _Table = (props: T) =>

; export const Table = memo(_Table) as typeof Table; // TO export const Table = memoGeneric(function Table(props: T) { return
});

// FROM const Field = () =>

; export const _Field = React.memo(Field); // TO export const Field = React.memo(function Field() { return
});

// FROM const Article: React.FC = () =>

; export const _Article = memo(Article); // TO export const Article = memo(function Article() { return
});

And so on.

Just do this one job, no any extra refactorings, no any other changes to the code. You need to preserve all other types, generics, arguments, comments, etc. Ignore type errors! If you not sure about the refactoring because of some corner cases, just skip it.

Task should be done quickly and efficient, so do not output any logs, comments, etc, just work with the code. After the end, reply just a single status "done" / "skipped" / "error".


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment