|
| 1 | +# Contributing to Arcjet Plugin |
| 2 | + |
| 3 | +Thanks for your interest in contributing to the Arcjet plugin for AI coding agents. |
| 4 | + |
| 5 | +## Plugin Specification |
| 6 | + |
| 7 | +This plugin follows the [Open Plugins Specification v1.0.0](https://open-plugins.com/plugin-builders/specification). Key structural requirements: |
| 8 | + |
| 9 | +- **Manifest** at `.plugin/plugin.json` — must include `name`, `version`, `description`, `author`, `license`, and `logo` |
| 10 | +- **Rules** in `rules/` as `.mdc` files with YAML frontmatter (`description`, `globs`, `alwaysApply`) |
| 11 | +- **Skills** in `skills/<name>/SKILL.md` with YAML frontmatter (`name`, `description`) |
| 12 | +- **Agents** in `agents/` as `.md` files with YAML frontmatter (`name`, `description`) |
| 13 | +- **MCP servers** in `.mcp.json` at the repo root |
| 14 | +- **Assets** in `assets/` (logo, etc.) |
| 15 | + |
| 16 | +## Directory Structure |
| 17 | + |
| 18 | +``` |
| 19 | +.plugin/plugin.json # Plugin manifest |
| 20 | +rules/*.mdc # Auto-activated coding guidance |
| 21 | +skills/*/SKILL.md # Task-oriented workflows |
| 22 | +agents/*.md # Agent definitions |
| 23 | +.mcp.json # MCP server configuration |
| 24 | +scripts/ # Tooling (validation, etc.) |
| 25 | +assets/ # Static assets |
| 26 | +``` |
| 27 | + |
| 28 | +## Development Setup |
| 29 | + |
| 30 | +Open this repo in a devcontainer (VS Code or GitHub Codespaces) — it installs all tooling automatically. Alternatively, install [dprint](https://dprint.dev/) manually. |
| 31 | + |
| 32 | +## Formatting |
| 33 | + |
| 34 | +All JSON, Markdown, and `.mdc` files are formatted with [dprint](https://dprint.dev/): |
| 35 | + |
| 36 | +```bash |
| 37 | +dprint fmt # Format all files |
| 38 | +dprint check # Check without modifying (used in CI) |
| 39 | +``` |
| 40 | + |
| 41 | +Configuration is in `dprint.json`. |
| 42 | + |
| 43 | +## Validation |
| 44 | + |
| 45 | +Run the structural validation script before submitting changes: |
| 46 | + |
| 47 | +```bash |
| 48 | +bash scripts/validate.sh |
| 49 | +``` |
| 50 | + |
| 51 | +This checks: |
| 52 | + |
| 53 | +- JSON files are valid |
| 54 | +- `plugin.json` has all required fields and valid semver |
| 55 | +- Skills have `SKILL.md` with `name` and `description` frontmatter |
| 56 | +- Rules have `.mdc` files with `description` and `globs` frontmatter |
| 57 | +- Agents have `.md` files with `name` and `description` frontmatter |
| 58 | +- `.mcp.json` defines at least one server with a `url` or `command` |
| 59 | + |
| 60 | +## Adding a Rule |
| 61 | + |
| 62 | +1. Create `rules/<name>.mdc` with frontmatter: |
| 63 | + |
| 64 | + ```yaml |
| 65 | + --- |
| 66 | + description: What this rule provides |
| 67 | + alwaysApply: false |
| 68 | + globs: |
| 69 | + - "**/<pattern>" |
| 70 | + --- |
| 71 | + ``` |
| 72 | + |
| 73 | +2. Write concise, opinionated guidance in the body. Include a `Ref:` link to relevant docs. |
| 74 | +3. Run `bash scripts/validate.sh` and `dprint check`. |
| 75 | + |
| 76 | +## Adding a Skill |
| 77 | + |
| 78 | +1. Create `skills/<name>/SKILL.md` with frontmatter: |
| 79 | + |
| 80 | + ```yaml |
| 81 | + --- |
| 82 | + name: skill-name |
| 83 | + license: Apache-2.0 |
| 84 | + description: What this skill does and when to use it |
| 85 | + metadata: |
| 86 | + pathPatterns: |
| 87 | + - "relevant/**/globs" |
| 88 | + importPatterns: |
| 89 | + - "relevant-package" |
| 90 | + promptSignals: |
| 91 | + phrases: |
| 92 | + - "trigger phrase" |
| 93 | + --- |
| 94 | + ``` |
| 95 | + |
| 96 | +2. Write step-by-step instructions in the body. Skills should be self-contained — the agent follows them without prior context. |
| 97 | +3. Run `bash scripts/validate.sh` and `dprint check`. |
| 98 | + |
| 99 | +## Adding an Agent |
| 100 | + |
| 101 | +1. Create `agents/<name>.md` with frontmatter: |
| 102 | + |
| 103 | + ```yaml |
| 104 | + --- |
| 105 | + name: agent-name |
| 106 | + description: What this agent does |
| 107 | + --- |
| 108 | + ``` |
| 109 | + |
| 110 | +2. Define the agent's role, capabilities, workflow, and output format in the body. |
| 111 | +3. Run `bash scripts/validate.sh` and `dprint check`. |
| 112 | + |
| 113 | +## CI |
| 114 | + |
| 115 | +Pull requests run two checks (see `.github/workflows/lint.yml`): |
| 116 | + |
| 117 | +- **dprint format check** — ensures all files are formatted |
| 118 | +- **Plugin structure validation** — runs `scripts/validate.sh` |
| 119 | + |
| 120 | +Both must pass before merging. |
| 121 | + |
| 122 | +## Guidelines |
| 123 | + |
| 124 | +- Keep rule and skill content concise and opinionated — agents work better with clear directives than hedged suggestions |
| 125 | +- Always include `Ref: https://docs.arcjet.com/llms.txt` in rules so agents can fetch full docs when needed |
| 126 | +- Test skills by running them in an AI coding agent against a real project e.g. `claude --plugin-dir ./arcjet-plugin` |
| 127 | +- Start new protection rules in `DRY_RUN` mode guidance — never suggest `LIVE` as a default |
| 128 | + |
| 129 | +## License |
| 130 | + |
| 131 | +By contributing, you agree that your contributions will be licensed under the [Apache License 2.0](LICENSE). |
0 commit comments