Skip to content

Commit e39d9be

Browse files
Last9 AI Toolkit — skills and plugins for AI coding agents
Skills that teach coding agents (Claude Code, Codex, Cursor, skills.sh) how to investigate production systems with Last9: last9-logs and last9-traces, plus the marketplace plugin package and CI guardrails. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0 parents  commit e39d9be

18 files changed

Lines changed: 1023 additions & 0 deletions

File tree

.agents/plugins/marketplace.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "last9-ai-toolkit",
3+
"interface": {
4+
"displayName": "Last9 AI Toolkit"
5+
},
6+
"plugins": [
7+
{
8+
"name": "last9",
9+
"source": {
10+
"source": "local",
11+
"path": "./plugins/last9"
12+
},
13+
"policy": {
14+
"installation": "AVAILABLE",
15+
"authentication": "ON_INSTALL"
16+
},
17+
"category": "Coding"
18+
}
19+
]
20+
}

.claude-plugin/marketplace.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
3+
"name": "last9-ai-toolkit",
4+
"description": "Last9 AI Toolkit plugin marketplace for Claude Code.",
5+
"owner": {
6+
"name": "Last9",
7+
"url": "https://last9.io"
8+
},
9+
"plugins": [
10+
{
11+
"name": "last9",
12+
"description": "Use Last9 observability workflows from Claude Code through the hosted Last9 MCP server.",
13+
"source": "./plugins/last9",
14+
"category": "coding"
15+
}
16+
]
17+
}
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
name: OSS guardrails
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
# Tier 1a: secret scanning. Runs on every PR including forks (no secrets needed).
14+
secret-scan:
15+
name: Secret scan (gitleaks)
16+
runs-on: ubuntu-latest
17+
env:
18+
GITLEAKS_VERSION: "8.21.2"
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
# Full history so gitleaks scans the entire PR commit range,
23+
# not just the head commit (default shallow checkout).
24+
fetch-depth: 0
25+
26+
- name: Run gitleaks
27+
env:
28+
# sha256 of gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz from the
29+
# release's published checksums file. Update together with the version.
30+
GITLEAKS_SHA256: "5bc41815076e6ed6ef8fbecc9d9b75bcae31f39029ceb55da08086315316e3ba"
31+
run: |
32+
curl -sSfL -o gitleaks.tar.gz \
33+
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz"
34+
echo "${GITLEAKS_SHA256} gitleaks.tar.gz" | sha256sum -c -
35+
tar -xzf gitleaks.tar.gz gitleaks
36+
# git-mode (default): scans tracked content and history only.
37+
# Never use --no-git: it would read gitignored local dirs.
38+
# --redact: matched secret content never appears in public CI logs.
39+
./gitleaks detect --source . --redact --no-banner --verbose
40+
41+
# Tier 1b: structural reference checks. Generic patterns, safe to publish,
42+
# no secrets needed — runs on every PR including forks.
43+
structural-scan:
44+
name: Structural reference scan
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v4
48+
49+
- name: Scan tracked files for forbidden reference shapes
50+
run: |
51+
set -u
52+
violations=0
53+
54+
scan() {
55+
local label="$1" pattern="$2"
56+
local matches rc=0
57+
# Tracked files only; exclude this workflow (it defines the patterns).
58+
matches=$(git grep -nIE "$pattern" -- . ':(exclude).github/workflows/oss-guardrails.yml') || rc=$?
59+
if [ "$rc" -gt 1 ]; then
60+
# Fail closed: a grep hard error must not pass as "no match".
61+
echo "::error::git grep failed (exit ${rc}) while scanning for: ${label}"
62+
violations=1
63+
elif [ "$rc" -eq 0 ]; then
64+
echo "::error::Forbidden reference shape: ${label}"
65+
# file:line only
66+
echo "${matches}" | cut -d: -f1,2
67+
violations=1
68+
fi
69+
}
70+
71+
# Real org slug in an MCP URL — only the <org-slug> placeholder is allowed.
72+
scan "real org slug in MCP URL (use <org-slug>)" 'organizations/[A-Za-z0-9_-]+/mcp'
73+
74+
# Internal source-path citations (e.g. internal/foo/bar.go).
75+
scan "internal source-path citation" 'internal/[A-Za-z0-9_-]+(/[A-Za-z0-9_.-]+)+\.[A-Za-z]+'
76+
77+
# Bare commit-SHA citation shape (e.g. "file.md @ 1a2b3c4").
78+
scan "bare commit-SHA citation" '@ [0-9a-f]{7,40}([^A-Za-z0-9]|$)'
79+
80+
exit "${violations}"
81+
82+
# Tier 2: forbidden-term scan against a private denylist.
83+
# The denylist lives in the FORBIDDEN_TERMS secret (newline-separated) because
84+
# the list itself is sensitive and must never be committed.
85+
# GitHub does not expose secrets to fork-PR workflows, so this job is skipped
86+
# on fork PRs (visible as skipped) and re-runs on the merge push to master.
87+
# Maintainers run it manually against fork-PR heads before merging.
88+
forbidden-terms:
89+
name: Forbidden terms (denylist — skipped on fork PRs, runs on merge)
90+
runs-on: ubuntu-latest
91+
if: >-
92+
github.event_name == 'push' ||
93+
(github.event_name == 'pull_request' &&
94+
github.event.pull_request.head.repo.full_name == github.repository)
95+
env:
96+
FORBIDDEN_TERMS: ${{ secrets.FORBIDDEN_TERMS }}
97+
steps:
98+
- uses: actions/checkout@v4
99+
100+
- name: Scan tracked files against denylist
101+
run: |
102+
set -u
103+
# Fail loud on absent/empty secret — an empty pattern list would
104+
# silently match nothing and pass the check without scanning.
105+
# Normalize the secret: strip CR (a CRLF-pasted secret would embed
106+
# \r in every pattern and silently match nothing), trim per-line
107+
# whitespace, drop empty lines.
108+
printf '%s\n' "${FORBIDDEN_TERMS}" \
109+
| tr -d '\r' \
110+
| sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e '/^[[:space:]]*$/d' \
111+
> "${RUNNER_TEMP}/terms.txt"
112+
113+
if [ ! -s "${RUNNER_TEMP}/terms.txt" ]; then
114+
echo "::error::FORBIDDEN_TERMS secret is unset, empty, or contains no usable terms after normalization. Failing loud — refusing to skip the scan silently."
115+
exit 1
116+
fi
117+
118+
# Single git grep pass — tracked files only by construction, and
119+
# exit codes are unambiguous (0 match, 1 no match, >1 error).
120+
rc=0
121+
raw=$(git grep -nIiF -f "${RUNNER_TEMP}/terms.txt") || rc=$?
122+
123+
if [ "$rc" -gt 1 ]; then
124+
# Fail closed: a grep hard error must not pass as "no match".
125+
echo "::error::git grep failed (exit ${rc}) during the denylist scan."
126+
exit 1
127+
elif [ "$rc" -eq 0 ]; then
128+
# Report file:line only — never the matched content, which would
129+
# echo a forbidden term into publicly readable logs.
130+
echo "::error::Forbidden term(s) found at the following file:line locations (content withheld):"
131+
printf '%s\n' "${raw}" | cut -d: -f1,2
132+
exit 1
133+
fi
134+
135+
# Sync parity: packaged plugin skills must match canonical skills/.
136+
# No path filter — this job must report a status on every PR so it can be a
137+
# required check without deadlocking docs-only PRs (a path-filtered required
138+
# check never reports and leaves the PR perpetually pending).
139+
sync-parity:
140+
name: Plugin skill sync parity
141+
runs-on: ubuntu-latest
142+
steps:
143+
- uses: actions/checkout@v4
144+
145+
- name: Verify packaged plugin skills are synced
146+
run: |
147+
scripts/sync-agent-plugin-skills.sh
148+
# status --porcelain covers modified AND untracked files, so a sync
149+
# that creates a new packaged skill file also fails parity until
150+
# the file is committed (git diff --exit-code misses untracked).
151+
drift=$(git status --porcelain -- plugins/last9/skills)
152+
if [ -n "${drift}" ]; then
153+
echo "::error::Packaged plugin skills are out of sync with skills/:"
154+
echo "${drift}"
155+
exit 1
156+
fi

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Internal planning artifacts — not for the public repo
2+
docs/
3+
4+
# Local agent state
5+
.claude/
6+
.codex/

