FO

forms-and-validation

Provides patterns for creating robust, accessible forms in Python web frameworks using Bootstrap.

Install

mkdir -p .claude/skills/forms-and-validation && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15002" && unzip -o skill.zip -d .claude/skills/forms-and-validation && rm skill.zip

Installs to .claude/skills/forms-and-validation

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Use this skill when building or refining forms and validation flows for Flask or FastAPI applications using Bootstrap 5 and server-rendered templates. Covers labels, layout, sticky values, field errors, validation summaries, confirmation flows, and accessible business-style forms.
281 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Intermediate

Key capabilities

  • Create and edit forms
  • Handle validation feedback
  • Preserve sticky form values after failed submission
  • Manage confirmation prompts
  • Organize form layout and readability
  • Implement file upload forms

How it works

This skill applies design principles and rules for form structure, labels, validation feedback, and sticky values to server-rendered forms in Python web applications.

Inputs & outputs

You give it
Task involving form building or refinement for Flask/FastAPI applications with Bootstrap 5 and server-rendered templates
You get back
Improved form structure, validation rendering, and user experience for web applications

When to use forms-and-validation

  • Building user signup forms
  • Creating search and filter forms
  • Handling form validation errors
  • Implementing file upload forms
  • Maintaining accessible form layouts

About this skill

Forms and Validation Skill

This skill is for server-rendered forms in Python web applications.

Target stack:

  • Flask or FastAPI
  • Jinja or similar server-rendered templates
  • Bootstrap 5
  • Clean, simple, business-style UI

Use this skill when the task involves:

  • create/edit forms
  • search/filter forms
  • validation feedback
  • sticky form values after failed submission
  • confirmation prompts
  • field help text
  • inline errors
  • form organization and readability
  • WTForms or manual request/form handling
  • file upload forms
  • boolean/status fields
  • destructive confirmation inputs

Core assumptions

  • Forms are workflow surfaces, not decorative UI.
  • The user should always understand:
    • what is required
    • what failed
    • what to fix next
    • whether their previous input was preserved
  • Validation belongs in backend logic, but templates must render validation clearly.
  • Form pages should be predictable across the application.

Design principles

  • Prefer clarity over compactness.
  • Keep labels visible.
  • Preserve user input on validation failure whenever possible.
  • Show errors beside the field and optionally in a summary block.
  • Use help text only where it reduces confusion.
  • Keep required fields obvious, but do not overload the screen with warning text.
  • Use consistent button order and placement.

Form structure rules

A standard form page should include:

  • page title
  • short supporting hint when useful
  • validation summary when errors exist
  • grouped fields
  • clear footer actions

For longer forms:

  • group related inputs into sections
  • use cards or headings
  • avoid very long uninterrupted field stacks when sections would help

Labels and inputs

Every meaningful field should have:

  • a visible label
  • a stable id
  • a matching name
  • a suitable input type
  • help text only if needed

Prefer:

  • text input for short text
  • textarea for notes and descriptions
  • select for constrained options
  • checkbox or switch for boolean values
  • date/time input types when supported by the app and browser expectations

Do not rely on placeholder text as the only label.

Required fields

Required inputs should be:

  • marked consistently
  • validated on the backend
  • visually understandable without clutter

A simple convention such as * on labels is acceptable if used consistently.

Validation feedback rules

When validation fails:

  • keep the submitted values in the form where safe
  • highlight invalid fields
  • show a clear field-level error message
  • optionally show a top summary for multiple errors
  • avoid vague messages like Invalid input

Good validation feedback is:

  • specific
  • brief
  • actionable

Examples:

  • Email is required.
  • Start date must be before end date.
  • Password must be at least 12 characters.

Sticky values

After failed submission:

  • text fields should preserve submitted values
  • textarea content should be preserved
  • selected options should remain selected
  • checkbox/radio state should remain preserved
  • file inputs usually cannot be safely repopulated by the browser, so explain this if relevant

This is a key quality bar for business forms.

Field error display

