nextjs-app/ai-src/skills/repo-best-practices/SKILL.md
--- name: repo-best-practices description: Use when generating or reviewing code in this repo to match the codebase’s existing implementation habits: reuse-first, no duplication, config-driven content, selector helpers, typed configs, shared shells, and minimal custom patterns. --- # Repo Best Practices ## Use When - generating new code - editing existing code - reviewing whether generated code feels native to the repo - deciding whether to reuse, extract, or inline something ## Main Princip
npx skillsauth add Adrienenjalbert/flex-carrer-hub nextjs-app/ai-src/skills/repo-best-practicesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Prefer the codebase’s existing patterns over inventing new ones.
The repo favors:
Before 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.
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:
development
Use when finishing a code change, validating generated code, or deciding which repo checks must run before presenting work in this repo.
tools
Use when creating or editing Career Hub tool pages, calculator pages, tool metadata, tool registry entries, or tool-specific support sections in this repo.
data-ai
Use when editing public pages, metadata, canonical URLs, structured data, sitemaps, robots rules, or any SEO-sensitive behavior in this repo.
development
Use when refactoring existing code, moving files, normalizing structure, or improving architecture without changing user-visible behavior in this repo.