.gitleaks.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# gitleaks configuration for ai-toolkit.
2+
# Extends the default ruleset; allowlists the placeholder credential shapes
3+
# this repo deliberately documents (install instructions, skill examples).
4+
5+
[extend]
6+
useDefault = true
7+
8+
[allowlist]
9+
description = "Documented placeholder credentials and template variables"
10+
regexes = [
11+
'''<org-slug>''',
12+
'''<your-api-key>''',
13+
'''<base64-credentials>''',
14+
'''\$\{env:[A-Za-z_]+\}''',
15+
]

CODE_OF_CONDUCT.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
2+
# Contributor Covenant Code of Conduct
3+
4+
## Our Pledge
5+
6+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
7+
8+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
9+
10+
## Our Standards
11+
12+
Examples of behavior that contributes to a positive environment for our community include:
13+
14+
* Demonstrating empathy and kindness toward other people
15+
* Being respectful of differing opinions, viewpoints, and experiences
16+
* Giving and gracefully accepting constructive feedback
17+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
18+
* Focusing on what is best not just for us as individuals, but for the overall community
19+
20+
Examples of unacceptable behavior include:
21+
22+
* The use of sexualized language or imagery, and sexual attention or advances of any kind
23+
* Trolling, insulting or derogatory comments, and personal or political attacks
24+
* Public or private harassment
25+
* Publishing others' private information, such as a physical or email address, without their explicit permission
26+
* Other conduct which could reasonably be considered inappropriate in a professional setting
27+
28+
## Enforcement Responsibilities
29+
30+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
31+
32+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
33+
34+
## Scope
35+
36+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
37+
38+
## Enforcement
39+
40+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at security@last9.io. All complaints will be reviewed and investigated promptly and fairly.
41+
42+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
43+
44+
## Enforcement Guidelines
45+
46+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
47+
48+
### 1. Correction
49+
50+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
51+
52+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
53+
54+
### 2. Warning
55+
56+
**Community Impact**: A violation through a single incident or series of actions.
57+
58+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
59+
60+
### 3. Temporary Ban
61+
62+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
63+
64+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
65+
66+
### 4. Permanent Ban
67+
68+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
69+
70+
**Consequence**: A permanent ban from any sort of public interaction within the community.
71+
72+
## Attribution
73+
74+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
75+
76+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
77+
78+
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
79+
80+
[homepage]: https://www.contributor-covenant.org
81+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
82+
[Mozilla CoC]: https://github.com/mozilla/diversity
83+
[FAQ]: https://www.contributor-covenant.org/faq
84+
[translations]: https://www.contributor-covenant.org/translations
85+

