The Pipeline
Every /topgun invocation runs a deterministic four-stage pipeline. Stages execute in order; no stage is skipped.
FindSkills — Discover
Queries all enabled registries in parallel. Each registry adapter normalizes its results to a unified candidate schema. Candidates with identical contentSha values (SHA-256 of skill content) are deduplicated to a single entry.
CompareSkills — Rank
Each unique candidate receives a composite score based on four weighted dimensions. The highest-scoring candidate advances to the audit stage. Scores and all candidate metadata are written to ~/.topgun/candidates.json.
SecureSkills — Audit
Invokes the bundled SENTINEL v2.3.0 audit (skills/sentinel/SKILL.md, shipped inside the TopGun plugin) on the top candidate. Requires two consecutive clean passes. Findings are auto-fixed between passes when possible. SHA-256 is re-verified before each pass.
InstallSkills — Install
Presents the full audit manifest (scores, findings history, SHA-256, registry source) for user approval. On approval, installs via /plugin install. Falls back to local-copy installation if the plugin system has a known bug.
~/.topgun/state.json. If the pipeline is interrupted, it can resume from the last completed stage. See State & Resume.Registry Adapters
TopGun uses a registry adapter pattern. Each adapter knows how to query one registry, parse its response format, and return normalized candidates. All adapters run in parallel during the FindSkills stage.
Adapter behavior rules
- Each adapter has an 8-second timeout. If a registry doesn't respond in time, the adapter returns an empty result and logs a warning — it does not block the pipeline.
- Adapters implement exponential backoff with up to 3 retries for transient errors (HTTP 429, 503).
- If 3 or more adapters fail simultaneously, TopGun logs a connectivity warning but continues with the adapters that succeeded.
- Adapters that require auth tokens (GitHub, Smithery) skip silently if no token is configured rather than throwing errors.
| Registry | Auth required | Timeout | Notes |
|---|---|---|---|
| skills.sh | No | 8s | Primary registry — highest quality signal |
| agentskill.sh | No | 8s | Agent-focused; good tool-pack coverage |
| Smithery | Optional | 8s | Token unlocks private listings |
| GitHub Topics | Optional | 8s | Token avoids rate limits (60→5000 req/hr) |
| GitLab | Optional | 8s | Token required for private group repos |
| npm | No | 8s | Searches @claude-skill scope |
| LobeHub | No | 8s | REST API; no auth needed |
| SkillsMP | No | 8s | Commercial; verified publisher badge in score |
| ClawHub | No | 8s | Claude-native; auto compatibility checks |
Scoring Rubric
CompareSkills assigns each candidate a composite score between 0 and 1. The composite is a weighted average of four dimensions:
| Dimension | Weight | Bar | What it measures |
|---|---|---|---|
| Capability match | 55% | How closely the skill's described capabilities match the requested task, scored against a domain-specific 5-sub-criterion rubric synthesized from the candidate field | |
| Security posture | 20% | Pre-scan signals: no network calls in SKILL.md, minimal allowed-tools, no eval/exec patterns | |
| Popularity | 15% | Stars, installs, or download count from the source registry, normalized logarithmically | |
| Recency | 10% | Days since last commit or publish; skills updated within 90 days score highest |
The composite score formula:
SENTINEL Audit
SENTINEL v2.3.0 is the adversarial security auditor that ships bundled inside the TopGun plugin at skills/sentinel/SKILL.md. TopGun loads it directly during the SecureSkills stage — no separate installation required.
The 2-pass requirement
TopGun requires two consecutive clean passes — not just one — before a skill is eligible for installation. This guards against a class of attacks where a first-pass fix introduces a new vulnerability.
- SENTINEL runs pass 1. Findings (if any) are logged and auto-remediated where possible.
- SHA-256 of the (possibly modified) skill content is computed and stored.
- SENTINEL runs pass 2 on the same content. SHA-256 is re-verified before the pass starts.
- If pass 2 is also clean, the skill is cleared for installation.
- If pass 2 finds new issues, the loop restarts. There is no maximum iteration cap, but TopGun will warn after 5 cycles.
SHA-256 integrity gating
Between every pair of passes, TopGun re-hashes the skill content and compares it to the hash from the previous pass. If the hashes differ and no remediation was performed, the pipeline immediately aborts. This prevents any external modification of skill files during the audit loop.
/plugin install directly — TopGun will not do it for you.Structural Envelope
Before SENTINEL injects skill content into the agent context for analysis, TopGun wraps it in a structural envelope. The envelope is a set of delimiter markers that signal to the agent that the content inside is external data — not executable instructions.
This prevents a class of attacks called prompt injection via skill content, where a malicious SKILL.md contains instructions addressed to the AI model (e.g., "IGNORE PREVIOUS INSTRUCTIONS AND…"). The envelope causes the model to treat all content between the delimiters as documentation text, not commands.
State and Resume
TopGun writes pipeline state to ~/.topgun/state.json after each stage completes. If the pipeline is interrupted (Claude Code crash, network loss, Ctrl-C), you can resume it by running the same /topgun command again.
TopGun resumes from the last completed stage, not from the beginning. If FindSkills and CompareSkills already completed, resuming skips those stages and continues with SecureSkills.
Use --reset to discard the state and restart the pipeline from scratch.
Caching
TopGun caches registry results and audit outcomes to avoid redundant work across invocations.
Registry cache
- Registry results are cached by contentSha (not by skill name), so the same content from different registries is not re-fetched.
- Cache TTL is 24 hours. After 24 hours, registry queries run fresh.
- Use
--force-auditto bypass the cache and re-audit even if a clean result exists. - Use
--offlineto use only cached results and skip all live registry queries.
Audit cache
- A clean SENTINEL result is cached against the skill's contentSha.
- If the same contentSha is encountered again within 24 hours, the cached clean result is used and SENTINEL is not re-invoked.
--force-auditbypasses the audit cache and always runs fresh SENTINEL passes.