principles
/principles
Pomaga projektować funkcje, moduły i przepływy danych zgodnie z zasadami architektury, kodu, wydajności i bezpieczeństwa oraz z kontrolami: zawsze, zapytaj, nigdy.
- Autor
- ongtungduong ↗
- Repozytorium
- legion ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 12.11.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 8
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 12.11.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Pomaga projektować funkcje, moduły i przepływy danych zgodnie z zasadami architektury, kodu, wydajności i bezpieczeństwa oraz z kontrolami: zawsze, zapytaj, nigdy.
Oryginalny opis (EN)
Gets design and code right the first time with four rule references: system design (boundaries, domain model, data consistency, failure handling), coding (readable construction, refactoring, legacy code), performance (designing for load, measured optimization), and security (trust boundaries, abuse cases, always / ask-first / never controls). Use when designing a function, class, module interface, API, service, domain model, or data flow; when asked to refactor, clean up, simplify, restructure, or make code maintainable without changing behavior; to change legacy code that has no tests; to add
Jak działa
- Workflow
- Choosing the references
- Output format
- Gotchas
Podgląd SKILL.md
---
name: principles
description: >-
Gets design and code right the first time with four rule references: system
design (boundaries, domain model, data consistency, failure handling),
coding (readable construction, refactoring, legacy code), performance
(designing for load, measured optimization), and security (trust
boundaries, abuse cases, always / ask-first / never controls). Use when
designing a function, class, module interface, API, service, domain model,
or data flow; when asked to refactor, clean up, simplify, restructure, or
make code maintainable without changing behavior; to change legacy code
that has no tests; to add timeouts, retries, or circuit breakers; to make
code, an endpoint, or a query faster, cut latency, memory, or bundle size,
fix an N+1 query, or get Core Web Vitals (LCP, INP, CLS) under a target; or
when writing or hardening code that handles untrusted input, login, sessions,
authorization, secrets, uploads, user-supplied URLs, third-party packages,
personal data, or LLM output, even when the code is pasted inline.
license: MIT
metadata:
author: ongtungduong
---
# Principles
Decide the design before the code, then write the code to rules that hold
it there. The rules live in four references (system design, coding,
performance, security), each a synthesis of the classic books with their
contradictions already settled, each ending in a final checklist. Load only
the ones the change needs: a design fixed after the code exists costs a
rewrite, and a rule list nobody needed dilutes the ones that matter.
## Workflow
1. **Repo standards first.** Read `CONTRIBUTING.md`,
`AGENTS.md`/`CLAUDE.md`, lint configs, and the patterns of the
surrounding code. They are facts; a documented project convention
overrides any rule here except the `security` reference, and the
references fill the gaps.
2. **Pick the references** from the table below, or load exactly the ones
on the plan's `Design principles` line so implementer and reviewer apply
the same standard. Read each with the Read tool at
`<this skill's base directory>/references/<name>.md` before writing or
restructuring code, and say in one line which and why ("Principles:
coding + system-design, new webhook consumer").
3. **Design before code.** When `system-design` is
loaded, answer its "Decide before coding" questions in a few lines:
owner of each new rule and state, dependency direction, source of truth,
behavior when a dependency fails, load, trust boundaries. When
`performance` is loaded, name the hot path and the data that grows. An
open answer is settled now, with the user if it is theirs to decide.
4. **Secure by design.** If the change crosses a trust boundary (untrusted
input, auth, sessions, secrets, uploads, user-supplied URLs, third-party
packages, personal data, LLM output), whatever its size, read
`references/security.md` before the design is fixed and follow its
workflow. Its trust boundaries, abuse cases, and always / ask-first /
never boundaries are design inputs: they decide where validation and
authorization sit, and its first abuse case is the first test.
Order: the `security` reference, then documented repo conventions, then
the other references, then the smell baseline. A request to drop a
security control follows the first gotcha of `references/security.md`.
5. **Break the design once.** Name the input, load, failure, or
future change most likely to make this design wrong, and adjust or
record why it holds. Spend the effort on the one decision that is
expensive to reverse (public contract, schema, data ownership); keep
everything else the simplest thing that satisfies the rules.
6. **Apply while coding.** Follow the rules throughout and act on a `When`
trigger as its situation appears. Behavior changes go test-first under
`legion:executing-plans` (call the Skill tool with it if it is not
loaded); refactors keep the suite green after every step.
7. **Answer the final checklist** of each loaded reference before the
evidence gate of `legion:executing-plans`, and report in the format
below.
## Choosing the references
| The change | Read (`references/<name>.md`) |
|---|---|
| Writes or reshapes a function, class, or module (default for any code) | `coding` |
| Refactors, cleans up, or modifies code that exists; code with weak or no tests | `coding-existing-code` (with `coding`) |
| Adds or moves a boundary: module, API, or service; domain model; data store, schema, cache, queue, or event; a call that can fail (timeouts, retries, circuit breakers) | `system-design` |
| Touches a query or remote call in a loop, a hot path, data that grows, a cache, rendering, or a stated budget | `performance` |
| Makes existing code faster or lighter toward a goal | `performance-optimization` (with `performance`) |
| Browser-facing: page load, interaction latency, layout shift, bundle size | `performance-web` (with `performance`) |
| Crosses a trust boundary (untrusted input, auth, sessions, secrets, uploads, user-supplied URLs, third-party packages, personal data, LLM output), whatever the size | `security` |
Most changes need `coding` alone. New work with a boundary reads
`system-design` first, because it decides what the code will be. Loading
everything by default defeats the split.
## Output format
```
Principles: <reference> [+ <reference>] - <one-line reason>
Design: <owner; dependency direction; source of truth; failure behavior; load> (when system-design was loaded)
Checklist: <reference>: all yes | <item>: no - <why, or what was done instead>
```
A measured optimization reports in the format at the end of
`references/performance-optimization.md` instead of the `Design` line.
## Gotchas
- Right the first time means the design questions are answered before the
first test, not that the design is large. For a single function the
answer is one line; do not invent layers, ports, or aggregates the
change does not need.
- The rules never justify rewriting code that follows a documented project
convention, and never widen the task: remove the smell that blocks the
requested change, not every smell in sight.
- Refactoring and behavior change belong in separate steps (and commits
where practical); a cleanup that also changes behavior cannot be reviewed
as either.
- In code without tests, characterization tests that pin current behavior
come before any structural change, even when the behavior looks wrong.
Add them to the project's suite and keep them: deleting the harness
after the refactor throws away the safety net the next change needs.
- No claim that code is faster or "optimized" without a before and after
number and its source; otherwise call it potential impact. A slowdown
that appeared after a change is a regression: call the Skill tool with
`legion:systematic-debugging` first.
- Security is not a later pass. A validation layer, an authorization check,
or a tenant key added after the structure is fixed ends up bolted onto
the wrong layer; that is why step 4 comes before the code.
- Code you write or change meets every loaded reference; violations in code
the task does not touch are reported as FYI and fixed only when asked.
- `references/` is relative to this skill's base directory (shown when the
skill loads), not to the project you are working in; a relative `cd` or
`cat` from the project fails.
- The references are practical distillations inspired by the books, not
book text. The per-book rule sets they were built from live upstream
(ciembor/agent-rules-books).
Pliki w paczce (8)
- SKILL.md 7 KB
- references/coding-existing-code.md 6 KB
- references/coding.md 7 KB
- references/performance-optimization.md 4 KB
- references/performance-web.md 3 KB
- references/performance.md 8 KB
- references/security.md 7 KB
- references/system-design.md 11 KB
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · ongtungduong/legion | 100 | MIT |
| mimshins/ork | 100 | MIT |
| OutlineDriven/outline-driven-development | 95 | Apache-2.0 |
| KyrosHendrix/skills | 90 | MIT |
| vahaah/astack | 90 | MIT |
| overextended/skills | 90 | GPL-3.0 |
| autocss-com/ai | 90 | MIT |
| melodic-software/claude-code-plugins | 84 | MIT |
Migawka bazy z 13.11.2026 · wersja paczki 7ad60a013033 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100engineering-principles
Ocenia jakość kodu według dziesięciu zasad: dokumentacji, odporności, SOLID, testowalności, wzorców i bezpieczeństwa, także przy zależnościach. - 100refactoring
Poprawia strukturę kodu bez zmiany zachowania: bezpieczne sekwencje refaktoryzacji, testy charakteryzujące i wyczucie, kiedy przestać. - 100refactor
Bezpiecznie refaktoryzuje kod pod ochroną testów: czyści, upraszcza, wydziela funkcje i poprawia jakość bez zmiany zachowania. - 84refactor-code
Refaktoryzuje kod z kontrolami bezpieczeństwa i zastosowaniem wzorców: upraszcza logikę, wydziela funkcje, stosuje wzorzec strategii i zmniejsza złożoność modułu. - 100python-refactor-method
Pomaga uczynić kod Pythona czytelnym i łatwym w utrzymaniu: porządkuje splątane funkcje i pętle bez zmiany działania. - 100engineering-principles
Podpowiada, gdzie umieścić logikę, jak dużo abstrakcji wystarczy, jak ułożyć moduły, obsługiwać błędy i nazywać rzeczy w kodzie.