---
schema_version: "1"
id: 4a50ebd9e3117db6aaf026359d2238e4f04c071ab4360fe78ba49d9c3b4c6d38
title: Developing Custom Policies
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/pdk/1.7/policies-pdk-develop-custom-policies.md
canonical_url: https://docs.mulesoft.com/pdk/1.7/policies-pdk-develop-custom-policies
source_site: docs.mulesoft.com
content_type: documentation
content_hash: cdb034e019623086565e30f102666eb75267e3713755a9939efc5917e8039f6c
description: MuleSoft Documentation Site
release: "1.7"
latest: false
---
---
product: Omni Gateway Policy Development Kit (PDK)
version: 1.7
---

# Developing Custom Policies

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

After installing the [Prerequisites](https://docs.mulesoft.com/pdk/1.7/policies-pdk-prerequisites), you can develop custom policies by
using Flex Gateway Policy Development Kit (PDK).

The custom policy lifecycle consists of all the steps of developing a custom policy that occur in
PDK. The following steps do not include steps that occur outside of PDK, such as
[applying a policy](https://docs.mulesoft.com/pdk/1.7/policies-pdk-apply-policies), which is the same for all Flex Gateway policies.

After you [create a new project](https://docs.mulesoft.com/pdk/1.7/policies-pdk-create-project), you might iteratively complete some
steps. For example, while writing the policy’s source code, you might need to return to
[add additional parameters](https://docs.mulesoft.com/pdk/1.7/policies-pdk-create-schema-definition), or you might need to recompile
the policy after debugging the source code.

To create a custom policy with PDK, follow these steps:

1.  [Create a new project](https://docs.mulesoft.com/pdk/1.7/policies-pdk-create-project-overview).

2.  [Define a schema definition](https://docs.mulesoft.com/pdk/1.7/policies-pdk-create-schema-definition).

    Modify the `definition/gcl.yaml` file to define metadata and configuration parameters for your
    custom policy.

3.  [Configure custom policy features in Rust](https://docs.mulesoft.com/pdk/1.7/policies-pdk-configure-features).

    Use the rust code examples to implement your custom logic in the `src/lib.rs` file.

4.  [Compile your custom policy](https://docs.mulesoft.com/pdk/1.7/policies-pdk-compile-policies).

    Compiling your policy creates the `WebAssembly` binary file and configuration files necessary to
    upload your policy to Exchange and deploy it to a Flex Gateway.

5.  [Debug Your Policy with the PDK Debugging Playground](https://docs.mulesoft.com/pdk/1.7/policies-pdk-debug-local).

    Use the playground provided with PDK to debug the functionality of your custom policy locally.

6.  [Write Integration Tests](https://docs.mulesoft.com/pdk/1.7/policies-pdk-integration-tests).

    Write intergration tests to ensure your custom policy is compatible with your other services and
    to ensure that each new policy version does not introduce regression errors.

7.  [Publish your policy on Exchange](https://docs.mulesoft.com/pdk/1.7/policies-pdk-publish-policies-overview).

    Publish your policy on Exchange to distribute a development version of your policy for testing
    with your Flex Gateway configuration and to release production-ready policies. To deploy a
    policy to Flex Gateway, see step eight.

8.  Deploy your custom policy to a production environment by
    [applying it to an API instance](https://docs.mulesoft.com/pdk/1.7/policies-pdk-apply-policies) deployed on Flex Gateway.

9.  Configure a new version of this API instance by returning to step two.
