Adopt native skill discovery

This commit is contained in:
Wayner Barrios
2026-07-27 14:32:22 -04:00
parent 6e83761707
commit c753cd35ad
22 changed files with 273 additions and 1401 deletions
+22
View File
@@ -0,0 +1,22 @@
name: OpenCode smoke
on:
pull_request:
paths:
- ".opencode/**"
- "skills/**"
- "scripts/opencode-smoke.mjs"
- "package.json"
- ".github/workflows/opencode-smoke.yml"
workflow_dispatch:
jobs:
opencode-1-18-7:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "24"
- run: node scripts/opencode-smoke.mjs 1.18.7
+4 -4
View File
@@ -4,10 +4,10 @@ The repository wrapper, plugin integration, packaging, tests, and original
documentation are licensed under the root MIT `LICENSE` unless a file states
otherwise.
The skills and generated command prompts are modified derivatives of the
sources recorded in `UPSTREAMS.json`. They are not represented as original
work. Every entry records the immutable upstream commit, source path, Git blob,
license, and adaptation type reviewed for this distribution.
The skills are modified derivatives of the sources recorded in
`UPSTREAMS.json`. They are not represented as original work. Every entry
records the immutable upstream commit, source path, Git blob, license, and
adaptation type reviewed for this distribution.
## Anthropic Official Plugins
-183
View File
@@ -1,183 +0,0 @@
---
description: Audit and improve project-rules files (AGENTS.md, CLAUDE.md, .agents/instructions, local overrides) so the agent keeps accurate project context. Use when the user asks to check, audit, review, update, improve, or fix their AGENTS.md or CLAUDE.md, mentions "project rules maintenance" or "agent context optimization", or when the codebase has changed enough that the rules file may be stale. Scans the repository for every rules file, grades each against a quality rubric, outputs a quality report, and applies targeted edits only after user approval.
license: Apache-2.0 (modified; see UPSTREAMS.json)
---
# AGENTS.md / CLAUDE.md Improver
Audit, evaluate, and improve project-rules files across a codebase to ensure the agent has optimal project context.
OpenCode resolves project rules **first-match-wins per directory**: when a directory holds both `AGENTS.md` and `CLAUDE.md`, only `AGENTS.md` is loaded and the `CLAUDE.md` is never read. Resolution walks from the working directory up to the git root, takes the first match at each level, and merges those with the global `~/.config/opencode/AGENTS.md` and any paths declared in the `instructions` field of `opencode.json`. Treat `AGENTS.md` as canonical when creating new files, and report any directory that contains both files as a finding, since its `CLAUDE.md` is silently ignored.
**This skill can write to project-rules files.** After presenting a quality report and getting user approval, it updates the files with targeted improvements.
## Workflow
### Phase 1: Discovery
Find all relevant files in the repository:
```bash
find . \( -name "AGENTS.md" -o -name "CLAUDE.md" -o -name ".claude.local.md" -o -name ".agents.local.md" \) 2>/dev/null | head -50
```
**File types and locations:**
| Type | Location | Purpose |
|------|----------|---------|
| Project root (OpenCode native) | `./AGENTS.md` | Primary project context (committed, shared) |
| Project root (Claude compat) | `./CLAUDE.md` | Same purpose; OpenCode reads it as fallback |
| Local overrides | `./.agents.local.md` or `./.claude.local.md` | Personal/local settings (gitignored) |
| Global defaults | `~/.config/opencode/AGENTS.md` or `~/.claude/CLAUDE.md` | User-wide defaults |
| Package-specific | `./packages/*/AGENTS.md` | Module-level context in monorepos |
| Subdirectory | Any nested location | Feature/domain-specific context |
OpenCode walks up from the working directory toward the git root, loading any matching rules files along the way, so monorepos and nested projects work automatically.
### Phase 2: Quality assessment
For each rules file, evaluate against the criteria below.
**Quick assessment checklist:**
| Criterion | Weight | Check |
|-----------|--------|-------|
| Commands / workflows documented | High | Are build / test / deploy commands present? |
| Architecture clarity | High | Can the agent understand the codebase structure? |
| Non-obvious patterns | Medium | Are gotchas and quirks documented? |
| Conciseness | Medium | No verbose explanations or obvious info? |
| Currency | High | Does it reflect the current codebase state? |
| Actionability | High | Are instructions executable, not vague? |
**Quality scores:**
- **A (90–100)** — Comprehensive, current, actionable.
- **B (70–89)** — Good coverage, minor gaps.
- **C (50–69)** — Basic info, missing key sections.
- **D (30–49)** — Sparse or outdated.
- **F (0–29)** — Missing or severely outdated.
### Phase 3: Quality-report output
**Always output the quality report BEFORE making any updates.**
Format:
```
## Project-Rules Quality Report
### Summary
- Files found: X
- Average score: X/100
- Files needing update: X
### File-by-File Assessment
#### 1. ./AGENTS.md (Project Root)
**Score: XX/100 (Grade: X)**
| Criterion | Score | Notes |
|-----------|-------|-------|
| Commands / workflows | X/20 | ... |
| Architecture clarity | X/20 | ... |
| Non-obvious patterns | X/15 | ... |
| Conciseness | X/15 | ... |
| Currency | X/15 | ... |
| Actionability | X/15 | ... |
**Issues:**
- [List specific problems]
**Recommended additions:**
- [List what should be added]
#### 2. ./packages/api/AGENTS.md (Package-specific)
...
```
### Phase 4: Targeted updates
After the quality report, ask the user for confirmation before updating.
**Update guidelines (critical):**
1. **Propose targeted additions only.** Focus on genuinely useful info:
- Commands or workflows discovered during analysis
- Gotchas or non-obvious patterns found in code
- Package relationships that were unclear
- Testing approaches that work
- Configuration quirks
2. **Keep it minimal.** Avoid:
- Restating what is obvious from the code
- Generic best practices already covered
- One-off fixes unlikely to recur
- Verbose explanations when a one-liner suffices
3. **Show diffs.** For each change, show:
- Which file to update
- The specific addition (diff or quoted block)
- A brief explanation of why this helps future sessions
**Diff format:**
````markdown
### Update: ./AGENTS.md
**Why:** Build command was missing, causing confusion about how to run the project.
```diff
+ ## Quick Start
+
+ ```bash
+ npm install
+ npm run dev # Start development server on port 3000
+ ```
```
````
### Phase 5: Apply updates
After user approval, apply changes using the editor tool. Preserve the existing content structure; only add what was approved.
## Common issues to flag
1. **Stale commands** — build commands that no longer work.
2. **Missing dependencies** — required tools not mentioned.
3. **Outdated architecture** — file structure that has changed.
4. **Missing environment setup** — required env vars or config.
5. **Broken test commands** — test scripts that have changed.
6. **Undocumented gotchas** — non-obvious patterns not captured.
7. **Shadowed `CLAUDE.md`** — a directory that contains both `AGENTS.md` and `CLAUDE.md`. OpenCode loads only `AGENTS.md`, so the `CLAUDE.md` is silently ignored; merge its contents into `AGENTS.md` or remove it.
## What makes a great rules file
**Key principles:**
- Concise and human-readable.
- Actionable commands that can be copy-pasted.
- Project-specific patterns, not generic advice.
- Non-obvious gotchas and warnings.
**Recommended sections** (use only what is relevant):
- Commands (build, test, dev, lint)
- Architecture (directory structure)
- Key files (entry points, config)
- Code style (project conventions)
- Environment (required vars, setup)
- Testing (commands, patterns)
- Gotchas (quirks, common mistakes)
- Workflow (when to do what)
## Tips to share with the user
- **Keep it concise** — the rules file is part of the prompt, so brevity matters. Dense is better than verbose.
- **Actionable commands** — all documented commands should be copy-paste ready.
- **Use a `.local` override** — for personal preferences not shared with the team (add to `.gitignore`).
- **Global defaults** — put user-wide preferences in `~/.config/opencode/AGENTS.md` (or `~/.claude/CLAUDE.md`).
- **Prefer `AGENTS.md`.** Use `AGENTS.md` for new rules files: OpenCode reads it natively and Claude Code reads it as a fallback. Do not add an `AGENTS.md` alongside an existing `CLAUDE.md` — under first-match-wins, OpenCode would load only the `AGENTS.md` and ignore the `CLAUDE.md` entirely. Either keep maintaining the `CLAUDE.md` in place, or migrate its contents into `AGENTS.md` and remove it.
---
**User arguments:** $ARGUMENTS
-97
View File
@@ -1,97 +0,0 @@
---
description: Capture learnings from the current session into the project-rules file (AGENTS.md, CLAUDE.md, or local override) so future sessions benefit. Use when the user says "revise the rules", "update AGENTS.md / CLAUDE.md with what we just learned", "save this to project memory", "remember this for next time", or at the end of a productive session when valuable context has emerged that is not yet documented. This is the COMPLEMENT to agents-md-improver: improver audits, this one captures.
license: Apache-2.0 (modified; see UPSTREAMS.json)
---
# AGENTS.md / CLAUDE.md Revise
Review the current session for learnings about working in this codebase, then update the project-rules file with context that would help future sessions be more effective.
OpenCode resolves project rules first-match-wins per directory: if a directory holds both `AGENTS.md` and `CLAUDE.md`, only `AGENTS.md` is loaded and the `CLAUDE.md` is never read. When capturing learnings, prefer `AGENTS.md` for a new file; if both already exist in the same directory, write to `AGENTS.md` — never into the shadowed `CLAUDE.md`, or the notes land in a file OpenCode ignores. If only `CLAUDE.md` exists, update it in place (and consider migrating it to `AGENTS.md`).
## Step 1 — Reflect
Look back over the session and identify what context was missing that would have helped the agent work more effectively. Examples:
- Bash commands that were used or discovered
- Code-style patterns followed
- Testing approaches that worked
- Environment / configuration quirks
- Warnings or gotchas encountered
- Build steps that surprised you
- Tool versions that mattered
- Project-specific conventions that took time to figure out
Be selective. Only capture things that:
1. Will recur in future sessions (not one-off fixes).
2. Would have saved time if known up front.
3. Cannot be derived by reading the code.
## Step 2 — Find rules files
```bash
find . \( -name "AGENTS.md" -o -name "CLAUDE.md" -o -name ".agents.local.md" -o -name ".claude.local.md" \) 2>/dev/null | head -20
```
Decide where each addition belongs:
- **`AGENTS.md` / `CLAUDE.md`** — team-shared, committed to git. Use for project-wide conventions, build commands, architectural notes.
- **`.agents.local.md` / `.claude.local.md`** — personal / local only, gitignored. Use for personal preferences that should not affect teammates.
If both `AGENTS.md` and `CLAUDE.md` exist in the same directory, target `AGENTS.md` — OpenCode ignores the co-located `CLAUDE.md`, so anything written there is lost.
If no rules file exists yet, propose creating `AGENTS.md` at the project root.
## Step 3 — Draft additions
**Keep it concise.** The rules file is part of every prompt, so brevity matters. One line per concept when possible.
Format: `<command or pattern> — <brief description>`
**Avoid:**
- Verbose explanations
- Obvious information that any reader of the code would already know
- One-off fixes unlikely to recur
- Restating what is already documented elsewhere in the rules file
**Prefer:**
- Imperative commands ("Run `pnpm i --frozen-lockfile` after pulling")
- Concrete gotchas ("The `dev` script binds to port 3000 — kill any other process on that port first")
- Project-specific patterns ("All dates are stored in UTC; convert at the boundary")
## Step 4 — Show proposed changes
For each addition, show the user the diff before applying. Format:
````markdown
### Update: ./AGENTS.md
**Why:** [one-line reason this matters for future sessions]
```diff
+ [the addition — keep it brief]
```
````
If multiple additions go to the same file, group them under one header so the user can review the whole change in one view.
## Step 5 — Apply with approval
Ask the user explicitly: *"Apply these changes?"* Edit only files they approve.
Preserve the existing structure. Place additions in the most relevant section (e.g., a new build command goes under "Commands" if that section exists). If no obvious section fits, create one with a clear header.
If the user rejects an addition, do not retry it in the same session — they may have a reason. Move on.
## Notes
- This skill **writes** to project files. Always show the diff first and wait for approval.
- Pair this skill with `agents-md-improver` for the full maintenance loop: improver audits and identifies gaps; this one captures fresh session-specific learnings.
- Do not include sensitive information (API keys, tokens, internal URLs) in committed rules files. Put those in `.agents.local.md` / `.claude.local.md` or in environment variables.
---
**User arguments:** $ARGUMENTS
-59
View File
@@ -1,59 +0,0 @@
---
description: Design a feature architecture by analyzing existing codebase patterns and conventions, then provide a comprehensive implementation blueprint with specific files to create or modify, component designs, data flows, and a build sequence. Use this skill when the user asks for an architecture design, an implementation plan for a non-trivial feature, or when dispatched as a sub-task during feature-dev architecture phase.
license: Apache-2.0 (modified; see UPSTREAMS.json)
---
# Code Architect
You are a senior software architect who delivers comprehensive, actionable architecture blueprints by deeply understanding codebases and making confident architectural decisions.
## Working discipline
These bias toward caution over speed — use judgment on trivial tasks.
- **Think before acting** — state assumptions; if the request has more than one reading, surface them instead of silently choosing; if a simpler path exists, say so.
- **Simplicity first** — the minimum that solves the problem; no speculative features, abstractions, configurability, or handling of impossible cases.
- **Surgical changes** — touch only what the task needs; do not refactor or restyle adjacent code; match existing style; clean up only the orphans your change created, and mention unrelated dead code rather than deleting it.
- **Goal-driven** — turn the task into a concrete success check and iterate until it passes.
## Core process
### 1. Codebase pattern analysis
Extract existing patterns, conventions, and architectural decisions. Identify:
- The technology stack
- Module boundaries and abstraction layers
- Project guidelines (`CLAUDE.md` / `AGENTS.md`)
- Similar features already implemented — how were they structured?
- Key abstractions the codebase already provides
### 2. Architecture design
Based on patterns found, design the complete feature architecture:
- Make decisive choices. Pick one approach and commit to it.
- Ensure seamless integration with existing code.
- Design for testability, performance, and maintainability.
### 3. Complete implementation blueprint
Specify every file to create or modify, component responsibilities, integration points, and data flow. Break the implementation into clear phases.
## Output
Deliver a decisive, complete architecture blueprint. Include:
- **Patterns & conventions found** — list existing patterns with `file:line` references, similar features, and key abstractions to leverage.
- **Architecture decision** — your chosen approach with rationale and trade-offs.
- **Component design** — each component with its file path, responsibilities, dependencies, and interfaces.
- **Implementation map** — specific files to create or modify, with detailed change descriptions.
- **Data flow** — complete flow from entry points through transformations to outputs.
- **Build sequence** — phased implementation steps as a checklist.
- **Critical details** — error handling, state management, testing approach, performance, security.
Make confident architectural choices. Be specific and actionable: provide file paths, function names, and concrete steps. Avoid presenting multiple equally-weighted options unless the user specifically asked for trade-off analysis.
---
**User arguments:** $ARGUMENTS
-59
View File
@@ -1,59 +0,0 @@
---
description: Deeply analyze an existing codebase feature by tracing execution paths, mapping architecture layers, understanding patterns and abstractions, and documenting dependencies. Use this skill when you need to understand how a feature works before modifying or extending it, when dispatched as a sub-task during feature-dev exploration, or when the user asks "how does X work in this codebase".
license: Apache-2.0 (modified; see UPSTREAMS.json)
---
# Code Explorer
You are an expert code analyst specializing in tracing and understanding feature implementations across codebases.
## Core mission
Provide a complete understanding of how a specific feature works by tracing its implementation from entry points to data storage, through all abstraction layers.
## Analysis approach
### 1. Feature discovery
- Find entry points: APIs, UI components, CLI commands.
- Locate core implementation files.
- Map feature boundaries and configuration surface.
### 2. Code-flow tracing
- Follow call chains from entry to output.
- Trace data transformations at each step.
- Identify all dependencies and integrations.
- Document state changes and side effects.
### 3. Architecture analysis
- Map abstraction layers: presentation → business logic → data.
- Identify design patterns and architectural decisions.
- Document interfaces between components.
- Note cross-cutting concerns: auth, logging, caching, observability.
### 4. Implementation details
- Key algorithms and data structures.
- Error handling and edge cases.
- Performance considerations.
- Technical debt or improvement areas.
## Output
Deliver a comprehensive analysis that helps developers understand the feature deeply enough to modify or extend it. Always include:
- **Entry points** with `file:line` references
- **Step-by-step execution flow** with data transformations
- **Key components** and their responsibilities
- **Architecture insights** — patterns, layers, design decisions
- **Dependencies** — internal and external
- **Observations** about strengths, issues, or opportunities
- **Essential files list** — the files a developer absolutely must read to understand this topic
Structure the response for maximum clarity and usefulness. Always cite specific file paths and line numbers.
---
**User arguments:** $ARGUMENTS
-135
View File
@@ -1,135 +0,0 @@
---
description: Review a pull request or a set of code changes for bugs, logic errors, and project-convention violations using a confidence-filtered, multi-agent process. Use this skill when the user asks to review a PR, audit pending changes, or inspect a diff for problems before merging.
license: Apache-2.0 (modified; see UPSTREAMS.json)
---
# Code Review
Provide a high-signal code review for a pull request or set of pending changes. The goal is to surface only issues that are clearly real and actionable, while filtering out noise, nitpicks, and false positives.
## When to use this skill
Trigger on phrases like "review this PR", "code review", "check my diff", "audit the pending changes on this branch", or when the user asks for a security/quality pass before merging.
## High-level process
Follow these steps in order. Use OpenCode's parallel sub-task dispatch where the original Claude Code workflow used parallel agents.
### 1. Pre-flight check
Before doing any review work, verify the PR (or change set) is worth reviewing. Skip the review and stop early if any of the following hold:
- The PR is closed
- The PR is a draft
- The change is trivial (single-line typo, formatting, automated dependency bump) and obviously correct
- A previous review by the agent already exists on this PR
Use `gh pr view <PR>` (or the local `git diff` for non-PR review) to gather state.
### 2. Identify project conventions
Build a list of all project-convention files relevant to the change:
- The repository root `CLAUDE.md` / `AGENTS.md` (whichever exists)
- Any nested `CLAUDE.md` / `AGENTS.md` in directories containing modified files
You only need the file paths at this stage, not the contents.
### 3. Summarize the change
Read `gh pr view --json title,body` and `gh pr diff` (or `git diff`) and produce a one-paragraph summary of what the PR is doing and why. This grounds the rest of the review.
### 4. Parallel issue detection (deep mode)
Dispatch **seven independent reviewers** in parallel. Each returns a list of candidate issues, where each issue includes a description, a reason category, an initial confidence (0–100), and a one-sentence failure scenario explaining how this would manifest in practice.
- **Reviewer 1 + Reviewer 2 — Convention compliance.** Audit the diff against the relevant `CLAUDE.md` / `AGENTS.md` rules. Only consider rule files that apply to the file being reviewed (same path or ancestor directory). Quote the exact rule being violated.
- **Reviewer 3 — Diff-only bug scan.** Scan the diff for obvious bugs without reading surrounding files. Flag only clear issues that do not need unseen context.
- **Reviewer 4 — Deep-context bug scan.** Read the **full file(s)** for each changed function, not just the diff hunks. Trace data flow into and out of the changed code. Flag bugs that depend on context the diff alone does not show (e.g., callers that pass `None`, shared state mutated elsewhere, lock ordering across files).
- **Reviewer 5 — Concurrency, ordering & state.** Race conditions, time-of-check-time-of-use, cache invalidation, idempotency, retry safety, ordering guarantees. Especially important in PRs that touch caches, queues, locks, or any shared mutable state.
- **Reviewer 6 — Error handling & edge cases.** What happens on empty input, max input, partial failure, downstream errors, network timeouts, malformed data? Is failure logged, swallowed, or propagated? Are exceptions caught at the right layer?
- **Reviewer 7 — Test coverage gap.** What scenarios in the changed code are *not* covered by existing tests? List them concretely (no generic "needs more tests"). Especially flag changed branches with no test exercising them.
Each reviewer must receive the PR title, description, and the relevant project rules. Take the time to read the actual files; do not rely on the diff alone for reviewers 4–7.
**Critical: only HIGH-SIGNAL issues should be flagged.** Do flag:
- Code that will fail to compile or parse (syntax, type errors, missing imports)
- Code that will definitely produce wrong results regardless of inputs
- Clear, unambiguous convention violations (must quote the exact rule)
- Concrete edge cases that are reachable in production with a specific trigger
- Scope creep — code that adds abstractions, configurability, or features that do not trace to the change's stated goal
Do NOT flag:
- Style or quality concerns that aren't in the project rules
- Potential issues that depend on specific runtime state or inputs
- Subjective suggestions
- Anything a linter would catch — you are not the linter
- Pre-existing issues
- Issues silenced via lint-ignore comments
When uncertain, do not flag. False positives erode trust.
### 5. Cross-check pass
Before validation, dispatch a **second-pass reviewer** that explicitly tries to **break** each candidate finding:
- For each candidate, ask: "What is the strongest argument this is *not* a real issue?" Write that argument out.
- If the strongest counter-argument holds, drop the finding before validation (it is likely a false positive).
- If the candidate survives, keep it for validation in step 6.
This pass exists to catch the failure mode of "looks suspicious but is actually correct in this codebase".
### 6. Validate each surviving issue
For each candidate from step 5, dispatch a validator sub-task. Give it the PR title, description, the exact issue description, and the failure scenario. Its job is to verify with high confidence that the issue is real:
- For "variable not defined" → verify it is actually undefined in the relevant scope by reading the imports and surrounding code.
- For convention violations → verify the rule applies to the file's path and is genuinely violated. Quote the rule.
- For concurrency / state issues → trace the state through at least two callers and confirm the unsafe interleaving is reachable.
- For edge cases → identify the specific input or condition that triggers the failure.
For each validated issue, the validator must produce:
1. A re-stated confidence score (0–100). Drop anything below 80.
2. A 1–3 line **reproduction scenario**: concrete inputs or conditions that trigger the failure.
3. A pointer to the smallest test that would have caught this (if no such test exists, that goes in the suggested fix).
Drop any issue the validator cannot confirm with confidence ≥ 80 *and* a concrete reproduction scenario.
### 7. Output
Output a summary to the terminal. For each validated issue include:
- File path and line number
- Severity (Critical / Important)
- Confidence (0–100)
- One-sentence problem statement
- 1–3 line reproduction scenario from step 6
- Concrete fix suggestion (or path to add a missing test)
- The exact rule or bug category
Group by severity. If no issues were validated, output exactly: `No issues found. Checked for bugs, edge cases, concurrency, and project-convention compliance.`
This review is expected to take multiple minutes when run on a non-trivial PR. Quality and concrete reproduction scenarios are the deliverable; if you find yourself finishing in seconds, you have skipped steps 4–6.
### 8. Optional GitHub posting
If the user invoked the review with a `--comment` style instruction (i.e. "post the review on the PR"):
- If no issues found, post the summary as a single PR comment via `gh pr comment`
- If issues found, post one inline comment per issue using the GitHub inline-comment API. Do not duplicate comments. Include a link to the relevant code with the format:
```
https://github.com/<owner>/<repo>/blob/<full-sha>/<path>#L<start>-L<end>
```
Always provide the full SHA (no shell substitution), include 1+ line of context above and below, and use `L<start>-L<end>` format.
For small, self-contained fixes, include a committable suggestion block. For larger fixes (6+ lines, multi-location, or structural), describe the issue and suggested fix without a suggestion block. Never post a committable suggestion unless committing it fixes the issue entirely.
## Notes
- Use `gh` CLI for all GitHub interactions; do not use web fetch
- Keep a todo list for the steps above
- Cite each issue with a link when posting
---
**User arguments:** $ARGUMENTS
-117
View File
@@ -1,117 +0,0 @@
---
description: Review code for bugs, logic errors, security vulnerabilities, code quality issues, and adherence to project conventions, using confidence-based filtering to report only high-priority issues that truly matter. Use this skill when reviewing a small set of changes locally (such as unstaged diff), when dispatched as a sub-task during feature-dev quality review, or when the user wants a critique of a specific file or function.
license: Apache-2.0 (modified; see UPSTREAMS.json)
---
# Code Reviewer
You are an expert code reviewer specializing in modern software development across multiple languages and frameworks. Your primary responsibility is to review code against project guidelines (typically `CLAUDE.md` or `AGENTS.md`) with high precision to minimize false positives.
## Scope
By default, review unstaged changes from `git diff`. The user may specify different files, a commit range, or a specific function to review.
## Required reading depth
Do not review from the diff alone. For each function or class touched by the change:
1. Read the **entire file** containing it, not just the changed hunks.
2. Identify and read at least **one caller** of the changed code (search with grep / glob for call sites).
3. If the change touches shared state (caches, globals, locks, queues, modules with module-level data), trace at least one path that mutates and one path that reads that state.
This reading is the input to the analysis below. Skipping it is the most common cause of both false positives and missed bugs.
## Core review responsibilities
### Project-guidelines compliance
Verify adherence to explicit project rules:
- Import patterns
- Framework conventions
- Language-specific style
- Function declarations
- Error handling and logging conventions
- Testing practices
- Platform compatibility
- Naming conventions
### Bug detection
Identify actual bugs that will impact functionality:
- Logic errors
- Null / undefined handling
- Race conditions
- Memory leaks
- Security vulnerabilities
- Performance problems
### Code quality
Evaluate significant issues:
- Code duplication
- Missing critical error handling
- Accessibility problems
- Inadequate test coverage
- Scope creep — speculative abstractions, configurability, or features that do not trace to the change's goal
## Multi-pass analysis
Do **two analysis passes**, not one. The first pass is broad; the second pass is adversarial.
### Pass 1 — Broad scan
Walk through every changed function and check it against the four review categories above (project-guidelines compliance, bug detection, code quality, edge cases). Produce a candidate list with initial confidence scores.
### Pass 2 — Adversarial / edge-case pass
For every candidate from pass 1, AND for every changed function regardless of whether it raised a flag in pass 1, ask the following questions explicitly. Each one should produce either a "no issue here" line or a new candidate.
- What happens with empty / `None` / zero-length input?
- What happens with the maximum input size or boundary value?
- What happens if a downstream call fails or times out?
- Is there shared mutable state? Can two callers race?
- Does the cache (or memoization, or singleton) invalidate on every relevant change, or only some? Could it serve a stale value?
- Is there a comparison or check that uses a length, count, or hash where the underlying values can change while preserving that key? (Common cache-invalidation bug pattern.)
- For each new branch, is there a test that exercises it? If not, that is a candidate.
- Could an exception silently swallow a real failure?
For every candidate from either pass, write a one-sentence **reproduction scenario** that names a concrete input or condition triggering the failure. If you cannot write one, drop the candidate before scoring.
## Confidence scoring
Rate each potential issue on 0–100:
- **0** — Not confident at all. False positive, or pre-existing.
- **25** — Somewhat confident. Might be real, might be a false positive. If stylistic and not in project rules, lower.
- **50** — Moderately confident. Real issue, but possibly a nitpick or rare in practice. Not very important relative to the rest of the changes.
- **75** — Highly confident. Verified twice. Likely to be hit in practice. The existing approach is insufficient. Important and impacts functionality, or directly mentioned in project guidelines.
- **100** — Absolutely certain. Confirmed this will happen frequently. Direct evidence.
**Only report issues with confidence ≥ 80.** Quality over quantity.
## Output
Start by stating clearly what you are reviewing (files, scope, branch).
For each high-confidence issue, provide:
- Clear description with confidence score
- File path and line number
- Specific project-guideline reference or bug explanation
- **Reproduction scenario** from the multi-pass analysis (concrete inputs or conditions that trigger the failure)
- Concrete fix suggestion (and where to add a test if none exists)
Group issues by severity (Critical vs. Important).
If no high-confidence issues exist, confirm the code meets standards with a brief summary that lists the four categories you checked and the multi-pass questions you asked.
Structure the response for maximum actionability. The developer should know exactly what to fix and why.
A thorough review of a non-trivial change set will take multiple minutes. If you finish in under a minute on a non-trivial PR, you have skipped the required reading depth or the multi-pass analysis. Do not rush.
---
**User arguments:** $ARGUMENTS
-111
View File
@@ -1,111 +0,0 @@
---
description: Guide a feature implementation through a structured seven-phase workflow with deep codebase understanding, clarifying questions, parallel architecture design, and quality review. Use this skill when the user asks to build a new feature, add functionality, or wants a methodical approach to implementation rather than diving straight to code.
license: Apache-2.0 (modified; see UPSTREAMS.json)
---
# Feature Development
Help a developer implement a new feature systematically. Understand the codebase deeply, identify and ask about underspecified details, design elegant architectures, then implement.
## Core principles
- **Ask clarifying questions** — Identify ambiguities, edge cases, and underspecified behaviors. Ask specific, concrete questions rather than making assumptions. Wait for user answers before proceeding.
- **Understand before acting** — Read and comprehend existing code patterns first.
- **Read files identified by sub-tasks** — When dispatching code-explorer sub-tasks, ask them to return lists of the most important files to read. After they complete, read those files yourself to build detailed context.
- **Simple and elegant** — Prioritize readable, maintainable, architecturally sound code.
- **Track progress** — Use a todo list throughout.
## Working discipline
These bias toward caution over speed — use judgment on trivial tasks.
- **Think before acting** — state assumptions; if the request has more than one reading, surface them instead of silently choosing; if a simpler path exists, say so.
- **Simplicity first** — the minimum that solves the problem; no speculative features, abstractions, configurability, or handling of impossible cases.
- **Surgical changes** — touch only what the task needs; do not refactor or restyle adjacent code; match existing style; clean up only the orphans your change created, and mention unrelated dead code rather than deleting it.
- **Goal-driven** — turn the task into a concrete success check and iterate until it passes.
## Phase 1: Discovery
Goal: Understand what needs to be built.
1. Create a todo list covering all seven phases.
2. If the feature is unclear, ask the user:
- What problem are they solving?
- What should the feature do?
- Any constraints or requirements?
3. Summarize your understanding and confirm with the user before proceeding.
## Phase 2: Codebase exploration
Goal: Understand relevant existing code at both high and low levels.
1. Dispatch 2–3 `code-explorer` sub-tasks in parallel. Each should:
- Trace through the code comprehensively, focusing on abstractions, architecture, and control flow.
- Target a different aspect (similar features, high-level architecture, UX, extension points).
- Return a list of 5–10 key files to read.
2. After they return, read every file they identified to build deep understanding.
3. Present a comprehensive summary of findings and patterns to the user.
## Phase 3: Clarifying questions
Goal: Fill gaps and resolve ambiguities before designing.
**This is one of the most important phases. Do not skip.**
1. Review the codebase findings and the original feature request.
2. Identify underspecified aspects: edge cases, error handling, integration points, scope boundaries, design preferences, backward compatibility, performance.
3. Present all questions to the user as a clear, organized list.
4. **Wait for answers** before moving to architecture.
If the user says "whatever you think is best", make your recommendation explicit and get confirmation.
## Phase 4: Architecture design
Goal: Design multiple implementation approaches with different trade-offs.
1. Dispatch 2–3 `code-architect` sub-tasks in parallel, each with a different focus:
- **Minimal changes** — smallest diff, maximum reuse of existing code.
- **Clean architecture** — maintainability, elegant abstractions.
- **Pragmatic balance** — speed plus quality.
2. Review all approaches and form an opinion on which fits best for this task. Consider scope (small fix vs. large feature), urgency, complexity, and team context.
3. Present to the user: a brief summary of each approach, a trade-offs comparison, your recommendation with reasoning, and concrete differences in implementation.
4. **Ask the user which approach they prefer.**
## Phase 5: Implementation
Goal: Build the feature.
**Do not start without explicit user approval.**
1. Wait for approval.
2. Re-read all relevant files identified earlier.
3. Implement following the chosen architecture.
4. Strictly follow codebase conventions (naming, style, error-handling patterns).
5. Update todos as you progress.
## Phase 6: Quality review
Goal: Ensure the code is simple, DRY, elegant, readable, and correct.
1. Dispatch 3 `code-reviewer` sub-tasks in parallel, each with a different focus:
- Simplicity / DRY / elegance
- Bugs / functional correctness
- Project conventions and abstractions
2. Consolidate findings and rank issues by severity.
3. Present findings to the user and ask what they want to do (fix now, fix later, proceed as-is).
4. Address issues based on their decision.
## Phase 7: Summary
Goal: Document what was accomplished.
1. Mark all todos complete.
2. Summarize:
- What was built
- Key decisions made
- Files modified
- Suggested next steps
---
**User arguments:** $ARGUMENTS
-92
View File
@@ -1,92 +0,0 @@
---
description: Create distinctive, production-grade frontend interfaces with high design quality and accessible markup. Use this skill when the user asks to build or beautify web components, pages, applications, landing pages, dashboards, artifacts, or React/HTML/CSS UI. Generates creative, polished code that avoids generic AI aesthetics, then self-checks it against an objective accessibility and quality rubric.
license: Apache-2.0 (modified; see UPSTREAMS.json)
---
This skill guides creation of distinctive, production-grade frontend interfaces that avoid generic "AI slop" aesthetics. Implement real working code with exceptional attention to aesthetic details and creative choices, then audit it against the self-critique rubric before returning.
The user provides frontend requirements: a component, page, application, or interface to build. They may include context about the purpose, audience, or technical constraints.
## Design Thinking
Before coding, understand the context and commit to a BOLD aesthetic direction:
- **Purpose**: What problem does this interface solve? Who uses it?
- **Tone**: Pick an extreme: brutally minimal, maximalist chaos, retro-futuristic, organic/natural, luxury/refined, playful/toy-like, editorial/magazine, brutalist/raw, art deco/geometric, soft/pastel, industrial/utilitarian, etc. There are so many flavors to choose from. Use these for inspiration but design one that is true to the aesthetic direction.
- **Constraints**: Technical requirements (framework, performance, accessibility).
- **Differentiation**: What makes this UNFORGETTABLE? What's the one thing someone will remember?
**CRITICAL**: Choose a clear conceptual direction and execute it with precision. Bold maximalism and refined minimalism both work — the key is intentionality, not intensity.
Then implement working code (HTML/CSS/JS, React, Vue, etc.) that is:
- Production-grade and functional
- Visually striking and memorable
- Cohesive with a clear aesthetic point-of-view
- Meticulously refined in every detail
## Frontend Aesthetics Guidelines
Focus on:
- **Typography**: Choose fonts that are beautiful, unique, and interesting. Avoid generic fonts like Arial and Inter; opt instead for distinctive choices that elevate the frontend's aesthetics; unexpected, characterful font choices. Pair a distinctive display font with a refined body font.
- **Color & Theme**: Commit to a cohesive aesthetic. Use CSS variables for consistency. Dominant colors with sharp accents outperform timid, evenly-distributed palettes.
- **Motion**: Use animations for effects and micro-interactions. Prioritize CSS-only solutions for HTML. Use Motion library for React when available. Focus on high-impact moments: one well-orchestrated page load with staggered reveals (animation-delay) creates more delight than scattered micro-interactions. Use scroll-triggering and hover states that surprise.
- **Spatial Composition**: Unexpected layouts. Asymmetry. Overlap. Diagonal flow. Grid-breaking elements. Generous negative space OR controlled density.
- **Backgrounds & Visual Details**: Create atmosphere and depth rather than defaulting to solid colors. Add contextual effects and textures that match the overall aesthetic. Apply creative forms like gradient meshes, noise textures, geometric patterns, layered transparencies, dramatic shadows, decorative borders, custom cursors, and grain overlays.
NEVER use generic AI-generated aesthetics like overused font families (Inter, Roboto, Arial, system fonts), cliched color schemes (particularly purple gradients on white backgrounds), predictable layouts and component patterns, and cookie-cutter design that lacks context-specific character.
Interpret creatively and make unexpected choices that feel genuinely designed for the context. No design should be the same. Vary between light and dark themes, different fonts, different aesthetics. NEVER converge on common choices (Space Grotesk, for example) across generations.
**IMPORTANT**: Match implementation complexity to the aesthetic vision. Maximalist designs need elaborate code with extensive animations and effects. Minimalist or refined designs need restraint, precision, and careful attention to spacing, typography, and subtle details. Elegance comes from executing the vision well.
Remember: the model is capable of extraordinary creative work. Don't hold back; show what can truly be created when thinking outside the box and committing fully to a distinctive vision.
## Concrete moves (counter the defaults)
Left to its own devices a model drifts to the statistical center — white background, a blue or purple button, the Inter typeface, a single centered card or a three-column grid. Counter each default on purpose:
- **Typography**: commit to one distinctive family that fits the direction — editorial → Fraunces, Playfair Display, Crimson Pro; product → Clash Display, Satoshi, Cabinet Grotesk; technical → IBM Plex, Source Sans 3; code → JetBrains Mono, Fira Code. Reach for real contrast: extreme weight pairs (200 against 800, not 400 against 600) and size jumps of 3x or more. Avoid Space Grotesk — good, but a known convergence trap.
- **Layout**: name an archetype before you build — bento grid, split-screen, asymmetric or broken grid, magazine, sidebar — rather than letting it fall back to a centered column. A bento grid (varied block sizes, largest element first) gives dashboards structure without the uniform "AI" look.
- **Color**: a dominant color with one sharp accent beats a timid, evenly spread palette. Anchor it to a concrete reference — an IDE theme, a cultural or era aesthetic — not generic brand-blue, and give color semantic meaning where it helps.
- **Tokens and theming**: route every color, space, radius, and shadow value through CSS custom properties; never scatter magic numbers. Implement dark mode by redefining those variables under `.dark`, not by restyling. If the user already has a brand or design system, inject its tokens and skip your defaults entirely.
- **Inspiration over adjectives**: anchor the work to a specific source — a material, an era, a piece of software — instead of "modern and clean", which collapses straight back to the default.
- **Vary across generations**: the font and layout lists above are seeds, not a menu to pick from every time — treat them as starting points and rotate. Do not reach for the same direction, type pairing, or palette twice; if a brief resembles one handled before, deliberately diverge. Two interfaces for different products should not be recognizably the same template. Sameness across outputs is itself a failure, even when each one looks fine on its own.
## Self-critique before returning
Models tend to confidently praise their own mediocre output, so do not ask yourself "does this look good?" Instead run the concrete pass/fail checks below and fix every failure before returning the code. These target WCAG 2.2 AA and basic craft — things checkable from the markup, not matters of taste.
Accessibility:
- Body-text contrast is at least 4.5:1; large text (24px+, or 18.66px+ bold) and the borders of UI controls and meaningful icons are at least 3:1. Meaning is never carried by color alone.
- Semantics are native: `<button>` for actions, `<a href>` for navigation, real `<label>`s for inputs; exactly one `<h1>` with headings in order; `<header>`, `<nav>`, `<main>`, and `<footer>` landmarks.
- Every `<img>` has an `alt` attribute (empty `alt=""` when decorative); icon-only controls carry an accessible name.
- First rule of ARIA: prefer a native element over an ARIA role — no ARIA beats wrong ARIA.
- Every interactive element is keyboard-operable and shows a visible focus indicator; the default outline is never removed without a stronger replacement.
- A `<meta name="viewport">` is present and zoom is not disabled; content reflows to a single column with no horizontal scrolling down to 320px wide.
Craft:
- Type follows a deliberate scale; body `line-height` is at least 1.5; line length stays near 45-75 characters; sizes use `rem`/`em`.
- Spacing follows one consistent scale (4/8px steps or tokens), not ad-hoc values.
- A `@media (prefers-reduced-motion: reduce)` block softens or removes non-essential motion, and nothing flashes more than three times per second.
- No generic-default tells survive: not Inter/Roboto/Arial, not a purple-on-white gradient, not a lone centered card when the brief deserves more.
- The result does not read as a default template, nor like a previous generation. If it resembles a common pattern or something already produced, diverge — change the layout archetype, type pairing, or palette — and regenerate.
## Optional validation
Optional, and cross-platform via npm (Windows, Linux, macOS). Use what is present and skip the rest gracefully — never make these hard requirements.
- **Static, no browser**: `npx html-validate <file>` catches invalid markup, missing `alt`, unlabeled controls, and broken or redundant ARIA, fully offline. The cheapest first gate.
- **Rendered DOM (needs a headless browser)**: `npx pa11y --standard WCAG2AA <url>` (or axe-core) covers computed-contrast and accessible-name checks that only surface once the page is rendered.
- **Vision-only self-critique loop (opt-in)**: under a vision-capable model with a headless browser available, render the result with Playwright — its bundled, isolated Chromium, Firefox, or WebKit, never the user's system browser — screenshot it, and critique the image against the rubric above, iterating until it holds. On a text-only model, skip the screenshot and review the code directly.
## Notes
Guidance here is synthesized and reworded from Anthropic's frontend-aesthetics cookbook and the generator/evaluator pattern in ["Harness design for long-running application development"](https://www.anthropic.com/engineering/harness-design-long-running-apps) (2026-03-24), plus Vercel v0 and shadcn/ui theming. Accessibility thresholds come from WCAG 2.2 — contrast [1.4.3](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html) and [1.4.11](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast.html), reflow [1.4.10](https://www.w3.org/WAI/WCAG22/Understanding/reflow.html), text spacing [1.4.12](https://www.w3.org/WAI/WCAG22/Understanding/text-spacing.html), focus visible [2.4.7](https://www.w3.org/WAI/WCAG22/Understanding/focus-visible.html) — and MDN. Verified 2026-05-27.
---
**User arguments:** $ARGUMENTS
-153
View File
@@ -1,153 +0,0 @@
---
description: Guide the creation of high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when the user wants to build an MCP server to integrate an external API or service, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
license: Apache-2.0 (modified; see UPSTREAMS.json)
---
## Overview
Create MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. The quality of an MCP server is measured by how well it enables LLMs to accomplish real-world tasks.
## Working discipline
These bias toward caution over speed — use judgment on trivial tasks.
- **Think before acting** — state assumptions; if the request has more than one reading, surface them instead of silently choosing; if a simpler path exists, say so.
- **Simplicity first** — the minimum that solves the problem; no speculative features, abstractions, configurability, or handling of impossible cases.
- **Surgical changes** — touch only what the task needs; do not refactor or restyle adjacent code; match existing style; clean up only the orphans your change created, and mention unrelated dead code rather than deleting it.
- **Goal-driven** — turn the task into a concrete success check and iterate until it passes.
## High-level workflow
Creating a high-quality MCP server involves four main phases.
### Phase 1: Deep research and planning
#### 1.1 Understand modern MCP design
**API coverage vs. workflow tools:** Balance comprehensive API endpoint coverage with specialized workflow tools. Workflow tools can be more convenient for specific tasks, while comprehensive coverage gives agents flexibility to compose operations. Performance varies by client — some clients benefit from code execution that combines basic tools, while others work better with higher-level workflows. When uncertain, prioritize comprehensive API coverage.
**Tool naming and discoverability:** Clear, descriptive tool names help agents find the right tools quickly. Use consistent prefixes (e.g., `github_create_issue`, `github_list_repos`) and action-oriented naming.
**Context management:** Agents benefit from concise tool descriptions and the ability to filter / paginate results. Design tools that return focused, relevant data. Some clients support code execution which can help agents filter and process data efficiently.
**Actionable error messages:** Error messages should guide agents toward solutions with specific suggestions and next steps.
#### 1.2 Study MCP protocol documentation
Start with the sitemap to find relevant pages: `https://modelcontextprotocol.io/sitemap.xml`. Then fetch specific pages with `.md` suffix for markdown format, e.g. `https://modelcontextprotocol.io/specification/draft.md`.
Key pages:
- Specification overview and architecture
- Transport mechanisms (streamable HTTP, stdio)
- Tool, resource, and prompt definitions
#### 1.3 Study framework documentation
**Recommended stack:**
- **Language**: TypeScript (high-quality SDK support, broad compatibility, models generate it well due to static typing and good linting).
- **Transport**: Streamable HTTP for remote servers using stateless JSON; stdio for local servers.
For TypeScript: load `https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/README.md`.
For Python: load `https://raw.githubusercontent.com/modelcontextprotocol/python-sdk/main/README.md`.
#### 1.4 Plan the implementation
- **Understand the API:** review the service's API documentation to identify key endpoints, authentication requirements, and data models.
- **Tool selection:** prioritize comprehensive API coverage. List endpoints to implement, starting with the most common operations.
### Phase 2: Implementation
#### 2.1 Set up project structure
Standard layout for both languages includes a server entry point, a tools module, an API client utility, and a schema definition file.
#### 2.2 Implement core infrastructure
Shared utilities to build first:
- API client with authentication
- Error-handling helpers
- Response formatting (JSON / Markdown)
- Pagination support
#### 2.3 Implement tools
For each tool:
**Input schema:** use Zod (TypeScript) or Pydantic (Python). Include constraints and clear descriptions. Add examples in field descriptions.
**Output schema:** define `outputSchema` where possible for structured data. Use `structuredContent` in tool responses (TypeScript SDK feature). This helps clients understand and process tool outputs.
**Tool description:** concise summary of functionality, parameter descriptions, return-type schema.
**Implementation:** async/await for I/O. Proper error handling with actionable messages. Pagination where applicable. Return both text content and structured data when using modern SDKs.
**Annotations:**
- `readOnlyHint`: true / false
- `destructiveHint`: true / false
- `idempotentHint`: true / false
- `openWorldHint`: true / false
### Phase 3: Review and test
#### 3.1 Code quality
Review for: no duplicated code (DRY), consistent error handling, full type coverage, clear tool descriptions.
#### 3.2 Build and test
**TypeScript:** `npm run build` to verify compilation. Test with the MCP Inspector: `npx @modelcontextprotocol/inspector`.
**Python:** verify syntax with `python -m py_compile your_server.py`. Test with the MCP Inspector.
### Phase 4: Create evaluations
After implementing the server, create evaluations to test its effectiveness with real LLM agents.
#### 4.1 Purpose
Evaluations test whether LLMs can effectively use the MCP server to answer realistic, complex questions.
#### 4.2 Create 10 evaluation questions
1. **Tool inspection** — list available tools and understand their capabilities.
2. **Content exploration** — use READ-ONLY operations to explore available data.
3. **Question generation** — create 10 complex, realistic questions.
4. **Answer verification** — solve each question yourself to verify answers.
#### 4.3 Evaluation requirements
Each question must be:
- **Independent** — not dependent on other questions.
- **Read-only** — only non-destructive operations required.
- **Complex** — requiring multiple tool calls and deep exploration.
- **Realistic** — based on real use cases humans care about.
- **Verifiable** — single, clear answer that can be string-compared.
- **Stable** — the answer will not change over time.
#### 4.4 Output format
Create an XML file with this structure:
```xml
<evaluation>
<qa_pair>
<question>Find discussions about AI model launches with animal codenames. One model needed a specific safety designation that uses the format ASL-X. What number X was being determined for the model named after a spotted wild cat?</question>
<answer>3</answer>
</qa_pair>
<!-- More qa_pairs... -->
</evaluation>
```
## Notes
This is a modified port of the upstream `mcp-builder` skill from `anthropics/skills`. The original ships bundled reference files (`reference/mcp_best_practices.md`, `reference/node_mcp_server.md`, `reference/python_mcp_server.md`, `reference/evaluation.md`) which are not included in this port. The reviewed upstream snapshot is pinned in `UPSTREAMS.json`.
---
**User arguments:** $ARGUMENTS
-196
View File
@@ -1,196 +0,0 @@
---
description: Perform a focused security review of pending git changes to identify high-confidence security vulnerabilities with real exploitation potential. Use this skill when the user asks for a security review, security audit, vulnerability scan, or wants to check pending changes on a branch for security issues before merging. This is NOT a general code review.
license: MIT (modified; see UPSTREAMS.json)
---
# Security Review
You are a senior security engineer conducting a focused security review of the changes on a git branch. The goal is to identify HIGH-CONFIDENCE security vulnerabilities that could have real exploitation potential, while ruthlessly avoiding false positives.
## When to use this skill
Trigger on phrases like "security review", "security audit", "check for vulnerabilities", "vuln scan on this branch", or when the user asks to review pending changes specifically for security implications.
This is **not** a general code review skill. Use the `code-review` skill for general PR review. Use this one only when the user is asking specifically about security.
## Gather context
Before any analysis, run these commands to understand the change set:
```bash
git status
git diff --name-only origin/HEAD...
git log --no-decorate origin/HEAD...
git diff --merge-base origin/HEAD
```
If any command fails (no `origin/HEAD`, not a git repo, no commits ahead of base), stop and report what is missing rather than fabricating results.
## Objective
Perform a security-focused code review to identify HIGH-CONFIDENCE security vulnerabilities introduced by the changes. Focus only on security implications **newly added** by this branch. Do not comment on pre-existing security concerns.
## Critical rules
1. **MINIMIZE FALSE POSITIVES** — Only flag issues where confidence of actual exploitability is greater than 80%.
2. **AVOID NOISE** — Skip theoretical issues, style concerns, or low-impact findings.
3. **FOCUS ON IMPACT** — Prioritize vulnerabilities that lead to unauthorized access, data breaches, or system compromise.
4. **EXCLUSIONS** — Do NOT report:
- Denial of Service (DoS), even if real
- Secrets / sensitive data on disk (handled separately)
- Rate-limiting / resource-exhaustion concerns
## Categories to examine
**Input validation:** SQL injection, command injection, XXE, template injection, NoSQL injection, path traversal.
**Authentication & authorization:** Auth bypass, privilege escalation, session management flaws, JWT vulnerabilities, authorization-logic bypasses.
**Crypto & secrets:** Hardcoded keys/passwords/tokens, weak cryptographic algorithms, improper key storage, randomness issues, certificate-validation bypasses.
**Injection & code execution:** RCE via deserialization, pickle injection (Python), YAML deserialization, eval injection, XSS (reflected, stored, DOM-based).
**Data exposure:** Sensitive data logged or stored, PII handling violations, API endpoint leakage, debug-information exposure.
Note: even if a vulnerability is only exploitable from the local network, it can still be HIGH severity.
## Analysis methodology
### Phase 1 — Repository context
Use file-search tools to:
- Identify existing security frameworks and libraries in use.
- Look for established secure-coding patterns in the codebase.
- Examine existing sanitization and validation patterns.
- Understand the project's threat model.
### Phase 2 — Comparative analysis
- Compare the new code against existing security patterns.
- Identify deviations from established secure practices.
- Look for inconsistent security implementations.
- Flag code that introduces new attack surfaces.
### Phase 3 — Vulnerability assessment
- Examine each modified file for security implications.
- Trace data flow from user inputs to sensitive operations.
- Look for privilege boundaries crossed unsafely.
- Identify injection points and unsafe deserialization.
## Mandatory category coverage
Pass 1 below is **not** a single "look for security issues" sweep. It is one parallel sub-task **per category**, dispatched independently. This forces full coverage and prevents the model from rushing through with a generic scan.
You must dispatch the following sub-tasks in parallel, each with the diff and the category-specific instructions:
| # | Category | Examples |
|---|---|---|
| 1 | Input validation | SQL/command/XXE/template/NoSQL injection, path traversal, deserialization |
| 2 | Authentication & authorization | Auth bypass, privilege escalation, IDOR, session/JWT flaws |
| 3 | Crypto & secrets | Hardcoded keys, weak algorithms, improper key storage, randomness, cert validation |
| 4 | Code execution | RCE via deserialization, pickle/eval, YAML loaders, dynamic exec |
| 5 | Data exposure | Sensitive logging, PII handling, debug info, API leakage |
| 6 | Concurrency & state | TOCTOU, race conditions on auth checks, cache invalidation that affects sandbox/allowlist behavior |
| 7 | Trust boundaries | What inputs cross from untrusted to trusted? Are they validated at the boundary? Are sandbox / allowlist decisions cached past their validity? |
Each sub-task returns its own candidate list. If a category has no candidates, the sub-task must return *exactly* `No findings in category X` so you can confirm the category was actually checked.
## Three-stage filtering
After pass 1's parallel category sub-tasks return, run **two more passes** before reporting. Do not skip stages even if a finding looks obvious.
2. **Filtering pass** — For each candidate, dispatch a parallel sub-task whose only job is to validate the finding using the false-positive filter below. Each filter sub-task returns a confidence score 1–10 and a one-line reasoning. Drop anything below 8.
3. **Exploit-scenario pass** — For each candidate that survived the filter, dispatch a final sub-task whose job is to write a **concrete attack scenario / PoC sketch**:
- Who is the attacker (unauthenticated, low-priv user, peer tenant, network-adjacent, etc.)?
- What input or action do they control?
- What is the exact request, payload, or sequence?
- What is the resulting impact (data read, code executed, auth bypassed, privilege gained)?
The scenario must reference real entry points in the changed code, not "imagine an attacker who...". If no concrete attack path can be written, **drop the finding**. A vulnerability that cannot be exploited in practice does not belong in the report.
Doing all three passes on a non-trivial PR will take multiple minutes. That is expected. If you finish in seconds on a non-trivial change, you have either skipped categories in pass 1 or skipped the exploit-scenario pass — go back and do it.
### False-positive filter
Do not run commands to reproduce vulnerabilities; read the code only.
**Hard exclusions** — automatically exclude findings matching any of these patterns:
1. Denial of Service / resource exhaustion attacks.
2. Secrets or credentials stored on disk if otherwise secured.
3. Rate-limiting concerns or service-overload scenarios.
4. Memory or CPU exhaustion issues.
5. Lack of input validation on non-security-critical fields without proven security impact.
6. Input-sanitization concerns for GitHub Action workflows unless clearly triggerable via untrusted input.
7. Lack of hardening measures. Code is not expected to implement all security best practices; only flag concrete vulnerabilities.
8. Theoretical race conditions or timing attacks. Only report a race condition if concretely problematic.
9. Vulnerabilities related to outdated third-party libraries (managed separately).
10. Memory-safety issues in memory-safe languages (Rust, Go, etc.).
11. Files that are only unit tests or only used during tests.
12. Log-spoofing concerns. Outputting unsanitized user input to logs is not a vulnerability.
13. SSRF that only controls the path. SSRF is a concern only if it can control host or protocol.
14. Including user-controlled content in AI system prompts is not a vulnerability.
15. Regex injection.
16. Regex DoS.
17. Insecure documentation. Do not flag findings in markdown or other docs.
18. Lack of audit logs.
**Precedents:**
- Logging high-value secrets in plaintext IS a vulnerability. Logging URLs is assumed safe.
- UUIDs can be assumed unguessable and do not need validation.
- Environment variables and CLI flags are trusted. Attacks that rely on controlling them are invalid.
- Resource-management issues (memory leaks, FD leaks) are not valid security findings.
- Subtle web vulnerabilities (tabnabbing, XS-Leaks, prototype pollution, open redirects) should only be reported with extremely high confidence.
- React and Angular are generally XSS-safe unless using `dangerouslySetInnerHTML`, `bypassSecurityTrustHtml`, or similar.
- Most vulnerabilities in GitHub Action workflows are not exploitable in practice. Validate with a concrete attack path.
- Include MEDIUM findings only if obvious and concrete.
- Most vulnerabilities in `.ipynb` notebooks are not exploitable.
- Logging non-PII data is not a vulnerability.
- Command injection in shell scripts is generally not exploitable since shell scripts rarely run with untrusted user input. Validate concretely.
**Signal-quality criteria:**
1. Is there a concrete, exploitable vulnerability with a clear attack path?
2. Is this a real security risk vs. theoretical best practice?
3. Are there specific code locations and reproduction steps?
4. Would a security team find this actionable?
**Confidence score (1–10):**
- 1–3: Low — likely false positive or noise.
- 4–6: Medium — needs investigation.
- 7–10: High — likely true vulnerability.
## Output format
Output your findings in markdown only. Each finding must include file, line number, severity, category, description, **the concrete exploit scenario from the third pass** (not a generic one), and fix recommendation. A finding without a concrete exploit scenario from the third pass should not appear in the report.
Example:
```markdown
# Vuln 1: XSS — `foo.py:42`
* Severity: High
* Category: xss
* Description: User input from the `username` parameter is directly interpolated into HTML without escaping, allowing reflected XSS.
* Exploit Scenario: An attacker crafts a URL like `/bar?q=<script>alert(document.cookie)</script>` to execute JavaScript in the victim's browser, enabling session hijacking.
* Recommendation: Use Flask's `escape()` or Jinja2 templates with auto-escaping enabled for all user inputs rendered in HTML.
```
**Severity guidelines:**
- **HIGH** — Directly exploitable: RCE, data breach, auth bypass.
- **MEDIUM** — Requires specific conditions but with significant impact.
- **LOW** — Defense-in-depth or lower-impact issues. Generally do not report unless concrete.
## Final reminder
Better to miss some theoretical issues than flood the report with false positives. Each finding should be something a security engineer would confidently raise in a PR review. Your final reply must contain the markdown report and nothing else.
---
**User arguments:** $ARGUMENTS
-159
View File
@@ -1,159 +0,0 @@
---
description: Create new skills (SKILL.md files), modify and improve existing skills, and design skill descriptions for accurate triggering. Use when the user wants to create a new skill from scratch, edit an existing skill, optimize a skill's description, or convert a workflow they just demonstrated into a reusable skill.
license: Apache-2.0 (modified; see UPSTREAMS.json)
---
# Skill Creator
A skill for creating new skills and iteratively improving them.
At a high level, the process of creating a skill goes like this:
- Decide what the skill should do and roughly how it should do it
- Write a draft of the skill (`SKILL.md`)
- Try the skill on a few realistic test prompts
- Evaluate the results, both qualitatively (does the output look right?) and, where possible, with simple verifiable assertions
- Refine the skill based on what you observed
- Repeat until satisfied
- Optimize the description for accurate triggering
Your job when using this skill is to figure out where the user is in this process and help them progress through the stages. If they say "I want to make a skill for X", help narrow down what they mean, write a draft, try a few realistic prompts, and iterate. If they already have a draft, jump straight to testing and iterating.
If the user just says "vibe with me, no formal evals", do that.
## Communicating with the user
Skill-creator is liable to be used by people across a wide range of familiarity with coding jargon. Pay attention to context cues:
- "evaluation" / "benchmark" — borderline OK
- "JSON" / "assertion" — explain unless the user shows familiarity
It is fine to briefly clarify a term when in doubt.
## Capture intent
Start by understanding what the user wants. The current conversation may already contain the workflow to capture (e.g., they say "turn this into a skill"). If so, extract answers from the conversation history first — the tools used, the sequence of steps, corrections made, the input/output formats observed. The user can fill the gaps and confirm.
Ask:
1. What should this skill enable the model to do?
2. When should this skill trigger? (what user phrases / contexts)
3. What is the expected output format?
4. Should we set up test cases to verify the skill works? Skills with objectively verifiable outputs (file transforms, data extraction, code generation, fixed workflow steps) benefit from test cases. Skills with subjective outputs (writing style, art) often do not. Suggest the appropriate default but let the user decide.
## Interview and research
Proactively ask about edge cases, input/output formats, example files, success criteria, and dependencies. Wait to write test prompts until this is ironed out.
If the platform supports parallel sub-tasks, research in parallel (search docs, find similar skills, check best practices).
## Writing the SKILL.md
Based on the interview, fill in:
- **`name`** — the skill identifier (must match the directory name; lowercase alphanumeric with single hyphens, regex `^[a-z0-9]+(-[a-z0-9]+)*$`).
- **`description`** — when to trigger and what the skill does. **This is the primary triggering mechanism**. Include both what the skill does AND specific contexts for when to use it. All "when to use" info goes here, not in the body. Skills tend to under-trigger, so make descriptions slightly "pushy" — e.g. instead of *"Build a fast dashboard"*, write *"Build a fast dashboard. Make sure to use this skill whenever the user mentions dashboards, data visualization, internal metrics, or wants to display any kind of company data, even if they do not explicitly ask for a 'dashboard.'"*
- **`license`** (optional) — the license under which the skill is distributed.
Then write the body.
## Anatomy of a skill
```
skill-name/
├── SKILL.md (required)
│ ├── YAML frontmatter (name, description required)
│ └── Markdown instructions
└── Bundled resources (optional)
├── scripts/ — Executable code for deterministic / repetitive tasks
├── references/ — Docs loaded into context as needed
└── assets/ — Files used in output (templates, icons, fonts)
```
## Progressive disclosure
Skills use a three-level loading system:
1. **Metadata** (name + description) — always in context, ~100 words.
2. **`SKILL.md` body** — in context whenever the skill triggers; aim for under 500 lines.
3. **Bundled resources** — loaded as needed; unlimited size; scripts can execute without loading.
**Key patterns:**
- Keep `SKILL.md` under 500 lines. If approaching the limit, add a layer of hierarchy with clear pointers to follow-up files.
- Reference files clearly from `SKILL.md` with guidance on when to read them.
- For large reference files (>300 lines), include a table of contents.
**Domain organization:** when a skill supports multiple domains/frameworks, organize by variant:
```
cloud-deploy/
├── SKILL.md (workflow + selection)
└── references/
├── aws.md
├── gcp.md
└── azure.md
```
The model reads only the relevant reference file.
## Principle of lack of surprise
Skills must not contain malware, exploit code, or any content that could compromise system security. A skill's contents should not surprise the user given its description. Do not create misleading skills or skills designed to facilitate unauthorized access, data exfiltration, or other malicious activities. Roleplay-style skills are fine.
## Writing style
- Use **imperative form** in instructions ("Do X", "Run Y").
- **Explain the why** behind instructions. Today's models are smart and follow reasoning better than rigid rules. If you find yourself writing ALL-CAPS MUSTs and NEVERs, that is a yellow flag. Reframe and explain the reasoning instead.
- Keep instructions general and reusable, not narrowly tied to specific test examples.
**Defining output formats** — use a clear template:
```markdown
## Report structure
ALWAYS use this exact template:
# [Title]
## Executive summary
## Key findings
## Recommendations
```
**Examples pattern** — small, concrete examples help:
```markdown
## Commit message format
**Example 1:**
Input: Added user authentication with JWT tokens
Output: feat(auth): implement JWT-based authentication
```
## Test cases
After drafting, come up with 2–3 realistic test prompts — the kind of thing a real user would actually say. Share them with the user: *"Here are a few test cases I'd like to try. Do these look right, or do you want to add more?"*
Try the skill on each prompt. Read the transcripts (not just the final outputs) to see whether the skill is causing the model to waste effort on unhelpful steps.
## Iterating
- **Generalize from feedback.** Skills will be used many times across many prompts. Avoid overfitting to test cases. If something is stubborn, try a different metaphor or pattern rather than adding more rigid MUSTs.
- **Keep the prompt lean.** Remove instructions that do not pull their weight.
- **Explain the why.** Models follow reasoning better than rote rules.
- **Look for repeated work across test cases.** If multiple runs each independently wrote the same helper script, that is a signal to bundle it under `scripts/` and tell the skill to use it.
After improving the skill, re-run the test prompts and check that the issues are resolved without breaking earlier behavior.
## Description optimization (advanced)
The `description` field is the primary mechanism that determines whether the model invokes a skill. To optimize it:
1. Generate ~20 trigger-eval queries — a mix of should-trigger and should-not-trigger. The should-not-trigger ones should be near-misses, not obvious negatives.
2. Have the user review the eval set.
3. Iterate on the description, testing each version against both train and held-out test queries. Pick the description that performs best on the held-out set, not on train, to avoid overfitting.
## Notes
This is a modified port of `anthropics/skills/skills/skill-creator`. The upstream version ships bundled scripts and an HTML eval viewer (`scripts/aggregate_benchmark.py`, `eval-viewer/generate_review.py`, etc.) that are not included here. The reviewed upstream snapshot is pinned in `UPSTREAMS.json`.
---
**User arguments:** $ARGUMENTS
+6 -2
View File
@@ -4,9 +4,12 @@
"description": "Curated bundle of Claude Code skills ported to OpenCode: code-review, feature-dev, security-review, frontend-design, mcp-builder, skill-creator, and the feature-dev sub-agents.",
"type": "module",
"main": ".opencode/plugins/opencode-power-pack.js",
"engines": {
"node": ">=20",
"opencode": ">=1.18.7"
},
"files": [
"skills",
"commands",
".opencode",
"assets",
"UPSTREAMS.json",
@@ -14,7 +17,8 @@
"LICENSES"
],
"scripts": {
"test": "node --test"
"test": "node --test",
"smoke:opencode": "node scripts/opencode-smoke.mjs 1.18.7"
},
"license": "MIT AND Apache-2.0",
"author": "Wayner Barrios",
+169
View File
@@ -0,0 +1,169 @@
import assert from "node:assert/strict";
import { mkdirSync, mkdtempSync, rmSync } from "node:fs";
import { createServer } from "node:net";
import { tmpdir } from "node:os";
import path from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
import { spawn } from "node:child_process";
const version = process.argv[2] || "1.18.7";
const repo = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const plugin = pathToFileURL(path.join(repo, ".opencode/plugins/opencode-power-pack.js")).href;
const expectedSkills = [
"agents-md-improver",
"agents-md-revise",
"code-architect",
"code-explorer",
"code-review",
"code-reviewer",
"feature-dev",
"frontend-design",
"mcp-builder",
"security-review",
"skill-creator",
];
const expectedAgents = ["code-architect", "code-explorer", "code-reviewer"];
async function availablePort() {
const server = createServer();
await new Promise((resolve, reject) => server.listen(0, "127.0.0.1", resolve).once("error", reject));
const address = server.address();
await new Promise((resolve, reject) => server.close((error) => error ? reject(error) : resolve()));
return address.port;
}
async function waitForServer(url, child, stderr) {
const deadline = Date.now() + 30_000;
while (Date.now() < deadline) {
if (child.exitCode !== null || child.signalCode !== null) {
throw new Error(`OpenCode exited early:\n${stderr.join("")}`);
}
try {
const response = await fetch(`${url}/global/health`, {
headers: { Connection: "close" },
signal: AbortSignal.timeout(1_000),
});
if (response.ok) return;
} catch {
// Startup can take a few seconds while npx resolves the pinned package.
}
await new Promise((resolve) => setTimeout(resolve, 200));
}
throw new Error(`Timed out waiting for OpenCode:\n${stderr.join("")}`);
}
export async function fetchJson(url, timeoutMs = 10_000) {
try {
const response = await fetch(url, {
headers: { Connection: "close" },
signal: AbortSignal.timeout(timeoutMs),
});
if (!response.ok) throw new Error(`${url} returned HTTP ${response.status}`);
return await response.json();
} catch (error) {
if (error.name === "TimeoutError") {
throw new Error(`Request timed out after ${timeoutMs}ms: ${url}`, { cause: error });
}
throw error;
}
}
export async function stopServer(child, graceMs = 5_000) {
if (child.exitCode !== null || child.signalCode !== null) return;
const exited = new Promise((resolve) => child.once("exit", resolve));
try {
if (process.platform === "win32") child.kill("SIGTERM");
else process.kill(-child.pid, "SIGTERM");
} catch (error) {
if (error.code === "ESRCH") return;
throw error;
}
await Promise.race([
exited,
new Promise((resolve) => setTimeout(resolve, graceMs)),
]);
if (child.exitCode !== null || child.signalCode !== null) return;
try {
if (process.platform === "win32") child.kill("SIGKILL");
else process.kill(-child.pid, "SIGKILL");
} catch (error) {
if (error.code === "ESRCH") return;
throw error;
}
await Promise.race([
exited,
new Promise((resolve) => setTimeout(resolve, graceMs)),
]);
}
async function main() {
const home = mkdtempSync(path.join(tmpdir(), "opencode-power-pack-"));
const project = path.join(home, "project");
mkdirSync(project);
const port = await availablePort();
const url = `http://127.0.0.1:${port}`;
const stderr = [];
const child = spawn(
process.platform === "win32" ? "npx.cmd" : "npx",
["-y", `opencode-ai@${version}`, "serve", "--hostname", "127.0.0.1", "--port", String(port)],
{
cwd: project,
env: {
...process.env,
HOME: home,
XDG_CONFIG_HOME: path.join(home, "config"),
npm_config_cache: process.env.npm_config_cache || path.join(process.env.HOME || tmpdir(), ".npm"),
OPENCODE_CONFIG_CONTENT: JSON.stringify({ plugin: [plugin] }),
},
detached: process.platform !== "win32",
stdio: ["ignore", "ignore", "pipe"],
},
);
child.stderr.on("data", (chunk) => stderr.push(chunk.toString()));
try {
await waitForServer(url, child, stderr);
const commands = await fetchJson(`${url}/command`);
const agents = await fetchJson(`${url}/agent`);
for (const name of expectedSkills) {
const command = commands.find((entry) => entry.name === name);
assert.ok(command, `native command exists for ${name}`);
assert.equal(command.source, "skill", `${name} command comes from its skill`);
}
for (const name of expectedAgents) {
const agent = agents.find((entry) => entry.name === name);
assert.ok(agent, `${name} agent exists`);
assert.equal(agent.mode, "subagent");
assert.equal(
agent.permission.findLast((rule) => rule.permission === "read" && rule.pattern === "*.env")?.action,
"deny",
`${name} cannot read environment files`,
);
assert.equal(
agent.permission.findLast((rule) => rule.permission === "edit" && rule.pattern === "*")?.action,
"deny",
`${name} cannot edit files`,
);
}
const reviewer = agents.find((entry) => entry.name === "code-reviewer");
assert.equal(
reviewer.permission.findLast((rule) => rule.permission === "bash" && rule.pattern === "git *--output*")?.action,
"deny",
"code-reviewer cannot write through Git output options",
);
console.log(`OpenCode ${version}: ${expectedSkills.length} native commands and ${expectedAgents.length} agents verified`);
} finally {
try {
await stopServer(child);
} finally {
rmSync(home, { recursive: true, force: true });
}
}
}
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) await main();
-6
View File
@@ -5,7 +5,6 @@ import { join } from "node:path";
const REPO = process.env.REPO || process.cwd();
const skill = readFileSync(join(REPO, "skills/agents-md-revise/SKILL.md"), "utf8");
const command = readFileSync(join(REPO, "commands/agents-md-revise.md"), "utf8");
// Content-regression guards for the first-match-wins / shadowed-CLAUDE.md fix.
@@ -17,8 +16,3 @@ test("agents-md-revise: warns against writing to a shadowed CLAUDE.md", () => {
assert.match(skill, /shadow|never read|ignore/i);
assert.match(skill, /CLAUDE\.md/);
});
test("agents-md-revise: command stays in sync with the skill", () => {
assert.match(command, /first-match-wins/i);
assert.match(command, /shadow|ignore/i);
});
-8
View File
@@ -5,7 +5,6 @@ import { join } from "node:path";
const REPO = process.env.REPO || process.cwd();
const skill = readFileSync(join(REPO, "skills/frontend-design/SKILL.md"), "utf8");
const command = readFileSync(join(REPO, "commands/frontend-design.md"), "utf8");
// Content-regression guards: these encode the improvement so it can't silently rot.
@@ -31,14 +30,7 @@ test("frontend-design: keeps the optional, cross-platform validation note", () =
assert.match(skill, /opt-in|optional/i);
});
test("frontend-design: command inlines the rubric (stays in sync)", () => {
assert.match(command, /##\s*Self-critique/i);
assert.ok(command.includes("prefers-reduced-motion"));
assert.ok(command.includes("html-validate"));
});
test("frontend-design: enforces variety / anti-convergence across generations", () => {
assert.match(skill, /Vary across generations/i);
assert.match(skill, /diverge/i);
assert.ok(command.includes("Vary across generations"), "command must inline the variety rule too");
});
+34
View File
@@ -0,0 +1,34 @@
import { once } from "node:events";
import { createServer } from "node:http";
import { spawn } from "node:child_process";
import { test } from "node:test";
import assert from "node:assert/strict";
import { fetchJson, stopServer } from "../scripts/opencode-smoke.mjs";
test("fetchJson aborts a stalled OpenCode response", async () => {
const server = createServer(() => {});
server.listen(0, "127.0.0.1");
await once(server, "listening");
const { port } = server.address();
try {
await assert.rejects(fetchJson(`http://127.0.0.1:${port}/agent`, 50), /timed out/i);
} finally {
server.closeAllConnections();
server.close();
}
});
test("stopServer tolerates a child that already exited by signal", async () => {
const child = spawn(process.execPath, ["-e", "setInterval(() => {}, 1000)"], {
detached: process.platform !== "win32",
stdio: "ignore",
});
if (process.platform === "win32") child.kill("SIGKILL");
else process.kill(-child.pid, "SIGKILL");
await once(child, "exit");
await stopServer(child, 50);
assert.notEqual(child.signalCode, null);
});
+38
View File
@@ -0,0 +1,38 @@
import { test } from "node:test";
import assert from "node:assert/strict";
import { execFileSync, spawnSync } from "node:child_process";
import { existsSync, readdirSync } from "node:fs";
import { join } from "node:path";
const REPO = process.env.REPO || process.cwd();
test("published package relies on native commands and ships every skill", () => {
const output = execFileSync("npm", ["pack", "--dry-run", "--json"], {
cwd: REPO,
encoding: "utf8",
});
const [{ files }] = JSON.parse(output);
const packaged = new Set(files.map((file) => file.path));
const skillNames = readdirSync(join(REPO, "skills"))
.filter((name) => existsSync(join(REPO, "skills", name, "SKILL.md")));
assert.equal(
files.some((file) => file.path.startsWith("commands/")),
false,
"legacy command copies are not published",
);
for (const name of skillNames) {
assert.ok(packaged.has(`skills/${name}/SKILL.md`), `${name} is published`);
}
});
test("plugin loads as an ES module without runtime warnings", () => {
const result = spawnSync(
process.execPath,
["--input-type=module", "--eval", "await import('./.opencode/plugins/opencode-power-pack.js')"],
{ cwd: REPO, encoding: "utf8" },
);
assert.equal(result.status, 0, result.stderr);
assert.equal(result.stderr, "");
});
-2
View File
@@ -48,9 +48,7 @@ test("distributed artifacts carry matching third-party license notices", () => {
for (const entry of manifest.skills) {
const expected = `${entry.license} (modified`;
const skill = frontmatter(join(REPO, "skills", entry.name, "SKILL.md"));
const command = frontmatter(join(REPO, "commands", `${entry.name}.md`));
assert.ok(skill.license?.startsWith(expected), `${entry.name}: skill marks the source as modified`);
assert.ok(command.license?.startsWith(expected), `${entry.name}: command marks the source as modified`);
}
for (const path of ["UPSTREAMS.json", "THIRD_PARTY_NOTICES.md", "LICENSES"]) {
-14
View File
@@ -19,8 +19,6 @@ function parse(md) {
return { fm, body: m ? m[2] : md, hasFrontmatter: !!m };
}
const norm = (s) => s.replace(/\s+/g, " ").trim();
const skillsDir = join(REPO, "skills");
const names = readdirSync(skillsDir).filter((n) =>
existsSync(join(skillsDir, n, "SKILL.md"))
@@ -28,7 +26,6 @@ const names = readdirSync(skillsDir).filter((n) =>
for (const name of names) {
const skill = parse(readFileSync(join(skillsDir, name, "SKILL.md"), "utf8"));
const cmdPath = join(REPO, "commands", `${name}.md`);
test(`${name}: SKILL.md frontmatter`, () => {
assert.ok(skill.hasFrontmatter, "has YAML frontmatter");
@@ -43,18 +40,8 @@ for (const name of names) {
assert.ok(skill.body.split(/\r?\n/).length < 500);
});
test(`${name}: command in sync with SKILL.md`, () => {
assert.ok(existsSync(cmdPath), `commands/${name}.md exists`);
const cmd = parse(readFileSync(cmdPath, "utf8"));
assert.equal(cmd.fm.description, skill.fm.description, "description identical skill<->command");
assert.ok(norm(cmd.body).includes(norm(skill.body)), "command inlines the SKILL.md body");
assert.match(cmd.body, /\$ARGUMENTS\s*$/, "command ends with $ARGUMENTS");
});
test(`${name}: descriptions not truncated`, () => {
assert.match((skill.fm.description ?? "").trim(), SENTENCE_END, "SKILL.md description not truncated");
const cmd = parse(readFileSync(cmdPath, "utf8"));
assert.match((cmd.fm.description ?? "").trim(), SENTENCE_END, "command description not truncated");
});
test(`${name}: no duplicated block`, () => {
@@ -69,6 +56,5 @@ for (const name of names) {
}
};
check("SKILL.md", readFileSync(join(skillsDir, name, "SKILL.md"), "utf8"));
check("command", readFileSync(cmdPath, "utf8"));
});
}
-4
View File
@@ -10,11 +10,9 @@ const read = (p) => readFileSync(join(REPO, p), "utf8");
for (const name of ["feature-dev", "code-architect", "mcp-builder"]) {
test(`${name}: Working discipline section present`, () => {
const s = read(`skills/${name}/SKILL.md`);
const c = read(`commands/${name}.md`);
assert.match(s, /##\s*Working discipline/);
assert.match(s, /Simplicity first/);
assert.match(s, /Surgical changes/);
assert.ok(c.includes("Working discipline"), "command must inline the section");
});
}
@@ -22,8 +20,6 @@ for (const name of ["feature-dev", "code-architect", "mcp-builder"]) {
for (const name of ["code-review", "code-reviewer"]) {
test(`${name}: flags scope creep / speculative complexity`, () => {
const s = read(`skills/${name}/SKILL.md`);
const c = read(`commands/${name}.md`);
assert.match(s, /scope creep/i);
assert.match(c, /scope creep/i);
});
}