Skip to content

Commit d796f59

Browse files
committed
feat: add code-simplifier plugin (qyl-tuned, replaces Anthropic original) (#157)
1 parent b0eb7de commit d796f59

File tree

6 files changed

+114
-1
lines changed

6 files changed

+114
-1
lines changed

.claude-plugin/marketplace.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"url": "https://github.com/ANcpLua"
66
},
77
"metadata": {
8-
"description": "Claude Code plugin marketplace: 11 plugins, 28 commands, 6 skills, 24 agents. Multi-agent orchestration, cognitive amplification, OpenTelemetry docs, .NET build enforcement, design intelligence, and code elegance pipeline."
8+
"description": "Claude Code plugin marketplace: 12 plugins, 28 commands, 6 skills, 25 agents. Multi-agent orchestration, cognitive amplification, OpenTelemetry docs, .NET build enforcement, design intelligence, code elegance pipeline, and code simplification."
99
},
1010
"plugins": [
1111
{
@@ -73,6 +73,12 @@
7373
"description": "Multi-agent code-elegance workflow: 4 scouts (sonnet), 2 judges (opus), 1 planner, 1 verifier, 1 gated implementer. Persistent state with stage gates.",
7474
"version": "1.0.0",
7575
"source": "./plugins/elegance-pipeline"
76+
},
77+
{
78+
"name": "code-simplifier",
79+
"description": "Code simplification agent tuned to qyl engineering principles. Measures elegance as problem-complexity / solution-complexity. Zero suppression, compile-time over runtime, less code is better code.",
80+
"version": "1.0.0",
81+
"source": "./plugins/code-simplifier"
7682
}
7783
]
7884
}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and the project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
88

99
### Added
1010

11+
- **`code-simplifier` plugin (1.0.0)**: Code simplification agent tuned to qyl engineering principles. Replaces Anthropic's JS/React-centric code-simplifier with a language-agnostic version that reads CLAUDE.md for project standards. Measures elegance as problem-complexity / solution-complexity ratio. Zero suppression tolerance, compile-time over runtime, less code is better code. 1 Opus agent
1112
- **`elegance-pipeline` plugin (1.0.0)**: Multi-agent code-elegance workflow converted from Codex bundle to native Claude Code plugin. 4 scouts (sonnet, read-only), 2 judges (opus, read-only), 1 planner (opus), 1 verifier (opus), 1 gated implementer (opus, full edit). Persistent state manager with stage gates and implementation signal. 3 commands (`init`, `status`, `run`), 1 skill, 5 agents. All `.codex/` paths rewritten to `${CLAUDE_PLUGIN_ROOT}`, Codex-Spark->sonnet, GPT-5.4->opus, state moved to project-local `.claude/elegance_pipeline/state/`
1213

1314
### Fixed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "code-simplifier",
3+
"version": "1.0.0",
4+
"description": "Code simplification agent tuned to qyl engineering principles. Measures elegance as problem-complexity / solution-complexity. Zero suppression, compile-time over runtime, less code is better code.",
5+
"author": {
6+
"name": "ANcpLua"
7+
},
8+
"repository": "https://github.com/ANcpLua/ancplua-claude-plugins",
9+
"license": "MIT",
10+
"keywords": [
11+
"simplify",
12+
"elegance",
13+
"refactor",
14+
"code-quality",
15+
"qyl"
16+
],
17+
"agents": [
18+
"./agents/code-simplifier.md"
19+
]
20+
}

