| name | sourcebase-reuse-first |
| description | Use when about to create any new backend file — module, controller, service, DTO, entity, migration, or test — in an existing project. Symptoms — reaching for a new abstraction, naming a new DTO, about to write a helper, unsure where a file belongs, tempted to add a library. |
| metadata | {"stack":"sourcebase, nestjs"} |
Sourcebase Reuse First
Use this skill before adding or changing backend code in an existing project.
Exploration Order
- Read
CLAUDE.md and project docs if present.
- Check whether a source-map tool is already configured:
.codegraph/ exists: use .claude/tools/codegraph.md.
.understand-anything/ exists: use .claude/tools/understand-anything.md.
- Neither exists: use normal file and text search and report that no source-map setup is present.
- Inspect
package.json scripts and dependencies.
- Find nearby modules with similar behavior.
- Inspect existing controller, service, DTO, entity, migration, and test patterns.
- Reuse naming, folder structure, exception shape, and response shape.
- Add a new pattern only when no existing pattern fits.
Search Targets
Use the fastest available project search. If a source-map tool exists, use it before broad manual search. Otherwise use normal file and text search.
Search for:
- Existing module folders under
src.
- Existing guards and decorators.
- Existing DTO naming and pagination DTOs.
- Existing exception filters and response interceptors.
- Existing repository or data access providers.
- Existing migration file names and locations.
- Existing Jest and Supertest patterns.
Reuse Rules
- Prefer established helpers over new abstractions.
- Keep edits close to the feature module.
- Do not rename or reshape unrelated files.
- Do not introduce a new library for behavior already covered by the project.
- Keep command names and scripts aligned with
package.json.
Source-Map Sync
After code changes, sync the source-map tool when it is configured:
- CodeGraph: run
codegraph sync when available, or codegraph init if sync is not supported.
- Understand-Anything: run
/understand to refresh the knowledge graph.
If no source-map tool is configured, skip this step and note that normal file search was used.
Checklist