CONTRIBUTING.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Contributing to Last9 AI Toolkit
2+
3+
Thanks for contributing! This repo ships AI-agent skills and plugin packages for Claude Code, Cursor, OpenAI Codex, and skills.sh.
4+
5+
## The canonical-source model
6+
7+
The top-level `skills/` directory is the **single source of truth**. The plugin package copies under `plugins/last9/skills/` are **generated** — never edit them directly.
8+
9+
When you change a skill:
10+
11+
1. Edit the skill under `skills/<skill-name>/SKILL.md`.
12+
2. Run the sync script:
13+
14+
```shell
15+
scripts/sync-agent-plugin-skills.sh
16+
```
17+
18+
3. Commit both the canonical file and the regenerated plugin copy together.
19+
20+
CI enforces parity: if the generated copies drift from `skills/`, the sync-parity check fails your PR.
21+
22+
## Commit convention
23+
24+
Use [Conventional Commits](https://www.conventionalcommits.org/): `feat:`, `fix:`, `docs:`, `chore:`, `refactor:`, optionally scoped (e.g., `feat(skills): ...`).
25+
26+
## CI checks on your PR
27+
28+
Every PR runs:
29+
30+
- **Secret scan** (gitleaks) — blocks credentials, tokens, and key-shaped strings. Documented placeholders like `<org-slug>` and `<your-api-key>` are allowlisted.
31+
- **Structural reference scan** — blocks real org slugs (use `<org-slug>`), internal source-path citations, and bare commit-SHA citations.
32+
- **Sync parity** — verifies `plugins/last9/skills/` matches `skills/`.
33+
34+
### A note for fork PRs
35+
36+
One additional scan (a forbidden-term check against a private denylist) cannot run on PRs from forks — GitHub does not expose repository secrets to fork workflows. On fork PRs that check reports a visible "skipped — runs on merge" status, and a maintainer runs it manually against your branch before merging. A green checkmark on a fork PR therefore does not by itself mean every check has passed — this is a GitHub platform limitation, not something you need to act on.
37+
38+
## Adding a new skill
39+
40+
- Directory name must equal the `name:` field in the SKILL.md frontmatter (the sync script enforces this).
41+
- Follow the existing SKILL.md structure: YAML frontmatter (`name`, `description` with explicit trigger phrases, `compatibility`, `metadata.author`), operating principle, prerequisites, guardrail/anti-pattern table, methodology, reference card, related-skills cross-reference.
42+
- Cite only public sources in verification notes — no internal file paths, no private commit SHAs.
43+
44+
## What not to include
45+
46+
- Secrets, tokens, API keys, credentials — use placeholders (`<your-api-key>`, `${env:SECRET}`).
47+
- Real organization slugs in URLs — use `<org-slug>`.
48+
- Internal Last9 implementation details, internal repo names, or customer names.
49+
- Binary files.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Last9
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)