pcf-code-components
Understanding code components structure and implementation Triggers on: **/*.{ts,tsx,js,json,xml,pcfproj,csproj}
Best use case
pcf-code-components is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Understanding code components structure and implementation Triggers on: **/*.{ts,tsx,js,json,xml,pcfproj,csproj}
Teams using pcf-code-components should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/pcf-code-components/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How pcf-code-components Compares
| Feature / Agent | pcf-code-components | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Understanding code components structure and implementation Triggers on: **/*.{ts,tsx,js,json,xml,pcfproj,csproj}
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Code Components Code components are a type of solution component that can be included in a solution file and imported into different environments. They can be added to both model-driven and canvas apps. ## Three Core Elements Code components consist of three elements: 1. **Manifest** 2. **Component implementation** 3. **Resources** > **Note**: The definition and implementation of code components using Power Apps component framework is the same for both model-driven and canvas apps. The only difference is the configuration part. ## Manifest The manifest is the `ControlManifest.Input.xml` metadata file that defines a component. It is an XML document that describes: - The name of the component - The kind of data that can be configured, either a `field` or a `dataset` - Any properties that can be configured in the application when the component is added - A list of resource files that the component needs ### Manifest Purpose When a user configures a code component, the data in the manifest file filters the available components so that only valid components for the context are available for configuration. The properties defined in the manifest file are rendered as configuration columns so that users can specify values. These property values are then available to the component at runtime. More information: [Manifest schema reference](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/manifest-schema-reference/) ## Component Implementation Code components are implemented using TypeScript. Each code component must include an object that implements the methods described in the code component interface. The [Power Platform CLI](https://learn.microsoft.com/en-us/power-platform/developer/cli/introduction) auto-generates an `index.ts` file with stubbed implementations using the `pac pcf init` command. ### Required Methods The component object implements these lifecycle methods: - **init** (Required) - Called when the page loads - **updateView** (Required) - Called when app data changes - **getOutputs** (Optional) - Returns values when user changes data - **destroy** (Required) - Called when the page closes ### Component Lifecycle #### Page Load When the page loads, the application creates an object using data from the manifest: ```typescript var obj = new <"namespace on manifest">.<"constructor on manifest">(); ``` Example: ```typescript var controlObj = new SampleNameSpace.LinearInputComponent(); ``` The page then initializes the component: ```typescript controlObj.init(context, notifyOutputChanged, state, container); ``` **Init Parameters:** | Parameter | Description | |-----------|-------------| | `context` | Contains all information about how the component is configured and all parameters. Access input properties via `context.parameters.<property name from manifest>`. Includes Power Apps component framework APIs. | | `notifyOutputChanged` | Alerts the framework whenever the component has new outputs ready to be retrieved asynchronously. | | `state` | Contains component data from the previous page load if explicitly stored using `setControlState` method. | | `container` | An HTML div element to which developers can append HTML elements for the UI. | #### User Changes Data When a user interacts with your component to change data, call the `notifyOutputChanged` method passed in the `init` method. The platform responds by calling the `getOutputs` method, which returns values with the changes made by the user. For a `field` component, this would typically be the new value. #### App Changes Data If the platform changes the data, it calls the `updateView` method of the component and passes the new context object as a parameter. This method should be implemented to update the values displayed in the component. #### Page Close When a user navigates away from the page, the code component loses scope and all memory allocated for objects is cleared. However, some methods (like event handlers) may stay and consume memory based on browser implementation. **Best Practices:** - Implement the `setControlState` method to store information for the next time within the same session - Implement the `destroy` method to remove cleanup code such as event handlers when the page closes ## Resources The resource node in the manifest file refers to the resources that the component requires to implement its visualization. Each code component must have a resource file to construct its visualization. The `index.ts` file generated by the tooling is a `code` resource. There must be at least 1 code resource. ### Additional Resources You can define additional resource files in the manifest: - CSS files - Image web resources - Resx web resources for localization More information: [resources element](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/manifest-schema-reference/resources) ## Related Resources - [Create and build a code component](https://learn.microsoft.com/en-us/power-apps/developer/component-framework/create-custom-controls-using-pcf) - [Learn how to package and distribute extensions using solutions](https://learn.microsoft.com/en-us/power-platform/alm/solution-concepts-alm)
Related Skills
test-cotton-components
Guide AI agents on testing Django Cotton components using django-cotton-bs5 pytest fixtures. Covers when to use cotton_render vs cotton_render_soup vs cotton_render_string vs cotton_render_string_soup, best practices for component testing, DOM assertions, context handling, and multi-component testing patterns. Use when writing or reviewing Cotton component tests.
Next.js App Router & Server Components
Build Next.js 15 applications using App Router, Server Components, Client Components, Server Actions, and streaming. Apply when creating pages, handling data fetching, implementing routes, or optimizing performance.
hig-components-system
Apple HIG guidance for system experience components: widgets, live activities, notifications, complications, home screen quick actions, top shelf, watch faces, app clips, and app shortcuts.
hig-components-status
Apple HIG guidance for status and progress UI components including progress indicators, status bars, and activity rings.
hig-components-search
Apple HIG guidance for navigation-related components including search fields, page controls, and path controls.
hig-components-menus
Apple HIG guidance for menu and button components including menus, context menus, dock menus, edit menus, the menu bar, toolbars, action buttons, pop-up buttons, pull-down buttons, disclosure...
hig-components-layout
Apple Human Interface Guidelines for layout and navigation components.
hig-components-dialogs
Apple HIG guidance for presentation components including alerts, action sheets, popovers, sheets, and digit entry views.
hig-components-content
Apple Human Interface Guidelines for content display components.
assembling-components
Assembles component outputs from AI Design Components skills into unified, production-ready component systems with validated token integration, proper import chains, and framework-specific scaffolding. Use as the capstone skill after running theming, layout, dashboard, data-viz, or feedback skills to wire components into working React/Next.js, Python, or Rust projects.
architecting-components
Defines rules for Atomic Design and separating logic from UI. Use when creating new components in the src directory.
App Components
Your approach to handling app components. Use this skill when working on files where app components comes into play.