form-wiring
Skill17 starsChanged 7 months agoMITView on GitHub
Connect your generated website to Resend for email delivery and Beehiiv for newsletter signup. This skill transforms form placeholders in your site-generator output into fully functional forms that: - Send contact inquiries via Resend - Capture newsletter signups in Beehiiv - Validate input client-side - Handle errors gracefully - Show success confirmations - Protect against spam Fields: - Name (required, text) - Email (required, email) - Subject (required, text) - Message (required, textarea) - Honeypot field (hidden) Delivery: Via Resend…
- Reads credentials
In this repository20 other files it gives its agents.
- aios-presentation-standardSkill
- audit-existing-siteSkill
- brand-to-imagesSkill
- brand-voiceSkill
- code-auditorSkill
- content-auditorSkill
- copy-editorSkill
- deploy-to-vercelSkill
- Getting Started with VibeCodingSkill
- link-checkerSkill
- performance-optimizerSkill
- qa-testerSkill
- security-auditorSkill
- seo-aeo-auditorSkill
- site-customizerSkill
- site-generatorSkill
- site-interviewerSkill
- site-updaterSkill
- ux-reviewerSkill
- webmasterSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
41 rules. About 0 are common, 40 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈40
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 50
Create api/contact.ts serverless function
- Distinctive: line 51
Add form submission handler in main JS
- Distinctive: line 54
Create Beehiiv embed code
- Distinctive: line 103
No form wiring needed
- Distinctive: line 162
Honeypot: Must be empty (hidden field)
- Distinctive: line 180
Create Beehiiv publication (if not already created)
- Distinctive: line 225
Add each variable from .env.example
- Distinctive: line 243
If this field contains any value, the submission is rejected as spam.
- Distinctive: line 279
After site-generator creates your website:
- Distinctive: line 299
Check browser console for errors
- Distinctive: line 300
Verify form validation works
- Distinctive: line 301
Test honeypot field (leave empty)
- Distinctive: line 302
Test error states (if rate limiting enabled)
- Distinctive: line 306
Check for success toast notification
- Distinctive: line 307
Verify email arrives in inbox
- Distinctive: line 308
Test from different devices (mobile, desktop)
- Distinctive: line 309
Test from different networks
- Distinctive: line 310
Check spam folder for emails
- Distinctive: line 316
Verify Resend API key is correct in Vercel env vars
- Distinctive: line 317
Check that form names match function expectations
- Distinctive: line 318
Ensure Resend domain is verified
- Distinctive: line 321
Check email spam folder
- Distinctive: line 322
Verify email address in Resend dashboard
- Distinctive: line 323
Check Resend logs in dashboard
- Distinctive: line 324
Verify sender domain is authenticated
- Distinctive: line 327
Check that form handling JS is loaded
- Distinctive: line 328
Verify toast CSS is present
- Distinctive: line 330
Ensure form submit handler is wired correctly
- Distinctive: line 333
Verify Beehiiv publication ID is correct
- Distinctive: line 334
Check iframe sandbox permissions
- Distinctive: line 335
Ensure Beehiiv publication is active
- Distinctive: line 348
Never commit .env files with real API keys
- Distinctive: line 349
Use Vercel's environment variable system
- Distinctive: line 358
Add field to HTML form with name attribute
- Distinctive: line 359
Add validation in client JS if needed
- Distinctive: line 360
Add field to form data object
- Distinctive: line 361
Update email template in function
- Distinctive: line 385
Read the Resend Setup guide in references/
- Distinctive: line 386
Create Resend account and API key
- Distinctive: line 387
Run this skill on your generated website
- Distinctive: line 389
Test contact form end-to-end
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
SKILL 4: Form Wiring
Connect your generated website to Resend for email delivery and Beehiiv for newsletter signup.
Overview
This skill transforms form placeholders in your site-generator output into fully functional forms that:
- Send contact inquiries via Resend
- Capture newsletter signups in Beehiiv
- Validate input client-side
- Handle errors gracefully
- Show success confirmations
- Protect against spam
What This Skill Does
1. Detects Forms
- Scans generated website files
- Identifies contact forms, newsletter fields, inquiry forms
- Finds Beehiiv embed placeholders
2. Creates Serverless Functions
- Generates
api/contact.tsorapi/contact.js - Implements Resend email delivery
- Handles multiple form types (contact, inquiry, etc.)
- Includes error handling and validation
3. Enhances Client-Side Forms
- Adds form validation (required, email, phone)
- Implements toast notifications (success/error)
- Adds honeypot field for spam protection
- Wires form submit to serverless function
- Adds loading states to buttons
4. Configures Services
- Resend API integration
- Beehiiv embed setup (zero-code iframe)
- Vercel environment variables
- Domain verification for Resend
Skill Workflow
Input
- Website folder (generated by site-generator)
- User's Resend API key (provided by user)
- User's Beehiiv publication ID (if using newsletter)
Processing
- Scan for form markup in HTML/JSX files
- Create
api/contact.tsserverless function - Add form submission handler in main JS
- Inject toast notification UI
- Generate environment variable setup instructions
- Create Beehiiv embed code
Output
- Updated website with wired forms
api/contact.tsserverless function- Updated form HTML with event listeners
.env.examplefile with required variables- Setup instructions for Vercel
- Beehiiv embed code (copy-paste ready)
Form Types Supported
Contact Form
Purpose: General inquiries from visitors
Fields:
- Name (required, text)
- Email (required, email)
- Subject (required, text)
- Message (required, textarea)
- Honeypot field (hidden)
Delivery: Via Resend to business owner email
Response: Welcome email + internal notification
Sponsor/Partnership Inquiry
Purpose: B2B partnership requests
Fields:
- Company Name (required, text)
- Contact Name (required, text)
- Email (required, email)
- Phone (optional, tel)
- Inquiry Type (required, select)
- Budget (optional, text)
- Timeline (optional, select)
- Message (required, textarea)
Delivery: Via Resend to partnerships email
Response: Thank you email + internal notification
Newsletter Signup
Purpose: Email list growth
Method: Beehiiv iframe embed (zero-code)
What Happens:
- No form wiring needed
- Pure HTML iframe embed
- Beehiiv handles email capture
- User can build campaigns in Beehiiv dashboard
Server-Side Function: api/contact.ts
Structure
import { Resend } from 'resend';
const resend = new Resend(process.env.RESEND_API_KEY);
export default async function handler(req, res) {
if (req.method !== 'POST') {
return res.status(405).json({ error: 'Method not allowed' });
}
try {
// Validate form data
// Check honeypot field
// Send via Resend
// Return success
} catch (error) {
// Return error response
}
}Features
- POST-only endpoint
- Input validation (required fields, email format)
- Honeypot spam detection
- Rate limiting ready (configurable)
- Error logging to console
- Success response with message
- Error response with user-friendly message
Environment Variables
RESEND_API_KEY: Resend secret keyRESEND_FROM_EMAIL: "noreply@yoursite.com"RESEND_TO_EMAIL: "contact@business.com"
Client-Side Form Handling
Form Submission
- User fills form and clicks submit
- JavaScript prevents default form behavior
- Form data is validated client-side
- Loading state appears on button
- Form data is sent to
/api/contactvia fetch - Response is checked for success/error
- Toast notification appears
- Form is cleared (if successful)
Validation
- Required fields: Empty check
- Email: Regex pattern match
- Phone: Optional, basic format check
- Honeypot: Must be empty (hidden field)
Toast Notifications
Success Toast:
✓ Message sent! We'll get back to you soon.Appears for 5 seconds, auto-dismisses.
Error Toast:
✗ Something went wrong. Please try again.Shows specific error message, persistent.
Beehiiv Newsletter Integration
Zero-Configuration Setup
- Create Beehiiv publication (if not already created)
- Get publication ID from Beehiiv dashboard
- Skill generates embed code
- Copy embed code to footer or dedicated section
- Done! No serverless function needed
Embed Code Format
<!-- Beehiiv Newsletter Form -->
<iframe
src="https://www.beehiiv.com/embedjs?publication_id=YOUR_PUB_ID"
style="border: none; width: 100%; height: 220px; max-height: none;"
></iframe>Features
- Fully managed by Beehiiv
- Custom styling via Beehiiv dashboard
- Audience tracking and analytics
- Double opt-in available
- GDPR compliant
Location Options
- Footer section (recommended)
- Dedicated subscribe page
- Homepage sidebar
- Blog post sidebar
- Modal popup (advanced)
Environment Variable Setup
.env.example File
# Resend Email Service
VITE_RESEND_FROM_EMAIL=noreply@yourdomain.com
VITE_RESEND_TO_EMAIL=contact@yourdomain.com
RESEND_API_KEY=re_xxxxxxxxxxxxx
# Beehiiv Newsletter
VITE_BEEHIIV_PUBLICATION_ID=xxxxxxxxxxxxxVercel Configuration
- Go to Vercel project settings
- Navigate to Environment Variables
- Add each variable from .env.example
- Restart deployment
- Forms are now live
Spam Protection
Honeypot Field
A hidden form field that only bots can see and fill:
<input
type="text"
name="_redirect"
style="display: none;"
aria-hidden="true"
/>If this field contains any value, the submission is rejected as spam.
Rate Limiting (Optional)
Skill includes commented code for rate limiting:
- 5 submissions per IP per hour
- Prevents abuse
- Customizable thresholds
To enable, uncomment rate limiting code in api/contact.ts.
Email Templates
Confirmation Email to User
Hi [Name],
Thanks for reaching out! We've received your message and will get back to you as soon as possible.
Best regards,
[Business Name]Notification Email to Business
New Contact Form Submission
Name: [Name]
Email: [Email]
Subject: [Subject]
Message: [Message]
Reply to: [Email]Setup Checklist
After site-generator creates your website:
- User creates Resend account (resend.com)
- User creates API key in Resend
- User verifies domain in Resend
- User provides API key to this skill
- Skill creates api/contact.ts function
- Skill updates form HTML and JS
- User adds .env variables to Vercel
- User deploys updated site
- User tests contact form
- User receives test email
- (Optional) User creates Beehiiv publication
- (Optional) User provides Beehiiv pub ID to skill
- (Optional) User adds newsletter embed to site
Testing Forms
Before Deployment
- Fill out contact form locally
- Check browser console for errors
- Verify form validation works
- Test honeypot field (leave empty)
- Test error states (if rate limiting enabled)
After Deployment
- Fill out contact form on live site
- Check for success toast notification
- Verify email arrives in inbox
- Test from different devices (mobile, desktop)
- Test from different networks
- Check spam folder for emails
Troubleshooting
Form Doesn't Submit
- Check browser console for errors
- Verify Resend API key is correct in Vercel env vars
- Check that form names match function expectations
- Ensure Resend domain is verified
Email Not Received
- Check email spam folder
- Verify email address in Resend dashboard
- Check Resend logs in dashboard
- Verify sender domain is authenticated
Toast Not Showing
- Check that form handling JS is loaded
- Verify toast CSS is present
- Check browser console for errors
- Ensure form submit handler is wired correctly
Newsletter Embed Not Showing
- Verify Beehiiv publication ID is correct
- Check iframe sandbox permissions
- Ensure Beehiiv publication is active
- Try different embed placement
Security Considerations
What's Protected
- API key only stored on Vercel (never exposed to browser)
- Form data validated on both client and server
- Honeypot field prevents automated spam
- Rate limiting prevents abuse (optional)
- HTTPS ensures data encryption
What User Should Do
- Never commit .env files with real API keys
- Use Vercel's environment variable system
- Enable domain verification in Resend
- Monitor Resend logs for unusual activity
- Regularly rotate API keys
Advanced Customization
Custom Form Fields
To add fields beyond the defaults:
- Add field to HTML form with name attribute
- Add validation in client JS if needed
- Add field to form data object
- Update email template in function
- Test submission
Custom Email Template
Modify email content in api/contact.ts:
await resend.emails.send({
from: process.env.RESEND_FROM_EMAIL,
to: process.env.RESEND_TO_EMAIL,
subject: `New message from ${name}`,
html: `<h2>New submission</h2>...` // Edit HTML here
});Custom Toast Styling
Modify toast CSS in form handling JS:
toast.style.backgroundColor = '#your-color';
toast.style.padding = '20px';
// etc.Next Steps
- Read the Resend Setup guide in references/
- Create Resend account and API key
- Run this skill on your generated website
- Deploy to Vercel with env variables
- Test contact form end-to-end
- (Optional) Add Beehiiv newsletter embed
See references/resend-setup.md for detailed Resend account creation and configuration steps.
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.