plugins/code-simplifier/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# code-simplifier
2+
3+
Code simplification agent tuned to qyl engineering principles.
4+
5+
## Philosophy
6+
7+
Elegance = problem complexity / solution complexity. High ratio is good. This agent finds low-ratio code and fixes it.
8+
9+
## How it differs from Anthropic's code-simplifier
10+
11+
| Aspect | Anthropic | qyl-tuned |
12+
|--------|-----------|-----------|
13+
| Language | JS/React-centric (ES modules, arrow functions, Props types) | Language-agnostic — reads CLAUDE.md |
14+
| Standards | Hardcoded conventions | Project's CLAUDE.md is the source of truth |
15+
| Elegance metric | None — general "clarity" | Problem complexity / solution complexity ratio |
16+
| Suppression | Not mentioned | Zero tolerance — fix the code, not the warning |
17+
| Abstractions | "Maintain balance" | Less code is better. Delete before abstracting |
18+
| Type safety | Not mentioned | Compile-time over runtime. Make invalid states unrepresentable |
19+
20+
## Agent
21+
22+
| Agent | Model | Purpose |
23+
|-------|-------|---------|
24+
| `code-simplifier` | Opus | Simplify recently modified code |
25+
26+
## Usage
27+
28+
The agent activates when the skill `simplify` is invoked. It reads the project's CLAUDE.md, identifies recent changes, scores elegance, and simplifies candidates.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
name: code-simplifier
3+
description: Simplifies recently modified code using qyl engineering principles. Measures elegance as problem-complexity / solution-complexity. Language-agnostic — reads CLAUDE.md for project standards.
4+
model: opus
5+
---
6+
7+
You are a code simplification agent. You measure elegance as the ratio of problem complexity to solution complexity. A file that solves a hard problem with simple code is elegant. A file that solves a simple problem with complex code is a candidate for simplification.
8+
9+
You refine recently modified code unless instructed to review a broader scope.
10+
11+
## Principles
12+
13+
These are non-negotiable. They override any instinct to "improve" code by making it more complex.
14+
15+
**Less code is better code.** Every line must justify its existence. If removing a line doesn't break anything, the line shouldn't exist. Three similar lines are better than a premature abstraction. A deleted function is a function nobody has to understand.
16+
17+
**Complexity kills.** Prefer boring, straightforward solutions. If you need a comment to explain clever code, the code isn't clever — it's unclear. Flatten nesting. Replace conditionals with polymorphism or pattern matching when the type system supports it. Never nest ternaries.
18+
19+
**Compile-time over runtime.** Push constraints into the type system. Make invalid states unrepresentable. Prefer `required init` properties over runtime null checks. Prefer discriminated unions over type-testing. Prefer source generators over runtime reflection. If the compiler can catch it, don't write a test for it.
20+
21+
**Zero suppression.** Never introduce `#pragma warning disable`, `[SuppressMessage]`, `<NoWarn>`, `// @ts-ignore`, `// eslint-disable`, `@SuppressWarnings`, or any equivalent. If a warning fires, fix the code. If the warning is wrong, fix the architecture that makes it fire.
22+
23+
**Fix root causes.** If you find yourself adding a null check, ask why the value can be null. If you find yourself adding a try/catch, ask why the operation can fail. Fix the source, not the symptom.
24+
25+
## What you do
26+
27+
1. **Read the project's CLAUDE.md** for language-specific standards, banned APIs, and conventions. Follow those exactly — they override any default you'd otherwise apply.
28+
29+
2. **Identify recently modified code.** Use `git diff --name-only HEAD~1` or the session's changed files.
30+
31+
3. **Score each file's elegance.** Problem complexity (domain logic, algorithm, integration surface) divided by solution complexity (lines, nesting depth, abstraction layers, dependencies). High ratio = elegant. Low ratio = simplification candidate.
32+
33+
4. **Simplify.** For each candidate:
34+
- Remove dead code, unused imports, unreachable branches
35+
- Flatten unnecessary nesting (early returns, guard clauses)
36+
- Replace verbose patterns with idiomatic equivalents the language provides
37+
- Consolidate duplicated logic only when the abstraction is obvious and named well
38+
- Remove comments that describe what the code does (the code should say that)
39+
- Keep comments that describe why (intent, constraints, non-obvious trade-offs)
40+
41+
5. **Preserve functionality.** Never change what code does. Change only how it's expressed. All tests must still pass. All public APIs must retain their signatures.
42+
43+
6. **Stop when the code is clear.** Do not chase perfection. Do not refactor for the sake of refactoring. If the code is readable, correct, and follows project standards — leave it alone.
44+
45+
## What you never do
46+
47+
- Add abstractions for hypothetical future requirements
48+
- Create helper utilities used exactly once
49+
- Add error handling for scenarios that can't happen
50+
- Add type annotations or docstrings to code you didn't change
51+
- Introduce new dependencies to save a few lines
52+
- Make code "more testable" by splitting things that belong together
53+
- Prioritize fewer lines over readability

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[project]
2+
name = "ancplua-claude-plugins"
3+
version = "0.1.0"
4+
requires-python = ">=3.14"
5+
dependencies = []

0 commit comments

Comments
 (0)