From a46d5f8dd4a9e5a821c7c7f54ef5d2e5999e445d Mon Sep 17 00:00:00 2001 From: idolevitt Date: Sun, 21 Jun 2026 19:21:14 +0800 Subject: [PATCH] docs(claude): add path-scoped frontmatter to four agent rules (#29612) Adds `paths:` YAML frontmatter so each rule only loads into Claude Code context when the agent is working on relevant files, keeping context lean in a large monorepo. - architecture-page-level-auth: fires on page.tsx and layout.tsx - data-prisma-migrations: fires on packages/prisma/** - testing-playwright: fires on playwright dirs, *.e2e.ts, and api e2e dirs - api-thin-controllers: fires on *.controller.ts files only Co-authored-by: Claude Sonnet 4.6 --- agents/rules/api-thin-controllers.md | 2 ++ agents/rules/architecture-page-level-auth.md | 3 +++ agents/rules/data-prisma-migrations.md | 2 ++ agents/rules/testing-playwright.md | 5 +++++ 4 files changed, 12 insertions(+) diff --git a/agents/rules/api-thin-controllers.md b/agents/rules/api-thin-controllers.md index 61a804b545..737304c0b9 100644 --- a/agents/rules/api-thin-controllers.md +++ b/agents/rules/api-thin-controllers.md @@ -1,4 +1,6 @@ --- +paths: + - "apps/api/**/*.controller.ts" title: Keep Controllers Thin - HTTP Concerns Only impact: HIGH impactDescription: Enables technology-agnostic business logic diff --git a/agents/rules/architecture-page-level-auth.md b/agents/rules/architecture-page-level-auth.md index 7055d37116..bdc3335c99 100644 --- a/agents/rules/architecture-page-level-auth.md +++ b/agents/rules/architecture-page-level-auth.md @@ -1,4 +1,7 @@ --- +paths: + - "apps/**/page.tsx" + - "apps/**/layout.tsx" title: Page-Level Authorization Checks in Next.js impact: CRITICAL impactDescription: Prevents unauthorized access to sensitive data diff --git a/agents/rules/data-prisma-migrations.md b/agents/rules/data-prisma-migrations.md index ea86e86f90..e6af79feb7 100644 --- a/agents/rules/data-prisma-migrations.md +++ b/agents/rules/data-prisma-migrations.md @@ -1,4 +1,6 @@ --- +paths: + - "packages/prisma/**" title: Prisma Schema and Migrations impact: HIGH impactDescription: Schema changes affect all downstream code and deployments diff --git a/agents/rules/testing-playwright.md b/agents/rules/testing-playwright.md index 400fccde15..ecd4e90d6c 100644 --- a/agents/rules/testing-playwright.md +++ b/agents/rules/testing-playwright.md @@ -1,4 +1,9 @@ --- +paths: + - "apps/web/playwright/**" + - "packages/embeds/**/playwright/**" + - "apps/**/*.e2e.ts" + - "apps/api/**/e2e/**" title: Playwright E2E Testing impact: HIGH impactDescription: E2E tests catch integration issues before production