This skill should be used when the user asks to "create web roles", "add web roles", "set up web roles", "add roles", "create roles for my site", "manage web roles", "add authenticated role", "add anonymous role", or wants to create web roles for their Power Pages code site. Web roles control access and permissions for site users.
This skill should be used when the user asks to "create web roles", "add web roles", "set up web roles", "add roles", "create roles for my site", "manage web roles", "add authenticated role", "add anonymous role", or wants to create web roles for their Power Pages code site. Web roles control access and permissions for site users.
{"Stop":[{"hooks":[{"type":"command","command":"node \"${CLAUDE_PLUGIN_ROOT}/skills/create-webroles/scripts/validate-webroles.js\"","timeout":15},{"type":"prompt","prompt":"If web roles were being created in this session (via /power-pages:create-webroles), verify before allowing stop: 1) The .powerpages-site/web-roles/ directory was checked for existing roles, 2) New web role YAML files were created with valid UUIDs generated by the generate-uuid.js script, 3) All web role files were verified (valid UUIDs, correct format, no duplicate flags), 4) The user was asked to deploy the site to apply the new roles. If any of these are incomplete, return { \"ok\": false, \"reason\": \"<specific issues>\" }. If no web role work happened or everything is complete, return { \"ok\": true }.\n","timeout":30}]}]}
Create Web Roles
Create web roles for a Power Pages code site. Web roles define the permissions and access levels for different types of site users.
Core Principles
Use TaskCreate/TaskUpdate: Track all progress throughout all phases — create the todo list upfront with all phases before starting any work.
Always use the UUID script: Never generate UUIDs manually — always use ${CLAUDE_PLUGIN_ROOT}/scripts/generate-uuid.js to produce valid UUID v4 values for each web role.
Preserve uniqueness constraints: Only one role can have anonymoususersrole: true and only one can have authenticatedusersrole: true. Always check existing roles before setting these flags.
Prerequisite: The site must be deployed at least once before web roles can be created, since deployment creates the .powerpages-site folder structure that stores web role definitions.
Initial request: $ARGUMENTS
Workflow
Phase 1: Verify Site Structure → Check for .powerpages-site/web-roles/ directory
Phase 2: Discover Existing Roles → Read current web role YAML files
Phase 3: Determine New Roles → Analyze the site and ask the user what roles are needed
Phase 4: Create Web Role Files → Generate YAML files with UUIDs from the Node script
Phase 5: Verify Web Roles → Validate all created files exist, have valid UUIDs, and flags are correct
Phase 6: Review & Deploy → Present summary and proceed to deployment
Phase 1: Verify Site Structure
Goal: Confirm the .powerpages-site/web-roles/ directory exists and is ready for web role files
Actions:
Look for the .powerpages-site/web-roles/ directory in the project root. Use Glob to search:
**/.powerpages-site/web-roles
Also locate the project root by finding powerpages.config.json:
**/powerpages.config.json
If .powerpages-site folder does NOT exist:
The site has not been deployed yet. The .powerpages-site folder is created automatically when the site is deployed for the first time using pac pages upload-code-site.
Tell the user:
"The .powerpages-site folder was not found. This folder is created when the site is first deployed to Power Pages. I'll deploy your site first, and then we can create web roles."
Use AskUserQuestion to confirm:
Question
Options
Your site needs to be deployed first so the .powerpages-site folder is created. Shall I deploy it now?
Yes, deploy now (Recommended), No, I'll do it later
If "Yes, deploy now": Invoke the /power-pages:deploy-site skill to deploy the site. Once deployment completes and .powerpages-site is created, resume this workflow from Phase 2.
If "No, I'll do it later": Stop here — the user must deploy first before web roles can be created.
If .powerpages-site exists but web-roles/ subdirectory does NOT exist:
The filename should be the role name in kebab-case with a .yml extension (e.g., Administrators → administrators.yml, Content Editors → content-editors.yml).
Write the file with this exact format (4 fields, no extra whitespace or comments):
Follow the skill tracking instructions in the reference to record this skill's usage. Use --skillName "CreateWebroles".
Present a summary of what was created:
"I've created the following new web roles:"
Role Name
ID
Anonymous
Authenticated
Content Editors
a1b2c3d4-...
false
false
(etc.)
Then ask the user if they want to deploy the site to apply the new roles:
Question
Options
The new web roles have been created locally. To apply them in Power Pages, the site needs to be deployed. Would you like to deploy now?
Yes, deploy now (Recommended), No, I'll deploy later
If "Yes, deploy now": Tell the user to invoke the deploy skill:
"Please run /power-pages:deploy-site to deploy your site and apply the new web roles."
If "No, I'll deploy later": Acknowledge and remind them:
"No problem! Remember to deploy your site using /power-pages:deploy-site when you're ready to apply the new web roles to your Power Pages environment."
Output: Summary presented and deployment offered
Important Notes
Key Decision Points (Wait for User)
After Phase 1: Confirm deployment if .powerpages-site is missing
After Phase 3: Confirm which roles to create
After Phase 6: Deploy or skip
Progress Tracking
Before starting Phase 1, create a task list with all phases using TaskCreate:
Task subject
activeForm
Description
Verify site structure
Verifying site structure
Check for .powerpages-site/web-roles/ directory, create if needed
Discover existing roles
Discovering existing roles
Read current web role YAML files and compile list of existing roles
Determine new roles
Determining new roles
Analyze site needs and ask user which roles to create
Create web role files
Creating web role files
Generate YAML files with UUIDs from the Node script for each new role
Verify web roles
Verifying web roles
Validate all files exist, have valid UUIDs, and uniqueness constraints are satisfied
Review and deploy
Reviewing and deploying
Present summary of created roles and offer deployment
Mark each task in_progress when starting it and completed when done via TaskUpdate. This gives the user visibility into progress and keeps the workflow deterministic.