agentleFS
LockeZeRoLockeZeRo/site-builder/.claude/skills/lead-forms/SKILL.md

lead-forms

Skill0 starsChanged 3 months agoMITView on GitHub

The lead capture form, its handler, validation and delivery. Triggers on "form", "lead", "contact form", "form submission", "spam", "form not sending".

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    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
  1. Distinctive:

    Ask for the fewest fields that qualify the lead: Every field costs completions.

    line 28
  2. Very specific:

    Credentials never go in this repo: Not in a config file, not in a comment, not in a .txt alongside it.

    line 40

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Lead forms

How it works

theme/inc/lead-form.php renders the form and handles the POST. It is server-side, with no third-party form plugin, for one reason: a form plugin puts your leads in someone else's database and usually adds its own styling you then fight.

form POST → nonce check → honeypot check → validation → wp_mail( SB_LEAD_EMAIL ) → thank-you state

Rules

  • Nonce on every form. wp_nonce_field() in, check_admin_referer() out.
  • Honeypot, not CAPTCHA. A hidden field that must stay empty stops the great majority of bot submissions at zero cost to the human filling it in. Reach for a CAPTCHA only if the honeypot demonstrably stops working — it is a real conversion tax.
  • Sanitise in, escape out. sanitize_text_field(), sanitize_email(), wp_kses_post() on the way in; esc_html() on the way out.
  • Ask for the fewest fields that qualify the lead. Every field costs completions. If nobody reads a field's answer, delete it.
  • Never log submissions to a file in the webroot. That is how a leads file ends up publicly fetchable.
  • Never commit real submissions. *leads*.csv and *subscribers*.csv are gitignored deliberately.

Delivery

wp_mail() to SB_LEAD_EMAIL. On most hosts PHP mail is unreliable and lands in spam — configure SMTP at the host or with an SMTP plugin.

Credentials never go in this repo. Not in a config file, not in a comment, not in a .txt alongside it. Use the plugin's own settings screen or an environment variable. An app password committed to a repo is compromised the moment the repo is cloned, and deleting the file does not remove it from history.

Debugging "the form does not send"

In order — it is almost always the third one:

  1. Does the POST reach the handler? error_log() at the top of the callback.
  2. Does the nonce pass? A cached page serves a stale nonce; exclude the page from full-page caching.
  3. Does wp_mail() return true? If yes, it is a deliverability problem, not a code problem. Check SMTP and SPF/DKIM before touching the form.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.