Contribute components
New components are implemented as subclasses of the repository component base classes under src/lfx/src/lfx/.
Contribute an example component to SkillFlaw
Anyone can contribute an example component. For example, to create a new data component called DataFrame processor, follow the existing component structure and place the implementation in the appropriate component package.
-
Create a Python file for your component, such as
dataframe_processor.py. -
Write your component as an object of the
Componentclass. Create a new class that inherits fromComponentand override the base class's methods.Backwards compatibilityThe
lfximport path replaced the older custom component import path in the 1.7 migration, but the original input is still compatible and works the same way._10from typing import Any, Dict, Optional_10import pandas as pd_10from lfx.custom.custom_component.component import Component_10_10class DataFrameProcessor(Component):_10"""A component that processes pandas DataFrames with various operations.""" -
Define class attributes to provide information about your custom component:
_13from typing import Any, Dict, Optional_13import pandas as pd_13from lfx.custom.custom_component.component import Component_13_13class DataFrameProcessor(Component):_13"""A component that processes pandas DataFrames with various operations."""_13_13display_name: str = "DataFrame Processor"_13description: str = "Process and transform pandas DataFrames with various operations like filtering, sorting, and aggregation."_13documentation: str = "https://docs.skillflaw.com/components-dataframe-processor"_13icon: str = "DataframeIcon"_13priority: int = 100_13name: str = "dataframe_processor"display_name: A user-friendly name shown in the visual editor.description: A brief description of what your component does.documentation: A link to detailed documentation.icon: An emoji or icon identifier for visual representation. SkillFlaw uses Lucide for icons. To assign an icon to your component, set the icon attribute to the name of a Lucide icon as a string, such asicon = "file-text". SkillFlaw renders icons from the Lucide library automatically. For more information, see Contributing bundles.priority: An optional integer to control display order. Lower numbers appear first.name: An optional internal identifier that defaults to class name.
-
Define the component's interface by specifying its inputs, outputs, and the method that will process them. The method name must match the
methodfield in your outputs list, as this is how SkillFlaw knows which method to call to generate each output.This example creates a minimal custom component skeleton.
_21from typing import Any, Dict, Optional_21import pandas as pd_21from lfx.custom.custom_component.component import Component_21_21class DataFrameProcessor(Component):_21"""A component that processes pandas DataFrames with various operations."""_21_21display_name: str = "DataFrame Processor"_21description: str = "Process and transform pandas DataFrames with various operations like filtering, sorting, and aggregation."_21documentation: str = "https://docs.skillflaw.com/components-dataframe-processor"_21icon: str = "DataframeIcon"_21priority: int = 100_21name: str = "dataframe_processor"_21_21# input and output lists_21inputs = []_21outputs = []_21_21# method_21def some_output_method(self):_21return ...
After creating the component:
- Save the implementation under
src/lfx/src/lfx/components/in the correct category. - Export the component from that category's
__init__.py. - Add any new dependencies to
pyproject.toml. - Add or update documentation under
docs/docs/Components/. - Submit the change as a pull request.
Best practices for modifying components
Keep class names and name stable
Renaming a component's class or name can break existing flows.
Prefer these approaches:
- change only the display name if the internal identity should remain stable
- create a new component if the semantics truly changed
- mark the old component as legacy when needed
Don't remove fields and outputs casually
Removing fields or outputs can disconnect edges and alter saved flows.
Prefer to:
- mark fields as deprecated
- keep them in place when possible
- document any migration path if a breaking removal is unavoidable
Preserve backward compatibility
When a behavior change cannot stay backward compatible, create a new component instead of mutating the existing one beyond recognition.
Favor asynchronous I/O
When interacting with files or external systems, prefer async-friendly APIs such as aiofile and anyio.Path where the surrounding implementation supports them.
Include tests
Add tests for component behavior and output contracts. For more guidance, see Contribute component tests.
Document user impact in the PR
In your pull request, clearly describe:
- what changed
- why it changed
- the impact on existing users
- any migration or compatibility notes
Example PR checklist
- Create or update the component.
- Add or update tests.
- Preserve compatibility for fields and outputs where possible.
- Update the relevant docs.
- Explain the change clearly in the PR description.