payload-legal-trust
Skill0 starsChanged 14 days agoMITView on GitHub
Legal pages, a trust center, cookie consent, and a GDPR badge for Payload CMS 3 sites. Policy outlines only, vanilla-cookieconsent with Google Consent Mode v2, Global Privacy Control, and RTL. Use when adding privacy, terms, cookies, refunds, accessibility, a consent banner, subprocessors, or a compliance badge.
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agent-guardrailsSkill
- creative-frontendSkill
- figma-handoffSkill
- payload-admin-brandingSkill
- payload-auth-rbacSkill
- payload-bookings-paymentsSkill
- payload-bootstrapSkill
- payload-deploy-vercelSkill
- payload-forms-crmSkill
- payload-integrationsSkill
- payload-live-previewSkill
- payload-localizationSkill
- payload-mcpSkill
- payload-mediaSkill
- payload-performanceSkill
- payload-project-kickoffSkill
- payload-seo-geoSkill
- payload-testingSkill
- project-architectureSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
Add legal-pages as in references/policy-outlines.md.
- Very specific: line 19
Create unpublished drafts for the pages PROJECT.md needs, with title and slug only.
- Distinctive: line 37
Stop after the drafts exist until the text is in hand.
- Very specific: line 41
Use a trust-center global, not a block on site-settings.
- Very specific: line 58
When navigator.globalPrivacyControl === true, keep the three ad_* signals denied even if the visitor clicks accept all.
- Distinctive: line 61
Ask for banner sentences the same way as legal pages.
- Very specific: line 71
Add footer links to each published legal page and to /trust as entries on the footer global, which the editor controls.
- Very specific: line 77
Use the PROJECT.md cell form from the payload-testing skill, under the single line Locales: en, ar.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Payload legal and trust
Produces draft legal pages, a trust-center page, a cookie banner, and an optional badge. It does not produce legal text. The client or their lawyer supplies every sentence that states a right, a fee, a retention period, or a compliance claim.
Step 1: Legal pages
Add legal-pages as in references/policy-outlines.md.
Fields: localized title, localized summary (one line for /llms.txt), slug, localized rich text body, effectiveDate, lastUpdated, version. Slug stays shared across locales. Drafts use autosave and live preview with the /legal prefix from the payload-live-preview skill.
Create unpublished drafts for the pages PROJECT.md needs, with title and slug only. Required body, dates, and version are filled when the text arrives. Payload skips required-field checks on drafts.
| Slug | Page | Create it when |
privacy | Privacy policy | Always |
terms | Terms of service | Always |
cookies | Cookie policy | Always, once the banner exists |
refunds | Refund and cancellation | The site takes payment or bookings |
accessibility | Accessibility statement | The client wants one. Do not claim a WCAG level they did not name |
The route is src/app/(frontend)/[locale]/legal/[slug]/page.tsx. Follow the page shape in the payload-live-preview skill. Render a visible line with the effective date, the last updated date, and the version, using Intl.DateTimeFormat and labels from messages/en.json. Ask the client for the Arabic strings.
Wire revalidateOnPublish and revalidateOnDelete from the payload-performance skill. The targets function is in references/policy-outlines.md, and the map row is below.
Step 2: Policy outlines
references/policy-outlines.md lists the headings and the facts to collect. references/jurisdiction-checklists.md is a question list for counsel about Egypt, the GDPR, and the Gulf. Paste answers into PROJECT.md. Do not paste them into the page as if they were the policy.
Stop after the drafts exist until the text is in hand. An empty published policy is worse than no page.
Step 3: Trust center
Use a trust-center global, not a block on site-settings. Site-settings renders in the layout, so a subprocessors edit would regenerate every route. The trust page is one route.
Fields, seed list, and the page: references/trust-center.md. Route: src/app/(frontend)/[locale]/trust/page.tsx.
Prefill a row only for a provider PROJECT.md enables. Open the privacy or DPA link and keep it only when that page loads. Data location is the region in PROJECT.md (Vercel region, Turso region). Leave it blank and ask when the region was not chosen. Do not write a certification the project does not hold.
Step 4: Cookie consent
vanilla-cookieconsent 3.3.0. Client component src/components/ConsentBanner.tsx, mounted once in src/app/(frontend)/[locale]/layout.tsx. Categories: necessary (read-only), analytics, marketing. Copy and the Consent Mode wiring: references/consent.md.
Texts come from the consent-settings global, localized. That global renders in the layout, so its hook expires global_consent-settings with the justification comment in the reference.
language.rtlincludes every code inrtlLocales, so Arabic lays out right to left.revisionstarts at 1. Raising it shows the banner again.0disables that behavior in this library.- Set Google Consent Mode v2 defaults to denied in a
beforeInteractivescript in the locale layout, before any Google tag. The four signals aread_storage,ad_user_data,ad_personalization, andanalytics_storage. - On accept, change, or reject, call
gtag('consent', 'update', ...). - Load analytics and marketing scripts only after that update, and only for a granted category. This is the gate the
payload-performanceskill Step 8 expects. Basic mode: no tag request before a choice. - When
navigator.globalPrivacyControl === true, keep the threead_*signals denied even if the visitor clicks accept all. Also set the library'srespectGpc: true. - The footer includes a button with
data-cc="show-preferencesModal".
Ask for banner sentences the same way as legal pages. Do not ship placeholder consent copy.
Step 5: GDPR badge
Render the badge only when site-settings.gdprBadgeEnabled is true and gdprBadgeLabel is non-empty for that locale. The checkbox and the label are defined by the payload-seo-geo skill. Default is off.
The label is the client's sentence. Do not substitute "GDPR compliant", a seal, or a flag. An enabled checkbox with an empty label renders nothing.
Step 6: Footer
Add footer links to each published legal page and to /trust as entries on the footer global, which the editor controls. Do not query legal-pages inside the layout. A layout query tagged with the collection would regenerate every route on each policy publish.
The cookie-settings button and the badge sit in the footer component. The badge reads site-settings through getSiteSettings.
Invalidation map
Use the PROJECT.md cell form from the payload-testing skill, under the single line Locales: en, ar. /llms.txt is included because the payload-seo-geo skill lists published legal pages there. Add /llms-full.txt only when that route exists. The legal-pages fixture slug is trace-legal.
| Collection or global | Trigger | Paths | Tags | Writes per save |
| legal-pages | publish | /<locale>/legal/<slug>, /llms.txt | legal-pages:<slug>, legal-pages-sitemap | 1 x locales + 1 |
| trust-center | update | /<locale>/trust | pages-sitemap | 1 x locales |
| consent-settings | update | layout | global_consent-settings | all routes x locales, rare, accepted |
These cells are the PROJECT.md form from the payload-testing skill. layout means the global tag only.
The trust-center hook does not use a layout tag. The consent hook does not call revalidatePath with 'layout'. The comment in each hook names the reason.
Environment
NEXT_PUBLIC_GA_MEASUREMENT_ID=Optional. When it is empty, the analytics category grants nothing and loads no script. If PROJECT.md already names a measurement-id variable, use that name and do not add a second one. No secret belongs in this skill. The verification token and the badge live in the CMS.
Stop and ask
- Any policy sentence, retention period, fee, governing law, or complaint authority.
- Whether a refund page should exist.
- The WCAG level, if they want it stated at all.
- Banner title, descriptions, and button labels in each locale.
- Subprocessor data locations that
PROJECT.mddoes not already record. - Turning the GDPR badge on, and the sentence it should show.
- A request for advanced Consent Mode (Google tags load before a choice and send cookieless pings). That fails the network check below. Ship basic mode unless they accept that trade in writing.
Done when
- Before any consent click, the Network panel shows no request to
googletagmanager.com,google-analytics.com, orgoogleadservices.com dataLayercontainsconsent/defaultwith all four signalsdeniedbefore the click, andconsent/updateafter a choice- With Global Privacy Control on, accept-all still leaves
ad_storage,ad_user_data, andad_personalizationdenied - The footer button reopens preferences
- On
/ar/..., the banner layout is RTL /en/legal/privacyand/ar/legal/privacyrender the matching locale, and the effective date, updated date, and version are visible- Raising
consent-settings.revisionshows the banner again in a browser that had already chosen - A published legal page's log line lists
/<locale>/legal/<slug>and/llms.txtonly, plus the legal sitemap tag
Diagnosis
| Symptom | Cause | Fix |
| Analytics request on first paint | Tag or GoogleAnalytics mounted in the layout | Consent reference: load it after update |
| Banner stays LTR in Arabic | language.rtl omits ar | Consent reference |
| Preferences button does nothing | Banner script not mounted, or the attribute is wrong | data-cc="show-preferencesModal" |
| Badge visible on a new site | Checkbox defaulted on, or the label is hardcoded | Step 5 |
| Preview of a policy 404s | Prefix map | payload-live-preview, prefix /legal |
| Saving the banner text does not refresh pages | Hook missing the global tag | Consent reference |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

