anchor.diff:  git init
   ```
   
  -### Add a plugin.yml
  -
  -Next we'll create `plugin.yml` to describes how the plugin appears in the [Buildkite Plugin Directory](/docs/plugins/directory).
  +## Add a plugin.yml
  +
  +Next we'll create `plugin.yml` to describes how the plugin appears in the [Buildkite Plugin Directory](/docs/plugins/directory), what it requires, and what configuration options it accepts.
   
   ```yaml
   name: File Counter
  
positive.code: ```
  {: codeblock-file="pipeline.yml"}
  
  ### Create a new git repository
  
  Every Buildkite plugin is a Git repository, ending in `-buildkite-plugin`. Let's create a new Git repository following these naming conventions:
  
  
negative.code: docker-compose run --rm lint
  ```
  
  ## Add a hook
  
  Plugins can implement a number of [plugin hooks](/docs/agent/v3/hooks). For this plugin, we’ll create a `post-command` hook in a `hooks` directory:
  
  ```shell
  mkdir hooks
  touch hooks/post-command
  chmod +x hooks/post-command
  ```
  
  ```shell
  #!/bin/bash
  set -euo pipefail
  
  PATTERN="$BUILDKITE_PLUGIN_FILE_COUNTER_PATTERN"
  
  echo "--- \:1234\: Counting the number of files"
  
  COUNT=$(find . -name "$PATTERN" | wc -l)
  
  echo "Found ${COUNT} files matching ${PATTERN}"
  
  buildkite-agent annotate "Found ${COUNT} files matching ${PATTERN}"
  ```
    {: codeblock-file="hooks/post-command"}
  
  ## Add a test
  
  Next step is to test the `post-command` hook using BATS, and the `buildkite/plugin-tester` Docker image.
  
  ```shell
  mkdir tests
  touch tests/post-command.bats
  chmod +x tests/post-command.bats
  ```
  
  Create the following `tests/post-command.bats` file:
  
  ```shell
  #!/usr/bin/env bats
  
  load '/usr/local/lib/bats/load.bash'
  
  # Uncomment the following line to debug stub failures
  # export BUILDKITE_AGENT_STUB_DEBUG=/dev/tty
  
  @test "Creates an annotation with the file count" {
    export BUILDKITE_PLUGIN_FILE_COUNTER_PATTERN="*.bats"
  
    stub buildkite-agent 'annotate "Found 1 files matching *.bats" : echo Annotation created'
  
    run "$PWD/hooks/post-command"
  
    assert_success
    assert_output --partial "Found 1 files matching *.bats"
    assert_output --partial "Annotation created"
  
    unstub buildkite-agent
  }
  ```
  {: codeblock-file="tests/post-command.bats"}
  
  
  To run the test, run the following Docker command:
  
  ```shell
  docker run -it --rm -v "$(PWD):/plugin:ro" buildkite/plugin-tester
  ```
  
  ```
   ✓ Creates an annotation with the file count
  
  1 test, 0 failures
  ```
  
  To make it easier to run this command, create a Docker Compose file:
  
  ```yml
  version: '2'
  services:
    tests:
      image: buildkite/plugin-tester
      volumes:
        - ".:/plugin:ro"
  ```
  {: codeblock-file="docker-compose.yml"}
  
  You can now run the tests using the following command:
  
  ```shell
  docker-compose run --rm tests
  ```
  
  ## Add a readme
  
  Next we'll add a `README.md` file to introduce the plugin to the world:
  
  <%= render 'plugins/tutorial_readme' %>
  
  ## Publish to the directory
  
  To add your plugin to the [Buildkite Plugin Directory](https://buildkite.com/plugins), publish your repository to a public GitHub repository and add the `buildkite-plugin` repository topic tag. For full instructions, see the [Plugin Directory documentation](/docs/plugins/directory).