with one click
repo-best-practices
// Code-generation skill. Use when generating or reviewing repo code so it matches the codebase’s reuse-first, minimal-diff, config-driven implementation habits.
// Code-generation skill. Use when generating or reviewing repo code so it matches the codebase’s reuse-first, minimal-diff, config-driven implementation habits.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | repo-best-practices |
| description | Code-generation skill. Use when generating or reviewing repo code so it matches the codebase’s reuse-first, minimal-diff, config-driven implementation habits. |
| metadata | {"family":"code","owner":"engineering","last_reviewed":"2026-04-30T00:00:00.000Z","version":"1.0.0"} |
This is a code-generation skill. Use it only when the task ends in shipped repo code.
Prefer the codebase’s existing patterns over inventing new ones.
The repo favors:
logic.ts or helper files for pure business rulesBefore writing a new component, helper, or layout:
src/features/career-hub/sharedsrc/components/commonsrc/components/uiDo not create a new abstraction until you confirm an existing one does not fit.
Prefer feature-local constants/config files when values are reused or structural.
Current repo patterns:
src/features/career-hub/shared/header/config.tsxsrc/features/unemployment-benefits/constants.tssrc/features/career-hub/shared/content/hiring-calendar/*When repeated values appear, move them into:
constants.tsconfig.tsdata.tsinside the owning feature.
Prefer registry/helper access over repeated inline lookup logic.
Current examples:
src/features/tools/shared/data/tool-registry/*getToolBySluggetRoleBySluggetCityBySlugMap-backed selectorsPreferred pattern:
getXBySlugMaps for canonical slug lookup when the dataset is reused heavilyAvoid:
.find(...) across many files for the same domain objectIf logic derives links, stats, or filtered lists and is used by a page family, move it into a helper/service file.
Current examples:
src/features/how-to-become/services.tssrc/features/career-hub/shared/navigation/internal-link-hub/helpers.tsAvoid embedding large filtering/sorting/link-construction blocks directly inside JSX if they can be reused or tested as helpers.
For calculator math, business rules, and other pure feature-owned transforms, default to a feature-local logic.ts file unless an existing helper/service file is already the better fit.
tests/unit can cover it directly.Prefer existing composition pieces:
ToolPageShellRolePageShellStandardPageLayoutContentPageShellIndustryPageShellSeasonalPageShellFAQSectionCTASectionInternalLinkHubPageContainerPageSectionIf a page needs these concepts, reuse them instead of rebuilding them.
Prefer typed config objects plus satisfies for structured page config.
Current repo pattern:
const config = {
slug: tool.slug,
name: tool.name,
description: tool.description,
canonical: "/career-hub/tools/pay-calculator",
applicationCategory: "FinanceApplication",
faqs: tool.faqTemplates,
} satisfies ToolPageConfig;
Use this when a page/shell expects a stable config contract.
cn from @/lib/utils.components/ui or common layout helpers before creating one-off wrapper patterns.Current examples:
src/lib/utils.tssrc/components/common/layout/PageLayout.tsxAvoid hand-merging classes with string concatenation when cn should be used.
Follow the current Next.js route signature used in the repo.
Current common pattern:
params: Promise<{ ... }>Do not mix old and new route parameter conventions arbitrarily inside the same codebase.
When mapping optional lookups:
null when lookup failsPattern already used in the repo:
const links: (LinkItem | null)[] = slugs.map((slug) => {
const tool = getToolBySlug(slug);
if (!tool) return null;
return { href: `/career-hub/tools/${tool.slug}`, label: tool.name };
});
return links.filter((item): item is LinkItem => item !== null);
primaryKeyword, secondaryKeywords, or faqTemplates, reuse them.Before finishing generated code, confirm: