remove-cdn-purge
Skill316 starsChanged 5 months agoMITView on GitHub
Uninstalls the optional CDN purge integration (Azure Front Door example provider, CDN cache widget, /api/cdn-purge route) while keeping the core cache revalidation feature intact. Triggers: remove CDN purge, remove Front Door, uninstall CDN, drop cdn-purge, remove Azure Front Door integration, disable CDN cache widget.
- Reads credentials
- Deletes or force-pushes
In this repository25 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/skills/vercel-react-best-practices/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- add-content-typeSkill
- add-localeSkill
- add-ui-componentSkill
- consolidate-patternsSkill
- copy-componentSkill
- create-content-componentSkill
- find-componentSkill
- find-skillsSkill
- frontend-designSkill
- make-prSkill
- next-best-practicesSkill
- remove-azure-monitorSkill
- remove-cache-revalidationSkill
- remove-sentrySkill
- resolve-review-suggestionsSkill
- review-prSkill
- seed-contentSkill
- start-workSkill
- strapi-schema-checkSkill
- validate-branch-refsSkill
- vercel-react-best-practicesSkill
- write-testsSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 0 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 6
Remove the optional CDN purge integration from the project.
- Very specific: line 31
Remove the import import { purgeCDNCache } from "../services/cdn-cache".
- Very specific: line 32
Remove the entire purgeCdn(ctx) method (the second handler in the default export object).
- Very specific: line 33
Remove the purgeCdnBodySchema const at the bottom of the file (only used by purgeCdn).
- Very specific: line 34
Keep the run(ctx) method, revalidateBodySchema, nonEmptyStringArray, and the validateAdminToken import.
- Very specific: line 46
Remove the app.widgets.register({ ...
- Very specific: line 47
Remove the import { Cloud } from "@strapi/icons" line (only used by that widget).
- Very specific: line 48
Keep the DataRevalidate edit-view injection (that belongs to core revalidation).
- Very specific: line 75
All typechecks/tests/build must pass.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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
Remove the optional CDN purge integration from the project. This is the operator-driven CDN cache eviction layer (the bundled Azure Front Door example provider, the Strapi "CDN cache" homepage widget, and the /api/cdn-purge route). It sits on top of the core cache revalidation feature.
Scope
- This removes ONLY the CDN purge layer. The core cache revalidation (Strapi → Next.js
revalidatePath/revalidateTagon publish) keeps working. - To remove the entire revalidation feature instead, use the
remove-cache-revalidationskill (which also removes this CDN layer). STRAPI_REVALIDATE_SECRET,CLIENT_URL,apps/ui/src/lib/cache-paths.ts,apps/ui/src/lib/verify-bearer-token.ts(shared with the revalidate endpoint), and theapps/strapi/src/api/revalidateservice/controller/routes belong to core revalidation — do NOT remove them here.
Steps
1. Delete CDN-only files
rm -rf apps/ui/src/lib/cdn
rm -rf apps/ui/src/app/api/cdn-purge
rm -f apps/strapi/src/api/revalidate/services/cdn-cache.ts
rm -rf apps/strapi/src/admin/widgets/CdnCacheWidget
rm -f apps/strapi/tests/cdn-cache.test.ts
rm -f apps/docs/docs/reference/integrations/cdn.md2. Strip the CDN purge action from the Strapi revalidate controller
Edit apps/strapi/src/api/revalidate/controllers/revalidate.ts:
- Remove the import
import { purgeCDNCache } from "../services/cdn-cache". - Remove the entire
purgeCdn(ctx)method (the second handler in the default export object). - Remove the
purgeCdnBodySchemaconst at the bottom of the file (only used bypurgeCdn). - Keep the
run(ctx)method,revalidateBodySchema,nonEmptyStringArray, and thevalidateAdminTokenimport.
3. Remove the CDN purge route
Edit apps/strapi/src/api/revalidate/routes/revalidate.ts: delete the route object whose path is "/revalidate/cdn-purge" (handler revalidate.purgeCdn). Keep the "/revalidate" route.
Then edit apps/strapi/src/api/revalidate/services/helpers.ts: remove the now-orphaned readCdnPurgeConfig export (only cdn-cache.ts used it). Keep readClientCallConfig and readRevalidationConfig; if STRAPI_CDN_PURGE_SECRET is no longer referenced, drop it from the SecretEnvVar union too.
4. Unregister the CDN cache widget
Edit apps/strapi/src/admin/app.tsx:
- Remove the
app.widgets.register({ ... id: "cdn-cache" ... })block inbootstrap. - Remove the
import { Cloud } from "@strapi/icons"line (only used by that widget). - Keep the
DataRevalidateedit-view injection (that belongs to core revalidation).
5. Remove the optional CDN env vars
apps/ui/src/env.mjs: remove these keys from BOTH theserverschema and theruntimeEnvmap:STRAPI_CDN_PURGE_SECRET,AZURE_SUBSCRIPTION_ID,AZURE_RESOURCE_GROUP,AZURE_FRONT_DOOR_PROFILE,AZURE_MI_CLIENT_ID,IDENTITY_ENDPOINT,IDENTITY_HEADER. KeepSTRAPI_REVALIDATE_SECRET(core revalidation).apps/ui/.env.local.example: remove theSTRAPI_CDN_PURGE_SECRETline and the "Azure Front Door CDN purge provider" comment block with its commentedAZURE_*lines. KeepSTRAPI_REVALIDATE_SECRET.apps/strapi/.env.example: remove theSTRAPI_CDN_PURGE_SECRETentry and its comment. KeepSTRAPI_REVALIDATE_SECRETandCLIENT_URL.turbo.json(globalEnv): removeSTRAPI_CDN_PURGE_SECRET,AZURE_SUBSCRIPTION_ID,AZURE_RESOURCE_GROUP,AZURE_FRONT_DOOR_PROFILE,AZURE_MI_CLIENT_ID,IDENTITY_ENDPOINT,IDENTITY_HEADER. KeepCLIENT_URLandSTRAPI_REVALIDATE_SECRET.
6. Remove the CDN reference from the revalidation doc
Edit apps/docs/docs/reference/cache-revalidation.md: remove the ## CDN purge (optional) section (the paragraph and the link to ./integrations/cdn.md). Leave the rest of the page.
7. Verify
# No dangling references to the removed CDN pieces
grep -rn "cdn-purge\|purgeCdn\|purgeCDNCache\|CdnCacheWidget\|@/lib/cdn\|cdn-cache\|AZURE_\|IDENTITY_ENDPOINT\|IDENTITY_HEADER\|front-door\|FrontDoor" apps packages turbo.json | grep -v node_modules | grep -v "\.next"
# Expect: no matches (an empty result).
pnpm -F @repo/strapi exec tsc --noEmit
pnpm -F @repo/ui exec tsc --noEmit
pnpm -F @repo/strapi exec vitest run tests/revalidate.test.ts tests/hierarchy-revalidate.test.ts
pnpm -F @repo/ui exec vitest run src/app/api/strapi-revalidate/route.test.ts src/lib/cache-paths.test.ts
pnpm -F @repo/docs buildAll typechecks/tests/build must pass. The core revalidation tests (revalidate.test.ts, hierarchy-revalidate.test.ts, strapi-revalidate/route.test.ts, cache-paths.test.ts) must still be green — confirming core revalidation survived.
8. Commit
git add -A
git commit -m "chore: remove optional CDN purge integration"Notes
- The fast path, if the CDN purge code was added in isolated commits and nothing since depends on it, is
git revertof those commits. The steps above are the robust manual path for when the feature is intermixed with later work. apps/ui/src/lib/cache-paths.tsis intentionally kept — it is still used by the core/api/strapi-revalidateroute.
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.

