---
schema_version: "1"
id: 2544bfc904534405ef8827a0751811e12ca7c779bc0f2dc6a9dbb7f492b18e74
title: Use Libraries
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfcliplugin/guides/code/use-libraries.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-plugin/guide/use-libraries.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: f4ad6a9b5fb38fee7c1777ac0f411403ca8a387f4fa55a35570e413697712c75
products:
  - Salesforce CLI Plugin Developer Guide
  - salesforcedx
---
# Use Libraries

We encourage plugin developers to use existing npm libraries that already have the functionality you need. There's no reason to reinvent the wheel.

## Salesforce Libraries

Salesforce owns and maintains these npm libraries to implement common and useful functionality in your plugin.

[@salesforce/core](https://github.com/forcedotcom/sfdx-core)

The `@salesforce/core` library provides client-side management of Salesforce DX projects, org authentication, connections to Salesforce APIs, and other utilities. Much of the core functionality that powers the Salesforce CLI plugins comes from this library. You can use this functionality in your plugins too.

- `AuthInfo`, `Org`, and `Connection` classes to interact with Salesforce orgs.
- `Messages` class to work with messages in Markdown, JSON, or JavaScript.
- `ConfigFile` class to work with configuration files.
- `SfError` class to throw errors from your plugin.
- `SfProject` class to work with Salesforce project directories.
- `testSetup` utility to write unit tests.
- See [API docs](https://forcedotcom.github.io/sfdx-core/) for details.

[@salesforce/sf-plugins-core](https://github.com/salesforcecli/sf-plugins-core)

- `SfCommand` class, the base class for every `sf` command.
- Salesforce specific command flags, such as `salesforceId`, `requiredOrg`, `requiredHub`, and `optionalOrg`.
- See [API Docs](https://salesforcecli.github.io/sf-plugins-core/) for details.

[@salesforce/kit](https://forcedotcom.github.io/kit/)

- A collection of commonly needed utilities. It includes high level support for parsing and working with JSON data, interacting with environment variables, a minimal lodash replacement, and support for common design patterns.
- See [API docs](https://forcedotcom.github.io/kit/) for details.

[@salesforce/source-deploy-retrieve](https://github.com/forcedotcom/source-deploy-retrieve)

- Functionality for working with Salesforce metadata.
- See [API docs](https://forcedotcom.github.io/source-deploy-retrieve/) for details.

[@salesforce/ts-types](https://github.com/forcedotcom/ts-types)

- A collection of commonly used types and type-narrowing convenience functions for writing concise type guards.
- See [API docs](https://forcedotcom.github.io/ts-types/) for details.

[@salesforce/cli-plugins-testkit](https://github.com/salesforcecli/cli-plugins-testkit)

- Testing library that provides utilities to write NUTs (non-unit-tests), such as integration, smoke, and e2e style testing. For example, you can write tests to make sure your plugin commands execute correctly using an isolated Salesforce project, scratch org, and different Salesforce CLI executables
- See [docs](https://github.com/salesforcecli/cli-plugins-testkit#readme) and [examples](https://github.com/salesforcecli/cli-plugins-testkit/blob/main/SAMPLES.md) for details.

[@salesforce/ts-sinon](https://github.com/forcedotcom/ts-sinon)

- Library for creating test stubs with [sinon](https://sinonjs.org/).

[@oclif/core](https://github.com/oclif/core)

- The underlying framework of the entire Salesforce CLI and all its plugins.
- You don’t need to know much about this library to develop your plugin. But in case you're curious, here are the [docs](https://oclif.io/).

## Third-Party Libraries

We encourage you to use libraries written by other developers in the npm community. Be sure, however, that you do your due diligence to make sure that you're using libraries that are well-maintained by trustworthy developers.

Here are a few libraries that we recommend:

- [got](https://www.npmjs.com/package/got) to make HTTP requests.
- [graceful-fs](https://www.npmjs.com/package/graceful-fs) for resilient file system operations.
- [chalk](https://www.npmjs.com/package/chalk) to colorize output.
- [open](https://www.npmjs.com/package/open) to open URLs in a web browser.
- [change-case](https://www.npmjs.com/package/change-case) to convert strings between different cases, such as camelCase to TitleCase.
- [sinon](https://www.npmjs.com/package/sinon), [mocha](https://www.npmjs.com/package/mocha), and [chai](https://www.npmjs.com/package/chai) to test your plugin.