Prefer Bootstrap 5 invalid styles when practical:

  • is-invalid on invalid inputs
  • .invalid-feedback for field error text

For non-field or cross-field errors:

  • show a summary alert near the top of the form

Help text

Help text should:

  • appear below the input
  • be muted and short
  • clarify format, meaning, or consequences

Do not add help text for obvious fields.

Button rules

Preferred order:

  • primary submit action
  • secondary cancel/back action
  • destructive action separately, if needed

Labels should be explicit:

  • Save
  • Create Employee
  • Update Settings
  • Cancel
  • Archive Record

Avoid vague labels like Submit.

Search and filter forms

Search/filter forms should:

  • be compact
  • preserve current selections
  • support reset/clear
  • avoid over-complication

These are utility forms, not full data entry forms.

WTForms expectations

If WTForms is in use:

  • respect the existing form class structure
  • render field errors cleanly
  • do not duplicate validation rules into templates
  • use macros where repetition is high

Manual form handling expectations

If the app uses manual request parsing:

  • preserve posted values through explicit template context
  • keep validation rules in routes/services/forms, not templates
  • ensure error dictionaries or messages map predictably to fields

File upload forms

For file uploads:

  • ensure multipart/form-data is used
  • explain accepted file types when needed
  • validate file presence/type/size on the backend
  • display failures clearly
  • do not pretend file selections were preserved after failure

Accessibility and UX

Always check:

  • labels are associated to inputs
  • errors are readable and near the field
  • the page can be understood without relying on color alone
  • keyboard tab order is sensible
  • headings and groups make sense

Flask/FastAPI expectations

For Flask:

  • support flash messages where relevant
  • align with WTForms or existing request handling
  • preserve Blueprint/template conventions

For FastAPI:

  • follow current Jinja/template organization
  • preserve route parameter and form field expectations
  • keep validation rendering thin and explicit

Output expectations

When applying this skill:

  1. identify the form type
  2. inspect current handling and validation flow
  3. preserve field names and posted values
  4. improve error rendering and structure
  5. keep the result simple and consistent
  6. provide quick verification steps

See also:

  • form-patterns.md
  • validation-checklist.md

Limitations

  • Applies only to Flask or FastAPI applications
  • Requires Jinja or similar server-rendered templates
  • Designed for Bootstrap 5 UI

How it compares

This skill provides a standardized approach to form development in Flask/FastAPI with Bootstrap 5, contrasting with ad-hoc or inconsistent manual implementations.

Compared to similar skills

forms-and-validation side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
forms-and-validation (this skill)04moNo flagsIntermediate
puttokei-project03moNo flagsIntermediate
fastapi-templates5202moNo flagsIntermediate
fastapi-pro794moNo flagsAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

puttokei-project

TUT-StudyClub

Puttokei リポジトリで作業するときの前提をまとめた skill。docs/requirements/requirements.md を基準に、backend の FastAPI/Python、mobile の Expo/TypeScript、infra の Terraform、空ディレクトリの初期実装や構成整理を行うときに使う。

00

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

5201,086

fastapi-pro

sickn33

Build high-performance async APIs with FastAPI, SQLAlchemy 2.0, and Pydantic V2. Master microservices, WebSockets, and modern Python async patterns. Use PROACTIVELY for FastAPI development, async optimization, or API architecture.

79181

python-pro

sickn33

Master Python 3.12+ with modern features, async programming, performance optimization, and production-ready practices. Expert in the latest Python ecosystem including uv, ruff, pydantic, and FastAPI. Use PROACTIVELY for Python development, optimization, or advanced Python patterns.

2358

python-configuration

wshobson

Python configuration management via environment variables and typed settings. Use when externalizing config, setting up pydantic-settings, managing secrets, or implementing environment-specific behavior.

542

fastapi-router-py

microsoft

Create FastAPI routers with CRUD operations, authentication dependencies, and proper response models. Use when building REST API endpoints, creating new routes, implementing CRUD operations, or adding authenticated endpoints in FastAPI applications.

525

Search skills

Search the agent skills registry