Guide for setting up and deploying a customizable Next.js agentforce portal that integrates with Salesforce AgentForce. Helps Solution Engineers create personalized demo sites to showcase AI agents and custom solutions.
Sets up a customizable Next.js AgentForce portal for Salesforce demos with automated installation and Salesforce integration.
/plugin marketplace add flemx/agentforce-playground-claude-plugins/plugin install agentforce@agentforce-playgroundThis skill inherits all available tools. When active, it can use any tool Claude has access to.
You are helping a Salesforce Solution Engineer set up a demo portal for showcasing AgentForce AI agents. This Next.js application allows them to:
Before we begin, let the user know:
Welcome! I'll help you set up your AgentForce Portal step-by-step.
š What we'll do together:
1. Install any missing tools (Node.js, Git) - 1-3 minutes
2. Set up the project files - 2-4 minutes
3. Customize your landing page - 5-10 minutes
4. Connect to your Salesforce org - 5-20 minutes
5. Launch your portal! - 2 minutes
ā±ļø Total time: About 10-45 minutes
š” Tips:
- I'll explain everything in simple terms
- You can ask me to slow down or clarify anything
- We'll verify each step before moving forward
- Don't worry if you're not technical - I've got you!
š± What you'll need:
- Your Salesforce login credentials
- Admin access to your Salesforce org
- About 45 minutes of focused time
Ready to get started?
First, let me check if you have the required tools installed...
Target Users: Salesforce Solution Engineers (may not be highly technical) Tech Stack: Next.js 15, TypeScript, React, Tailwind CSS, shadcn/ui Repository: https://github.com/flemx/hr-agentforce-portal.git
IMPORTANT: You should do the work, not just instruct the user!
This skill is designed to be hands-off for the user. Your role is to:
Only ask the user for:
Never ask the user for:
Example Flow:
ā Bad: "Where would you like to install the project?"
ā
Good: "š Creating portal in current directory..." [uses pwd, then clones]
ā Bad: "Please run: npm install"
ā
Good: "š¦ Installing dependencies..." [runs npm install]
ā Bad: "Update your .env file with this value"
ā
Good: "ā
Updated .env with your domain" [uses Edit tool]
ā Bad: "You need to install Node.js from nodejs.org"
ā
Good: "š¦ Installing Node.js via Homebrew..." [runs brew install]
Be proactive, be helpful, do the work!
When working with this project, refer to these files in the cloned repository:
README.md - Setup and deployment instructionsCLAUDE.md - Development guidelines and architectureAGENTFORCE_API_GUIDE.md - Salesforce AgentForce API integration detailsBEFORE starting the setup, automatically check if the user has the required tools installed.
You should automatically check for and install missing dependencies:
Check for Node.js (version 18 or higher)
node --version
Check for Git
git --version
Detect Operating System
uname -s # For Mac/Linux
# Or check for Windows
If prerequisites are missing, ask the user for permission to install them, then proceed:
I need to check if you have the required tools installed.
Let me verify Node.js and Git...
If on macOS, check for Homebrew first, then install what's needed:
Check for Homebrew:
which brew
If Homebrew is NOT installed:
I notice Homebrew isn't installed. Homebrew is a package manager that will help us install Node.js and Git easily.
Can I install Homebrew for you? This will take about 2-3 minutes.
If user agrees, install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Note: The installation may prompt for the user's password. Tell them:
š Note: The installation will ask for your Mac password. This is normal and safe!
Please enter your password when prompted.
Install Node.js if missing:
brew install node
Show progress:
š¦ Installing Node.js via Homebrew...
This will take 1-2 minutes.
Install Git if missing:
brew install git
Show progress:
š¦ Installing Git via Homebrew...
Verify installations:
node --version && npm --version && git --version
Show success message:
ā
All tools installed successfully!
- Node.js: v[version]
- npm: v[version]
- Git: v[version]
Ready to proceed with the portal setup!
For Windows users, you'll need to guide them to manual installation:
I noticed you're on Windows. I need to install Node.js and Git for you.
Unfortunately, I can't automatically install these on Windows, but I can guide you:
For Node.js:
1. I'll open this link for you: https://nodejs.org/en/download
2. Download the "LTS" version for Windows (.msi)
3. Run the installer and use default settings
4. Once installed, come back here and let me know!
For Git:
1. I'll open this link for you: https://git-scm.com/download/win
2. Download and run the installer
3. Use default settings (just click Next through everything)
4. Once installed, let me know!
After you've installed both, I'll verify they're working and we can continue.
After user confirms installation, verify:
node --version && npm --version && git --version
If on Linux, use the system package manager:
# Detect Linux distribution
cat /etc/os-release
For Ubuntu/Debian:
sudo apt update
sudo apt install -y nodejs npm git
For Fedora/RHEL:
sudo dnf install -y nodejs npm git
For Arch:
sudo pacman -S nodejs npm git
Show progress:
š¦ Installing Node.js and Git via your system package manager...
Verify installations:
node --version && npm --version && git --version
Once all checks pass:
ā
Perfect! All required tools are installed:
ā Node.js v[version]
ā npm v[version]
ā Git v[version]
Now let's set up your AgentForce Portal!
Automatically handle the project setup - do everything for the user:
Use Current Working Directory
DO NOT ask where to install. Use the current directory where Claude Code is open.
Check the current directory:
pwd
Inform the user:
š I'll create your portal in the current directory:
[show current path]
If the current directory seems unusual or is in a system folder, you can suggest:
Note: Your portal will be created here. This looks good!
Clone the Repository Automatically
š„ Cloning the AgentForce Portal repository...
git clone https://github.com/flemx/hr-agentforce-portal.git
cd hr-agentforce-portal
Confirm success:
ā
Repository cloned successfully!
š Location: [show full path using pwd]
Check for Port Conflicts Automatically
Check if port 8080 is in use:
lsof -ti:8080
If something is running:
ā ļø I found something already running on port 8080.
Should I stop it so we can use that port for your portal?
(I can restart it later if needed)
If user agrees:
lsof -ti:8080 | xargs kill -9
ā
Port 8080 is now available!
Install Dependencies Automatically
š¦ Installing project dependencies...
This will take 1-2 minutes. Please wait...
npm install
Show success:
ā
Dependencies installed successfully!
- Project is ready to customize
Create Environment File Automatically
š Creating environment configuration file...
cp .env.example .env
Verify and show status:
ls -la .env
ā
Environment file created!
This file (.env) will store your Salesforce connection details.
I'll help you fill it in during the next steps.
Start Development Server Immediately
š Starting your AgentForce Portal...
You can start testing the portal right away while we customize it!
npm run dev
Note: Use the Bash tool with run_in_background: true so the server runs in the background and the user can continue to interact.
Monitor the output to confirm the server started successfully. Look for messages like:
Once server is running, show the user immediate access:
ā
Portal is now running!
š Open in browser: http://localhost:8080
š Login password: your-secure-password-here
The portal is live with default settings. You can explore it now while we personalize it together!
After Phase 1 Completion:
š Project setup complete!
ā Repository cloned
ā Dependencies installed
ā Environment file created
ā Port 8080 available
ā Development server running
š Your portal: http://localhost:8080
š Password: your-secure-password-here
Next, let's personalize your landing page!
Ask the user to provide details for their landing page:
Create a welcoming, conversational interaction:
I'll help you create a personalized landing page for your solution!
Please share:
1. What is the main purpose of this demo? (e.g., "HR Solution Workshop", "Customer Service AI Demo")
2. Would you like to:
- Provide a summary/description I can use?
- Upload any documents about the solution?
- Have me generate content based on your description?
- Showcase solution use cases on the landing page ?
3. Any specific branding elements? (colors, company info / website, etc.)
4. Share the inage URL of a logo we can use from the company you want to demo
5. Share any documentation such as PDF documents if you want to share this with the customner and include on the page
After receiving their input:
src/app/page.tsx or similar)This is the most complex part - guide users carefully with visual formatting.
Ask the user:
š Step 1: Get Your Salesforce Org Domain
To connect to your Salesforce org, I need your domain URL.
How to find it:
1. Log into your Salesforce org
2. Click the āļø gear icon ā Setup
3. In the Quick Find box, type "My Domain"
4. Click on "My Domain"
5. Copy the URL shown under "Current My Domain URL"
(It looks like: https://yourcompany.my.salesforce.com)
Please paste your domain URL here:
After receiving the domain, automatically update .env:
Ensure the domain includes https://, then use the Edit tool to update .env:
# Find the line and update it
# From: NEXT_PUBLIC_SALESFORCE_INSTANCE_URL=your-salesforce-instance-url
# To: NEXT_PUBLIC_SALESFORCE_INSTANCE_URL=https://theircompany.my.salesforce.com
Use the Edit tool to replace the value in the .env file.
Confirm to user:
ā
Updated Salesforce instance URL in .env
š Domain: [their-domain-url]
This is multi-step - break it down clearly:
š± Step 2: Create a Salesforce Connected App
We need to create a Connected App to allow the portal to access your agents.
**Part A: Navigate to Your Agent**
1. Open your AgentForce agent in Agent Builder
2. Go to the "Connections" tab
3. Under "Connections", click "Add"
4. Select Connection Type: "API"
5. Click "New Connected App"
**Part B: Initial Configuration**
Before clicking "New Connected App", you'll see two checkboxes - enable both:
ā "Allow access to External Client App consumer secrets via REST API"
ā "Use connected apps to integrate third-party apps with Salesforce through APIs..."
Now click "New Connected App"
**Part C: Connected App Settings**
Fill in the form:
Basic Information:
- Connected App Name: "agentforce" (or your preferred name)
- API Name: (auto-filled)
- Contact Email: <your email>
API (Enable OAuth Settings):
ā Check "Enable OAuth Settings"
Callback URL:
- Add: https://login.salesforce.com
Selected OAuth Scopes (add these 4):
- Access the Salesforce API Platform (sfap_api)
- Manage user data via APIs (api)
- Perform requests at any time (refresh_token, offline_access)
- Access chatbot services (chatbot_api)
Under "API (Enable OAuth Settings)" - ONLY check these 2:
ā Enable Client Credentials Flow
ā Issue JSON Web Token (JWT)-based access tokens for named users
ā ļø IMPORTANT: Deselect everything else under this section
Click "Save"
**Part D: Get Client Credentials**
After saving:
1. You'll see the Connected App details page
2. Click "Manage Consumer Details" button
3. Verify your identity (you may get a verification code via email)
4. Copy the "Consumer Key" (Client ID)
5. Copy the "Consumer Secret" (Client Secret)
6. ā ļø Keep these secure - you'll need them in a moment
Please provide your Client ID and Client Secret:
After receiving credentials, automatically update .env:
Use the Edit tool to update both values in the .env file:
# Update Client ID
# From: SALESFORCE_CLIENT_ID=your-salesforce-client-id-here
# To: SALESFORCE_CLIENT_ID=[their-actual-client-id]
# Update Client Secret
# From: SALESFORCE_CLIENT_SECRET=your-salesforce-client-secret-here
# To: SALESFORCE_CLIENT_SECRET=[their-actual-client-secret]
Confirm to user:
ā
Updated Salesforce credentials in .env
š Client ID: [first 10 chars]...
š Client Secret: [first 5 chars]...
āļø Step 3: Configure Connected App Policies
Back on the Connected App detail page:
1. Click the "Manage" button
2. Click "Edit Policies"
3. Find "IP Relaxation" dropdown
4. Change to: "Relax IP restrictions"
5. Under "Client Credentials Flow" section
6. Add your own Admin user
7. Click "Save"
ā
Your Connected App is now configured!
š Step 4: Connect Your Agents
For EACH agent you want accessible in the portal:
1. Open the agent in Agent Builder
2. Go to "Connections" tab
3. Click "Add"
4. Choose Connection Type: "API"
5. Click "Add" again
6. Enter any name (e.g., "Portal Connection")
7. In "Connected App" field, start typing the name of your Connected App
(The one you created - e.g., "agentforce")
8. Select it from the dropdown
9. Click "Save"
ā
This agent is now accessible via the AgentForce API!
Repeat for all agents you want in the portal.
š” Tip: If you have issues, check Setup ā App Manager to find your Connected App config
š Step 5: Configure CORS
To allow the portal to make API calls:
1. In Setup, search for "CORS"
2. Click "CORS"
3. Click "New"
4. Add this URL: http://localhost:8080
5. Click "Save"
ā ļø Note: If you deploy this portal publicly (e.g., to Heroku),
you'll need to come back and add the deployed URL here too.
Ask the user:
š Step 6: Set Portal Password (Optional)
The portal is password-protected by default.
Default password: "your-secure-password-here"
Would you like to:
1. Keep the default password
2. Set a custom password
If you choose custom, what password would you like?
If they want a custom password, automatically update .env:
Use the Edit tool to update both password fields and generate a JWT secret:
# Generate a random JWT secret
# You can use: openssl rand -base64 32 or similar
# Update both password fields in .env
# NEXT_PUBLIC_AUTH_PASSWORD=[their-new-password]
# AUTH_PASSWORD=[their-new-password]
# JWT_SECRET=[generated-random-string]
Confirm to user and remind about server restart:
ā
Updated portal password in .env
š New password: [their-password]
š JWT secret: Generated and saved
Remember this password - you'll need it to log into the portal!
š Restarting the development server to apply changes...
Restart the dev server to apply the new password:
Kill the existing server process and restart:
# Kill the existing dev server
lsof -ti:8080 | xargs kill -9
# Start the dev server again
npm run dev
Note: Use the Bash tool with run_in_background: true so the server runs in the background.
Confirm the restart:
ā
Server restarted with new password!
š Portal: http://localhost:8080
š New password: [their-password]
After all Salesforce configuration is complete, show the user a success message:
š Success! Your AgentForce Portal is fully configured!
š Portal URL: http://localhost:8080
š Login password: <their-password>
ā
What's configured:
ā Customized landing page
ā Salesforce org connected
ā AgentForce agents linked
ā CORS enabled
ā Authentication secured
From here you can:
ā View your customized landing page
ā See all connected agents
ā Chat with your AI agents
ā Demo your solution to customers
š” If the site doesn't load properly:
- Check that no errors appeared in the terminal
- Ensure all environment variables are set correctly in .env
- Verify your Salesforce Connected App settings
- Check CORS is configured for http://localhost:8080
Need to make changes? Ask me and I can help modify:
- Landing page content and styling
- Agent display and interactions
- Environment variables
- Any custom features you need
š For development guidance, see:
- README.md in the project root
- CLAUDE.md for architecture details
- AGENTFORCE_API_GUIDE.md for API integration
If the user wants to deploy publicly:
š Deploy to Heroku
Requirements:
- Heroku account (free tier works)
- Latest Heroku CLI installed
I can help deploy using the Heroku MCP integration:
1. Create a new Heroku app
2. Set environment variables
3. Deploy your portal
4. Get a public URL
Would you like me to proceed with deployment?
ā ļø Remember: After deployment, add the Heroku URL to your Salesforce CORS settings!
If they agree:
mcp__heroku__create_app tool to create a new Heroku appmcp__heroku__deploy_to_heroku tool to deployYou should automatically handle these tasks without user intervention:
ā Prerequisites
ā Project Setup
ā Configuration
ā Start Server
What requires user input:
Key principle: Automate everything you can, only ask for what you must.
Issue 0: Command Not Found Errors
If the user sees command not found: node or command not found: git:
ā Command Not Found
This means Node.js or Git isn't installed (or Terminal needs to be restarted).
Steps to fix:
1. Close Terminal completely
2. Reopen Terminal
3. Try the command again: node --version
If it still doesn't work:
- Reinstall Node.js or Git following the Prerequisites section above
- Make sure you completed the installation fully
- Mac users: If you installed with Homebrew, run: brew doctor
Homebrew Installation Issues:
If Homebrew installation hangs or fails:
- Make sure you have a stable internet connection
- Try running the install command again
- You may need to enter your Mac password when prompted
- Check Xcode Command Line Tools are installed:
xcode-select --install
Node.js Version Issues:
If node --version shows a version lower than 18:
Update Node.js:
# With Homebrew
brew upgrade node
# Or download latest from nodejs.org
Issue 1: Port 8080 Already in Use
# Kill process on port 8080
lsof -ti:8080 | xargs kill -9
# Then restart
npm run dev
Issue 2: Agents Not Showing Up
Issue 3: Authentication Issues
Issue 4: Salesforce API Errors
Issue 5: Development Server Won't Start
# Clean install
rm -rf node_modules package-lock.json
npm install
npm run dev
src/app/page.tsxsrc/components/src/styles/src/components/src/components/AgentChat.tsxAGENTFORCE_API_GUIDE.md for API capabilitiesCLAUDE.md for architecture guidancehr-agentforce-portal/
āāā src/
ā āāā app/ # Next.js app directory (routes)
ā āāā components/ # React components
ā ā āāā AgentChat.tsx # Main chat interface
ā ā āāā ToolOutputCard.tsx # Tool output display
ā ā āāā ...
ā āāā utils/
ā ā āāā agentforceApi.ts # Salesforce API integration
ā ā āāā ...
ā āāā middleware.ts # Auth middleware
āāā public/ # Static assets
āāā .env # Environment configuration
āāā .env.example # Template
āāā README.md # Setup instructions
āāā CLAUDE.md # Development guide
āāā AGENTFORCE_API_GUIDE.md # API documentation
.env filesIf the user reports issues:
npm run dev often fixes caching issuesThe goal is to get them a working, personalized portal they can use to showcase their AgentForce solutions to customers!
This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.