Agent skill
webflow-module-creation
Create and register custom JavaScript modules for Webflow projects. Use when creating new functionality, adding data-module attributes, or structuring component logic.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/webflow-module-creation
SKILL.md
Webflow Module Creation
This skill guides you through creating and registering custom modules that are automatically mounted based on DOM attributes.
Core Principles
- File Location: All modules must be created in
src/modules/. - Naming: The filename (e.g.,
test.ts) must exactly match thedata-moduleattribute value (e.g.,data-module="test"). - Structure: Every module must have a default export function.
Module Template
import { onMount, onDestroy } from "@/modules/_";
/**
* @param element The DOM element with the data-module attribute
* @param dataset The data attributes of the element
*/
export default function (element: HTMLElement, dataset: DOMStringMap) {
// Setup logic here
onMount(() => {
// Initialization code
});
onDestroy(() => {
// Cleanup code
});
}
Step-by-Step Creation
- Create the File: Add a new
.tsfile insrc/modules/(e.g.,src/modules/my-component.ts). - Implement the Function: Export a default function with the signature
(element: HTMLElement, dataset: DOMStringMap) => void. - Register in HTML: Add the
data-module="my-component"attribute to the target element in Webflow/HTML. - Access Data: Use the
datasetparameter to accessdata-attributes passed from the DOM.
Best Practices
- Keep modules focused on a single responsibility.
- Use descriptive names that match the component's purpose.
- Ensure the filename is lowercase and uses hyphens if needed (e.g.,
image-gallery.ts).
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?