> For the complete documentation index, see [llms.txt](https://docs.learncard.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.learncard.com/reference/official-plugins/vc-templates.md).

# VC Templates

Plugin for creating new credentials from basic templates

This is a plugin for simplifying useful, meaningful credentials with minimal input. Additionally, this plugin can be used as reference for[ creating your own plugin](/reference/learncard-core/writing-plugins.md) to add simple templates for creating new credentials.

### Install

```bash
bun add @learncard/vc-templates-plugin
```

### Basic Credential

The credential of type `basic` is the most simple credential, following the minimum information required by the Verifiable Credential specification.

{% code title="LearnCard CLI" %}

```typescript
// Basic Credential: with default, 'basic' template
learnCard.invoke.newCredential();
learnCard.invoke.newCredential({ type: 'basic' });
/**
{
  '@context': [ 'https://www.w3.org/2018/credentials/v1' ],
  id: 'http://example.org/credentials/3731',
  type: [ 'VerifiableCredential' ],
  issuer: 'did:key:z6MkmF9iYcGTRiHFavPPYurDNuDfYMJQR66oGrSGnfnNpPzc',
  issuanceDate: '2020-08-19T21:41:50Z',
  credentialSubject: { id: 'did:example:d23dd687a7dc6787646f2eb98d0' }
}
**/

// Basic Credential: with did, subject, and issuanceDate overloads
learnCard.invoke.newCredential({
    type: 'basic',
    did: 'did:example:123',
    subject: 'did:example:456',
    issuanceDate: '2020-08-19T21:41:50Z',
});
/**
{
  '@context': [ 'https://www.w3.org/2018/credentials/v1' ],
  id: 'http://example.org/credentials/3731',
  type: [ 'VerifiableCredential' ],
  issuer: 'did:example:123',
  issuanceDate: '2020-08-19T21:41:50Z',
  credentialSubject: { id: 'did:example:456' }
}
**/
```

{% endcode %}

### Achievement Credential:

{% code title="LearnCard CLI" %}

```typescript
// Achievement Credential: with default, 'achievement' template
learnCard.invoke.newCredential({ type: 'achievement' });
/**
{
  '@context': [
    'https://www.w3.org/2018/credentials/v1',
    'https://imsglobal.github.io/openbadges-specification/context.json'
  ],
  id: 'http://example.com/credentials/3527',
  type: [ 'VerifiableCredential', 'OpenBadgeCredential' ],
  issuer: 'did:key:z6MkmF9iYcGTRiHFavPPYurDNuDfYMJQR66oGrSGnfnNpPzc',
  issuanceDate: '2020-08-19T21:41:50Z',
  name: 'Teamwork Badge',
  credentialSubject: {
    id: 'did:example:d23dd687a7dc6787646f2eb98d0',
    type: [ 'AchievementSubject' ],
    achievement: {
      id: 'https://example.com/achievements/21st-century-skills/teamwork',
      type: [Array],
      criteria: [Object],
      description: 'This badge recognizes the development of the capacity to collaborate within a group environment.',
      name: 'Teamwork'
    }
  }
}
**/

// Achievement Credential: with overloads
learnCard.invoke.newCredential({
    type: 'achievement',
    did: 'did:example:123',
    subject: 'did:example:456',
    name: 'Singing Badge',
    achievementName: 'Beautiful Singing',
    description: 'This badge recognizes beautiful singing.',
    criteriaNarrative:
        'Group members earn this badge when they sing a beautiful song at Karaoke night.',
    issuanceDate: '2020-08-19T21:41:50Z',
});
/**
{
  '@context': [
    'https://www.w3.org/2018/credentials/v1',
    'https://imsglobal.github.io/openbadges-specification/context.json'
  ],
  id: 'http://example.com/credentials/3527',
  type: [ 'VerifiableCredential', 'OpenBadgeCredential' ],
  issuer: 'did:example:123',
  issuanceDate: '2020-08-19T21:41:50Z',
  name: 'Singing Badge',
  credentialSubject: {
    id: 'did:example:456',
    type: [ 'AchievementSubject' ],
    achievement: {
      id: 'https://example.com/achievements/21st-century-skills/teamwork',
      type: [Array],
      criteria: [Object],
      description: 'This badge recognizes beautiful singing.',
      name: 'Beautiful Singing'
    }
  }
}
**/
```

{% endcode %}

### Other Types

{% hint style="info" %}
Have a credential type you'd like to see as a template? [Request it on the roadmap](https://roadmap.learncard.com) so others can vote for it too.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.learncard.com/reference/official-plugins/vc-templates.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
