swing-skills
TheStack-ai · TheStack-ai/swing-skills
Open-source Claude Code skills providing six cognitive firewalls to block AI hallucination, bias, and sloppy reasoning, enhancing agent reliability.
Open-source Claude Code skills — 6 cognitive firewalls block AI hallucination, bias & sloppy reasoning. npx skills add
Preview
What you can do with it
- Force Claude to provide sourced, verified answers for research queries.
- Improve the rigor and depth of AI code reviews by preventing superficial assessments.
- Equip AI agents with guardrails to make them push back and question assumptions.
Safety check
No risky patterns found in the files we scanned.
Automated scan of the repo files. Always review code you run.
From the README
Swing — AI Agent Guardrails for Claude Code
English · 한국어 (Korean)
Your AI is not swinging at all.
It picks the safe default, agrees when it should push back, cites no sources, hides its reasoning, and assumes everything will work. Six cognitive failures. Six firewalls. Make it swing.
npx skills add thestack-ai/swing-skills --all
Built for Claude Code | Compatible with AI agents via Agent Skills open standard Created by @thestack_ai
See the Difference
Before: Default AI Research
You: Is SQLite viable for an app with 1000 concurrent users?
AI: No, SQLite is not suitable for high-concurrency applications. Use PostgreSQL or MySQL instead for production workloads.
After: With swing-research
You: /swing-research Is SQLite viable for an app with 1000 concurrent users?
AI: Yes, with caveats. 1000 concurrent users ≠ 1000 concurrent writes. Typical web apps generate ~30 concurrent write transactions at this scale. SQLite handles ~120 write transactions/sec in WAL mode (verified: sqlite.org benchmarks + Expensify production case study serving 10M+ users on SQLite). The real constraint is write contention above ~100 concurrent writers, not user count.
Sources: 🏛️ sqlite.org WAL documentation, 🛡️ Expensify engineering blog (2024), ⚠️ HN discussion (corroborated)
The baseline gave a wrong answer confidently. The skill forced source verification and reached the opposite — correct — conclusion.
Before: Default AI Code Review
You: Review this JWT auth module
AI: The code looks well-structured. Consider adding more comments and using TypeScript for better type safety. Variable naming could be improved in some places.
After: With swing-review
You: /swing-review Review this JWT auth module
AI: Steel-man: JWT-based stateless auth was chosen for horizontal scaling. The 15-min access + 7-day refresh split balances security and UX.
🔴 Critical: No refresh token rotation. A stolen token grants persistent 7-day access with no detection. Fix: implement token family chain rotation.
🟠 Major: Rate limiting uses in-memory Map(). Resets on restart, bypassed in multi-instance deploys. Fix: move to Redis with TTL.
Verdict: PASS WITH CONDITIONS — must fix token rotation before deploy.
The baseline found nothing. The skill found a Critical security vulnerability.
Six Failures, Six Firewalls
| Cognitive Failure | What Happens | Firewall | What It Forces |
|---|---|---|---|
| Premature closure | AI rushes to execute on ambiguous requests | swing-clarify | Structured clarification before execution begins |
| Hallucination | AI states claims without verification | swing-research | Source-traced, cross-verified claims with S/A/B/C tier grading |
| Anchoring bias | AI locks onto the first "obvious" answer | swing-options | 5 probability-weighted options including unconventional alternatives |
| Confirmation bias | AI agrees with you instead of challenging | swing-review | Steel-man then 3-vector attack. "Looks good" is structurally banned |
| Black-box reasoning | AI gives conclusions without showing why | swing-trace | Assumption inventory and weakest-link analysis |
| Optimism bias | AI assumes the plan will work | swing-mortem | Assumes failure, identifies 5 specific failure scenarios with circuit breakers |
Skills
swing-clarify
Prevents premature execution on ambiguous requests.
Request → 5W1H Decomposition → Ambiguity Score → Clarify or Proceed
- Breaks every request into 6 dimensions: What, Who, Where, When, Why, How
- Scores ambiguity (0-6) — clear requests get a green light, ambiguous ones get up to 3 questions
- Every question includes multiple choice options and a stated default assumption
- Designed to run FIRST — before any other skill in the chain
Try: /swing-clarify Build me an auth system
swing-research
4-stage verified research pipeline with anti-hallucination safeguards.
Deconstruct → Search & Collect → Cross-Verify → Synthesize
- Every claim must be traced to a specific, citable source — or labeled
Unverified - Source tiering: S (academic/specs), A (official docs), B (community — flagged), C (general)
- Cross-verification: key claims require 2+ independent sources (same-origin rewrites don't count)
- Adaptive depth: narrow questions get 2-3 queries, broad landscape gets 8+
Try: /swing-research Is gRPC better than REST for mobile backends?
swing-options
Probability-weighted option generator that breaks anchoring bias.
- 5 options by default, each assigned a typicality zone (Conventional → Wild card)
- At least 1 option from the unconventional or wild card zone — ideas your AI normally suppresses
- Hidden Assumptions section exposes why the obvious answer seems obvious
- Decision matrix with criteria derived from your stated constraints + 1 hidden criterion you didn't consider
Try: /swing-options Which database for a real-time leaderboard?
swing-review
Structured Devil's Advocate that finds real problems, not nitpicks.
- Steel-man first: articulates the strongest case FOR the current approach before attacking
- 3 independent vectors: Logical Soundness / Edge Case Assault / Structural Integrity
- Severity classification: Critical (must fix) / Major (should fix) / Minor / Note
- Every Critical and Major finding includes a counter-proposal with trade-off analysis
- Explicit verdict thresholds: any unmitigated Critical = FAIL
Try: /swing-review We chose Kubernetes for our 3-person startup
swing-trace
Makes AI reasoning visible, auditable, and decomposable.
- Assumption inventory: every assumption numbered, rated for criticality and verifiability
- **Decision