MR
Mayur Rathi
@github
⭐ 34.1k GitHub stars

Pcf-Code-Components

Pcf-Code-Components是一款code方向的AI技能,核心价值是Understanding code components structure and implementation,可用于解决开发者在code领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。

Understanding code components structure and implementation

Last verified on: 2026-05-30
mkdir -p ./skills/pcf-code-components && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/pcf-code-components/SKILL.md -o ./skills/pcf-code-components/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# 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

🎯 Best For

  • Claude users
  • GitHub Copilot users
  • Software engineers
  • Development teams
  • Tech leads

💡 Use Cases

  • Code quality improvement
  • Best practice enforcement

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Pcf-Code-Components to Your Work

    Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.

  4. 4

    Review and Refine

    Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.

❓ Frequently Asked Questions

Is Pcf-Code-Components compatible with Cursor and VS Code?

Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.

Do I need specific dependencies for Pcf-Code-Components?

Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.

How do I install Pcf-Code-Components?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/pcf-code-components/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Skipping validation

Always test AI-generated code changes, even for simple refactors.

Missing dependency updates

Check if the skill requires updated dependencies or new packages.

🔗 Related Skills