# On Delete Cascade for Code

**URL:** <https://forum.cursor.com/t/on-delete-cascade-for-code/39499>\
**Category:** Feature Requests\
**Created:** [January 6, 2025, 7:30pm UTC](https://forum.cursor.com/t/on-delete-cascade-for-code/39499 "2025-01-06T19:30:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aldentharwood](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@aldentharwood](https://forum.cursor.com/u/aldentharwood)\
**Post date:** [January 6, 2025, 7:30pm UTC](https://forum.cursor.com/t/on-delete-cascade-for-code/39499/1 "2025-01-06T19:30:53Z")

</div>

I would love a feature that behaves like SQL table delete cascades but for code. So if I delete a function, a high-level API ingress declaration, etc. then Cursor could trace back and ask me if I want to delete all of the related code (or even models) that were used by that code exclusively and are now stranded and unused.

In relation to the above would be awesome to have a tool for finding unused code in general to clean it all up.

---

<div class="post-metadata">

**Author:** ![danperks](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/danperks/32/19087_2.png) [@danperks](https://forum.cursor.com/u/danperks)\
**Post date:** [January 9, 2025, 1:02pm UTC](https://forum.cursor.com/t/on-delete-cascade-for-code/39499/3 "2025-01-09T13:02:55Z")

</div>

Hey, really cool feature suggestion!

You can probably already do this using the Composer agent, first asking it to remove the function you want to be deleted, and then in a follow-up message asking it to look at your codebase to find any usage of that function and remove it.

You may have to point it in the right direction, especially with very large code bases, as the composer would be unable to look at every file one by one.

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/system/32/99069_2.png) [@system](https://forum.cursor.com/u/system)\
**Post date:** [June 18, 2026, 10:23am UTC](https://forum.cursor.com/t/on-delete-cascade-for-code/39499/4 "2026-06-18T10:23:53Z")

</div>


