From elegance
Code refinement and multi-agent adversarial debate. Pass a file path for deep code analysis, or a question for council debate with 14 specialized agents. Confirms before every change.
How this skill is triggered — by the user, by Claude, or both
Slash command
/elegance:eleganceThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Find the version that was always meant to be written.
Find the version that was always meant to be written.
NEVER make changes without presenting them first and getting explicit user confirmation. Show the before, show the after, explain WHY the new version is better. Every proposed change must be confirmed.Before Mode 1 or Mode 2 dispatches, check that the code in scope isn't reinventing wheels already turning in the user's shared infra. Runs once per project per session, tracked via a flag file. This is a cross-cutting gate — both Mode 1 and Mode 2 run it before their own phases begin.
Flag: ~/.claude/state/elegance-reuse-sweep/<cwd-slug>.flag (slug = pwd | sed 's|/|_|g'). If the flag exists and was modified < 24h ago, the sweep is skipped. Ensure ~/.claude/state/elegance-reuse-sweep/ exists before writing.
Scope (what to check against):
~/shared/llm_providers/ — especially ProviderFactory in factory.py (unified interface to 12 LLM providers: Anthropic, OpenAI, xAI, Mistral, Cohere, Gemini, Perplexity, Groq, HuggingFace, Manus, ElevenLabs, Ollama). Direct use of anthropic., openai., google.generativeai, or raw requests.post to LLM hosts is a duplication flag.~/shared/utils/, ~/shared/web/sse_helpers.py, ~/shared/data_fetching/ (17 API clients: arXiv, Census, GitHub, NASA, Wikipedia, YouTube, News, Weather, OpenLibrary, Semantic Scholar, Wayback, FEC, Judiciary, Finance, PubMed, Wolfram), ~/shared/orchestration/ (DreamCascade, DreamSwarm).~/SNIPPETS/ — index at ~/SNIPPETS/CLAUDE.md. Focus on by-pattern/, api-clients/, async-patterns/, database-patterns/, data-pipelines/.Sweep procedure:
Reuse sweep already ran this session (flag: <path>, age: <Xh>) and continue to mode dispatch. Skip steps 2–4.Level: cruft, Confidence: high with the shared import as the proposed change. Respects HARD-GATE — confirm before applying.@reconnaissance as part of Phase 2 fact-finding so the council works from them.Overrides:
/elegance --resweep ... forces a sweep even when the flag is fresh./elegance --no-sweep ... skips the sweep entirely (for tight iteration loops).Elegance has two modes. The input determines which runs:
Triggers: /elegance src/, /elegance app.tsx, /elegance (no args = recent git changes)
Run the elegance-analyzer agent for 5-pass code scanning (contract extraction, cruft, duplication, conflicts, first-principles rethink, elegance synthesis). Present findings interactively with confirmation.
Size gate:
Process: Same as v1 — scan, rank by impact x confidence, present one finding at a time, confirm before applying, run tests after each change.
Triggers: /elegance "Should we rewrite this auth module?", /elegance "What's the best approach for real-time updates?"
Convene the council — multiple agents with opposing optimization targets analyze the question in parallel, debate, and produce a synthesis with dissenting opinions preserved.
Detection: If the input is quoted text, contains a question mark, or clearly isn't a file path — it's a council question.
Display banner, then:
When in doubt, seat the domain guest.
Launch two agents in parallel — facts before opinions:
Wait for both to complete before Phase 3.
Launch all remaining seated agents in parallel with fact-finding results. Each agent produces:
- **Claim**: [one sentence]
- **Mechanism**: [how/why, with code or specifics]
- **Risks**: [what could go wrong]
- **Evidence**: [code refs, sources, logic]
Core agents:
Plus any seated domain guests (@conscience, @radiance, @cadence).
Score findings against rubric:
| Criterion | Weight |
|---|---|
| Correctness | 25% |
| Risk | 20% |
| Fit (Coherence) | 15% |
| Verifiability (Assurance) | 15% |
| Maintainability | 15% |
| User impact | 10% |
Produce output, then pass to @eloquence for humanization (post-verdict only).
## Decision: [one-line summary]
### Recommended Approach
[The winning proposal with rationale]
### Key Evidence
- [Reconnaissance findings]
- [Brilliance findings]
### Risk Assessment
- [Vigilance's top concerns]
- [Resilience's mitigation strategies]
### Verification Plan
[Assurance's testing strategy]
### Architecture Fit
[Coherence's assessment]
### Attribution
[Provenance's findings]
### Dissenting Opinions
- **Defiance**: [strongest counterargument]
- [Any other unresolved disagreements]
### Rejected Alternatives
[What was considered and why it lost]
### [area/file] — [finding title]
**Level:** cruft | simplify | elegant
**Impact:** high | medium | low
**Confidence:** high | medium | low
**Risk:** low | medium | high
**What I found:** [current state]
**Why it matters:** [what's wrong or opportunity]
**Proposed change:** [before/after]
**Contract check:** [how rewrite preserves behavior]
**Apply this change? (y/n)**
| Agent | Color | Phase | Role |
|---|---|---|---|
| @elegance-analyzer | magenta | Mode 1 / Phase 3 | 5-pass code refinement |
| @governance | yellow | Phase 1, 4 | Orchestrator, synthesis |
| @reconnaissance | blue | Phase 2 | Inward fact-finding |
| @brilliance | cyan | Phase 2 | Outward fact-finding |
| @vigilance | red | Phase 3 | Adversarial attack |
| @defiance | magenta | Phase 3 | Structured dissent |
| @resilience | green | Phase 3 | Error recovery |
| @provenance | white | Phase 3 | Attribution, licensing |
| @assurance | yellow | Phase 3 | Testing, verification |
| @coherence | blue | Phase 3 | Architecture fit |
| @eloquence | cyan | Post | Humanization |
| @conscience | green | Phase 3 (domain) | Accessibility |
| @radiance | magenta | Phase 3 (domain) | Data visualization |
| @cadence | yellow | Phase 3 (domain) | Embedded/firmware |
Searches MemPalace before answering questions about past work, people, projects, or prior decisions. Returns verbatim stored content instead of guessing from model memory.
Guides Payload CMS config (payload.config.ts), collections, fields, hooks, access control, APIs. Debugs validation errors, security, relationships, queries, transactions, hook behavior.
Implements vector databases with Pinecone, Weaviate, Qdrant, Milvus, pgvector for semantic search, RAG, recommendations, and similarity systems. Optimizes embeddings, indexing, and hybrid search.
npx claudepluginhub actually-useful-ai/elegance --plugin elegance