@agentyx/core 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/index.d.mts +151 -5
  2. package/dist/index.d.mts.map +1 -1
  3. package/dist/index.mjs +404 -16
  4. package/dist/index.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/skills/api-documentation/SKILL.md +34 -0
  7. package/skills/aria-patterns/SKILL.md +36 -0
  8. package/skills/auth-patterns/SKILL.md +35 -0
  9. package/skills/branching-strategy/SKILL.md +34 -0
  10. package/skills/ci-pipelines/SKILL.md +34 -0
  11. package/skills/commit-hygiene/SKILL.md +34 -0
  12. package/skills/containerization/SKILL.md +38 -0
  13. package/skills/data-modeling/SKILL.md +34 -0
  14. package/skills/decision-records/SKILL.md +34 -0
  15. package/skills/dependency-hygiene/SKILL.md +34 -0
  16. package/skills/dependency-security/SKILL.md +35 -0
  17. package/skills/deployment-safety/SKILL.md +33 -0
  18. package/skills/e2e-testing/SKILL.md +34 -0
  19. package/skills/flaky-tests/SKILL.md +29 -0
  20. package/skills/incident-response/SKILL.md +34 -0
  21. package/skills/infrastructure-as-code/SKILL.md +34 -0
  22. package/skills/keyboard-navigation/SKILL.md +34 -0
  23. package/skills/legacy-code/SKILL.md +34 -0
  24. package/skills/metrics-and-tracing/SKILL.md +33 -0
  25. package/skills/performance-profiling/SKILL.md +34 -0
  26. package/skills/pull-requests/SKILL.md +34 -0
  27. package/skills/query-performance/SKILL.md +34 -0
  28. package/skills/refactoring-safely/SKILL.md +34 -0
  29. package/skills/schema-migrations/SKILL.md +34 -0
  30. package/skills/secrets-handling/SKILL.md +34 -0
  31. package/skills/secure-coding/SKILL.md +33 -0
  32. package/skills/semantic-html/SKILL.md +34 -0
  33. package/skills/structured-logging/SKILL.md +34 -0
  34. package/skills/technical-writing/SKILL.md +34 -0
  35. package/skills/test-doubles/SKILL.md +30 -0
  36. package/skills/test-strategy/SKILL.md +35 -0
  37. package/skills/transactions-and-consistency/SKILL.md +34 -0
  38. package/skills/web-vitals/SKILL.md +34 -0
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: branching-strategy
3
+ description: Keep branches short-lived and integrate continuously.
4
+ ---
5
+
6
+ # Branching strategy
7
+
8
+ Merge pain grows superlinearly with divergence. The most effective strategy is the one that keeps
9
+ branches short.
10
+
11
+ ## Keep branches short-lived
12
+
13
+ Aim for hours or days, not weeks. A long-running branch is an accumulating integration debt, and the
14
+ work it contains is invisible to everyone else until the end.
15
+
16
+ ## Integrate frequently
17
+
18
+ Bring changes from the main branch into yours regularly rather than resolving everything at the end.
19
+ Frequent small conflicts are trivial; one large conflict is dangerous.
20
+
21
+ ## Decouple deployment from release
22
+
23
+ Merge incomplete work behind a flag rather than holding it on a branch. Hiding unfinished features at
24
+ runtime is safer than hiding them in version control.
25
+
26
+ ## Protect the main branch
27
+
28
+ Require review and a green build before merging. The main branch must always be in a releasable
29
+ state, since that is the assumption everything else depends on.
30
+
31
+ ## Pick one convention and hold it
32
+
33
+ Whether the team rebases or merges matters far less than doing it consistently. Mixed conventions
34
+ produce confusing history and avoidable conflicts.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: ci-pipelines
3
+ description: Build pipelines that are fast, reproducible and trusted.
4
+ ---
5
+
6
+ # Continuous integration
7
+
8
+ A pipeline people wait on gets bypassed, and a pipeline people distrust gets ignored. Both failures
9
+ end with broken code in the main branch.
10
+
11
+ ## Fail fast and in order
12
+
13
+ Run the cheapest checks first: formatting, linting, types, unit tests, then slower integration and
14
+ end-to-end stages. Developers should learn about a trivial mistake in seconds.
15
+
16
+ ## Make builds reproducible
17
+
18
+ Pin tool versions and use the committed lockfile. A pipeline that passes or fails depending on when
19
+ it ran cannot be used as evidence of anything.
20
+
21
+ ## Keep it fast
22
+
23
+ Cache dependencies and parallelize independent work. Once feedback takes longer than a short break,
24
+ people stop waiting for it and start merging on hope.
25
+
26
+ ## Never tolerate a red main branch
27
+
28
+ A failing build on the main branch is the highest priority work for the team. Normalizing red builds
29
+ removes the entire value of the pipeline.
30
+
31
+ ## Gate on what matters
32
+
33
+ Enforce the checks that protect correctness and security, and keep advisory checks non-blocking. A
34
+ pipeline that blocks on style opinions trains people to skip it.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: commit-hygiene
3
+ description: Make each commit a single reviewable change with a useful message.
4
+ ---
5
+
6
+ # Commit hygiene
7
+
8
+ History is read far more often than it is written — during review, bisection and incident analysis.
9
+ Optimize for those readers.
10
+
11
+ ## One logical change per commit
12
+
13
+ A commit should do one thing and leave the build working. Mixing a refactor, a fix and a formatting
14
+ pass makes review harder and makes a clean revert impossible.
15
+
16
+ ## Explain why in the message
17
+
18
+ The diff shows what changed; the message must say why. Summarize the intent in the subject and use
19
+ the body for context, tradeoffs and consequences that are not visible in the code.
20
+
21
+ ## Never commit noise
22
+
23
+ Keep generated files, dependencies, editor settings and secrets out. Anything committed once stays in
24
+ history even after deletion.
25
+
26
+ ## Separate mechanical from meaningful
27
+
28
+ Do formatting, renaming and moving in their own commits. A behavioral change hidden inside a
29
+ thousand-line reformat will not be reviewed properly.
30
+
31
+ ## Tidy before sharing
32
+
33
+ Rewriting local history to produce a coherent sequence is good practice. Rewriting history others
34
+ have pulled is not — once pushed to a shared branch, history is fixed.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: containerization
3
+ description: Build small, reproducible and non-privileged container images.
4
+ ---
5
+
6
+ # Containerization
7
+
8
+ An image is a deployment artifact. Build it to be small, identical everywhere and safe to run.
9
+
10
+ ## Build in stages
11
+
12
+ Compile in a build stage and copy only the artifacts into a minimal runtime image. Shipping compilers
13
+ and development dependencies inflates both image size and attack surface.
14
+
15
+ ## Order layers by volatility
16
+
17
+ Put rarely changed steps such as dependency installation before frequently changed application code.
18
+ Correct ordering turns most rebuilds into cache hits.
19
+
20
+ ## Pin the base image
21
+
22
+ Reference an explicit version or digest rather than a moving tag. Rebuilding the same commit must
23
+ produce the same image, and update the base deliberately.
24
+
25
+ ## Never run as root
26
+
27
+ Create an unprivileged user and drop capabilities. A container is an isolation boundary, not a
28
+ security guarantee, and root inside makes an escape far more valuable.
29
+
30
+ ## Keep configuration and secrets outside
31
+
32
+ Inject configuration through environment or mounted files at runtime. Baking credentials into an
33
+ image publishes them to everyone who can pull it, permanently.
34
+
35
+ ## Handle signals and report health
36
+
37
+ Ensure the process receives termination signals so shutdown is graceful, and expose readiness and
38
+ liveness endpoints so orchestrators route traffic correctly.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: data-modeling
3
+ description: Design schemas that make invalid states unrepresentable.
4
+ ---
5
+
6
+ # Data modeling
7
+
8
+ The schema outlives the application code written against it. Design it so wrong data cannot be
9
+ stored in the first place.
10
+
11
+ ## Constrain in the database
12
+
13
+ Enforce required fields, uniqueness, foreign keys and value ranges at the storage layer. Application
14
+ checks are bypassed by migrations, admin tools, background jobs and the next service.
15
+
16
+ ## Model the real relationships
17
+
18
+ Choose cardinality from the domain rather than from current convenience. Discovering that a
19
+ one-to-one is really one-to-many after data exists is among the most expensive corrections available.
20
+
21
+ ## Normalize first, denormalize on evidence
22
+
23
+ Start from a normalized model and denormalize only for a measured read pattern, accepting the
24
+ duplication cost knowingly. Premature denormalization creates inconsistency that is hard to detect.
25
+
26
+ ## Choose types precisely
27
+
28
+ Use exact numeric types for money, timezone-aware timestamps for instants, and native types for
29
+ enumerations. Storing everything as text moves validation to every consumer, forever.
30
+
31
+ ## Plan for deletion
32
+
33
+ Decide early whether records are removed or marked inactive, and how that interacts with foreign
34
+ keys, uniqueness and retention obligations. Retrofitting soft deletion touches every query.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: decision-records
3
+ description: Record significant technical decisions with their context and consequences.
4
+ ---
5
+
6
+ # Decision records
7
+
8
+ Code shows what was built. A decision record preserves why, which is the part that is otherwise lost
9
+ when people move on.
10
+
11
+ ## Record decisions that are costly to reverse
12
+
13
+ Write one for choices that shape structure: a datastore, a protocol, a boundary, a framework, a
14
+ significant dependency. Routine or easily reversed choices do not need one.
15
+
16
+ ## Capture the context
17
+
18
+ State the forces at the time — constraints, deadlines, team size, what was known and what was not. A
19
+ decision that looks wrong later is usually a decision whose context was forgotten.
20
+
21
+ ## Name the alternatives and why they lost
22
+
23
+ The options rejected carry most of the value. Without them, a future reader re-opens a question that
24
+ was already settled for good reasons.
25
+
26
+ ## State the consequences honestly
27
+
28
+ Record what the choice makes harder as well as what it makes easier. Acknowledged tradeoffs are what
29
+ let someone recognize later that the tradeoff has stopped being worth it.
30
+
31
+ ## Supersede, never rewrite
32
+
33
+ When a decision changes, write a new record that replaces the old one and leave the original intact.
34
+ The history of decisions is itself information.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: dependency-hygiene
3
+ description: Keep the dependency graph small, current and pointing one way.
4
+ ---
5
+
6
+ # Dependency hygiene
7
+
8
+ Every dependency is a commitment: to its API, its release cadence and its own dependencies.
9
+
10
+ ## Justify each addition
11
+
12
+ Prefer the standard library and existing project dependencies. Adding a package for a function you
13
+ could write in a few lines trades a small cost now for an upgrade obligation forever.
14
+
15
+ ## Keep direction one way
16
+
17
+ Module dependencies should form a directed acyclic graph. A cycle means the two modules are really
18
+ one, and it blocks testing, reuse and independent change.
19
+
20
+ ## Depend on abstractions at boundaries
21
+
22
+ Isolate third-party clients behind an interface you own so a replacement touches one place. Apply
23
+ this where the risk is real, not to every import — an indirection layer for its own sake is cost
24
+ without benefit.
25
+
26
+ ## Remove what is unused
27
+
28
+ Unused dependencies still carry vulnerabilities, install time and upgrade noise. Prune them
29
+ deliberately, since no tool will decide for you that a package is no longer wanted.
30
+
31
+ ## Watch the transitive graph
32
+
33
+ Direct dependency count understates the real surface. Review what a package brings with it before
34
+ adding it, and prefer libraries with a small, well-maintained tree.
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: dependency-security
3
+ description: Vet, pin and update third-party dependencies deliberately.
4
+ ---
5
+
6
+ # Dependency security
7
+
8
+ Most code shipped in a modern application is code nobody on the team wrote. Treat adding a dependency
9
+ as a security decision.
10
+
11
+ ## Vet before adding
12
+
13
+ Check maintenance activity, release history, install footprint and transitive dependency count. A
14
+ small utility that pulls in dozens of packages costs more than writing the function yourself.
15
+
16
+ ## Pin and lock
17
+
18
+ Commit the lockfile and keep ranges narrow for anything security relevant. Reproducible installs are
19
+ what let you tell whether a change came from your code or from a dependency.
20
+
21
+ ## Update on a schedule, not in panic
22
+
23
+ Apply security patches promptly and take routine updates in small regular batches. Large infrequent
24
+ upgrades are where breakage accumulates and where an urgent patch gets stuck behind unrelated
25
+ changes.
26
+
27
+ ## Audit in CI
28
+
29
+ Fail the build on known critical vulnerabilities in the dependency tree. Review each advisory for
30
+ exploitability in your context before treating it as urgent.
31
+
32
+ ## Beware install-time execution
33
+
34
+ Post-install scripts run with your permissions on developer machines and in CI. Disable them where
35
+ the toolchain allows, and know what remains enabled.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: deployment-safety
3
+ description: Release in small increments with a fast, tested way back.
4
+ ---
5
+
6
+ # Deployment safety
7
+
8
+ The goal is not to avoid failed deployments but to make them cheap and quickly reversible.
9
+
10
+ ## Deploy small and often
11
+
12
+ Frequent small releases are safer than infrequent large ones. When a deployment contains one change,
13
+ the cause of any new problem is unambiguous.
14
+
15
+ ## Always have a way back
16
+
17
+ Know how to roll back before deploying, and test that path. A rollback procedure that has never been
18
+ exercised is an assumption, not a plan.
19
+
20
+ ## Roll out progressively
21
+
22
+ Expose new versions to a small share of traffic first and widen as signals stay healthy. Most
23
+ failures appear immediately under real traffic, which no staging environment reproduces.
24
+
25
+ ## Separate deploy from release
26
+
27
+ Ship code dark and enable it with a flag. This decouples the risk of deployment from the risk of the
28
+ feature, and makes disabling instant.
29
+
30
+ ## Watch after shipping
31
+
32
+ Monitor error rates, latency and business metrics through the rollout, with clear criteria for
33
+ aborting. A deployment is not finished when it completes; it is finished when it is verified healthy.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: e2e-testing
3
+ description: Write end-to-end tests that are few, critical and stable.
4
+ ---
5
+
6
+ # End-to-end testing
7
+
8
+ End-to-end tests are the most expensive and most fragile tests in a suite. Spend them on the
9
+ journeys that lose money or trust when they break.
10
+
11
+ ## Select ruthlessly
12
+
13
+ Cover sign-up, authentication, payment and the core workflow of the product. Do not re-test
14
+ validation rules or edge cases that unit tests already cover.
15
+
16
+ ## Wait for state, never for time
17
+
18
+ Wait for the condition that proves readiness: an element, a response, a state change. Fixed sleeps
19
+ are the primary source of both flakiness and slow suites.
20
+
21
+ ## Select elements by intent
22
+
23
+ Target roles, labels and dedicated test identifiers. Selectors built on CSS structure or generated
24
+ class names break on every refactor without any behavior changing.
25
+
26
+ ## Isolate the run
27
+
28
+ Create the data each test needs and remove it afterwards. Tests that depend on a shared seeded
29
+ environment fail unpredictably as that environment drifts.
30
+
31
+ ## Make failures diagnosable
32
+
33
+ Capture screenshots, traces and logs on failure. An end-to-end failure without artifacts costs more
34
+ to reproduce than to fix.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: flaky-tests
3
+ description: Diagnose and fix non-deterministic tests instead of retrying them.
4
+ ---
5
+
6
+ # Flaky tests
7
+
8
+ A test that passes and fails without a code change destroys trust in the whole suite. Treat it as a
9
+ defect, not as noise.
10
+
11
+ ## Never paper over it
12
+
13
+ Do not add a retry, a longer timeout or a skip as the fix. Retries hide real race conditions that
14
+ will surface in production, and a skipped test is a deleted test that still costs time to run.
15
+
16
+ ## Find the source of non-determinism
17
+
18
+ The usual causes are time, ordering, concurrency, shared state, network and randomness. Pin clocks,
19
+ seed randomness, isolate state, and await every asynchronous operation explicitly.
20
+
21
+ ## Reproduce before fixing
22
+
23
+ Run the test repeatedly, in random order and in parallel until the failure is reliable. A fix applied
24
+ to a failure you cannot reproduce is a guess.
25
+
26
+ ## Quarantine with a deadline
27
+
28
+ If a flaky test must leave the critical path immediately, record why and when it will be fixed. An
29
+ unbounded quarantine list becomes permanent, and the coverage it represented is silently gone.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: incident-response
3
+ description: Restore service first, diagnose second, and learn without blame.
4
+ ---
5
+
6
+ # Incident response
7
+
8
+ During an incident the goal is to stop the harm. Understanding the cause is important, but it comes
9
+ after recovery.
10
+
11
+ ## Mitigate before diagnosing
12
+
13
+ Roll back, disable the feature flag, shed load or fail over. A full explanation is worth far less
14
+ than a working system, and the evidence will still be there afterwards.
15
+
16
+ ## Assign roles early
17
+
18
+ Name someone to coordinate and someone to communicate, separate from those investigating. Without
19
+ this split, either the investigation or the communication is dropped.
20
+
21
+ ## Keep a timeline
22
+
23
+ Record what was observed, what was changed and when, as it happens. Memory reconstructs incidents
24
+ inaccurately, and the timeline is the basis of the review.
25
+
26
+ ## Change one thing at a time
27
+
28
+ Simultaneous fixes make it impossible to know what worked, and can deepen the outage. Announce each
29
+ change before making it.
30
+
31
+ ## Review without blame
32
+
33
+ Examine the conditions that let the failure happen and reach production: missing tests, absent
34
+ alerts, unclear ownership. Blaming an individual guarantees the next incident is reported later.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: infrastructure-as-code
3
+ description: Define infrastructure declaratively, in version control, applied automatically.
4
+ ---
5
+
6
+ # Infrastructure as code
7
+
8
+ Infrastructure that exists only as manual console changes cannot be reviewed, reproduced or
9
+ recovered.
10
+
11
+ ## Declare the desired state
12
+
13
+ Describe what the infrastructure should be and let the tool determine the steps. Declarative
14
+ definitions converge from any starting point; imperative scripts assume one.
15
+
16
+ ## Never change production by hand
17
+
18
+ Manual edits create drift that the next automated apply will undo or conflict with. When an emergency
19
+ forces a manual change, bring it back into code immediately.
20
+
21
+ ## Review the plan before applying
22
+
23
+ Read the diff of what will be created, changed and destroyed. Replacement of a stateful resource is
24
+ the failure mode that turns a routine change into data loss.
25
+
26
+ ## Isolate environments
27
+
28
+ Keep separate state and credentials per environment, sharing definitions through parameters rather
29
+ than copies. Shared state is how a staging change reaches production.
30
+
31
+ ## Protect the state and the secrets
32
+
33
+ Store state remotely with locking and restricted access — it contains sensitive values. Reference
34
+ secrets from a secret manager instead of committing them alongside the definitions.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: keyboard-navigation
3
+ description: Make every interaction reachable, visible and escapable by keyboard.
4
+ ---
5
+
6
+ # Keyboard navigation
7
+
8
+ Anything achievable with a pointer must be achievable with a keyboard alone. This is the fastest
9
+ accessibility check available: put the mouse away and use the feature.
10
+
11
+ ## Keep order logical
12
+
13
+ Tab order should follow the visual and logical reading order. Positive tab index values override
14
+ document order and create sequences nobody can predict — leave them alone.
15
+
16
+ ## Make focus visible
17
+
18
+ Every focusable element needs a clearly visible focus indicator with sufficient contrast. Removing
19
+ default outlines without replacing them makes the interface unusable for keyboard users.
20
+
21
+ ## Never trap focus unintentionally
22
+
23
+ Focus must be able to leave every component. Deliberate trapping belongs only in modal dialogs, and
24
+ must always offer an escape.
25
+
26
+ ## Support the expected keys
27
+
28
+ Enter and Space activate controls, Escape dismisses overlays, and arrow keys move within composite
29
+ widgets such as menus, tabs and grids. Follow platform conventions rather than inventing shortcuts.
30
+
31
+ ## Offer a skip link
32
+
33
+ Let users bypass repeated navigation to reach main content. Without it, every page begins with the
34
+ same long traversal.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: legacy-code
3
+ description: Work safely in unfamiliar code with weak or missing tests.
4
+ ---
5
+
6
+ # Working with legacy code
7
+
8
+ Legacy code is code you are afraid to change. The goal of each visit is to leave it slightly less
9
+ frightening than you found it.
10
+
11
+ ## Characterize before changing
12
+
13
+ When behavior is undocumented and untested, write tests that capture what the code does today, even
14
+ where that looks wrong. Those tests describe reality, and reality is what callers depend on.
15
+
16
+ ## Find a seam
17
+
18
+ Introduce a boundary where a dependency can be substituted, so a piece becomes testable without
19
+ rewriting the whole. A narrow seam beats a broad refactor performed blind.
20
+
21
+ ## Assume the strangeness has a reason
22
+
23
+ Odd conditionals and special cases usually encode a real requirement or an old incident. Find out why
24
+ before deleting; unexplained code is not the same as unnecessary code.
25
+
26
+ ## Improve what you touch
27
+
28
+ Leave the area you worked in better: a name clarified, a test added, dead code removed. Repository-
29
+ wide cleanup campaigns stall, while incremental improvement compounds.
30
+
31
+ ## Do not rewrite by default
32
+
33
+ A rewrite discards embedded knowledge and restarts the bug-discovery process from zero. Prefer
34
+ strangling the old implementation behind a stable interface, one piece at a time.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: metrics-and-tracing
3
+ description: Instrument systems so failures are visible before users report them.
4
+ ---
5
+
6
+ # Metrics and tracing
7
+
8
+ Instrumentation should answer whether the system is healthy, and if not, where it broke.
9
+
10
+ ## Measure what users experience
11
+
12
+ Track request rate, error rate, latency and saturation at the boundaries users touch. Internal
13
+ counters that no symptom maps to generate noise rather than signal.
14
+
15
+ ## Use percentiles, never averages
16
+
17
+ Averages conceal the tail where the damage is. Watch the high percentiles, because those are the
18
+ requests people notice and complain about.
19
+
20
+ ## Trace across service boundaries
21
+
22
+ Distributed traces show where time is spent in a request that crosses processes. In any system of
23
+ more than a couple of services, this is the only practical way to locate latency.
24
+
25
+ ## Alert on symptoms, not causes
26
+
27
+ Alert when users are affected, and let dashboards explain why. Cause-based alerts fire on conditions
28
+ that are frequently harmless, and their volume trains people to ignore them.
29
+
30
+ ## Make every alert actionable
31
+
32
+ An alert nobody can act on is noise that erodes attention. Each one needs an owner, a clear
33
+ meaning and a documented first response.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: performance-profiling
3
+ description: Measure before optimizing and confirm the gain after.
4
+ ---
5
+
6
+ # Performance profiling
7
+
8
+ Optimization without measurement is guesswork that costs readability. Find the bottleneck, then fix
9
+ the bottleneck.
10
+
11
+ ## Measure first
12
+
13
+ Profile under conditions that resemble production: realistic data volume, realistic concurrency, a
14
+ production build. Development builds and toy datasets hide the actual cost.
15
+
16
+ ## Set a target
17
+
18
+ Define what fast enough means before starting — a latency budget, a percentile, a throughput figure.
19
+ Without a target, optimization has no finish line.
20
+
21
+ ## Fix the dominant cost
22
+
23
+ Work on the largest contributor first. An improvement to code that accounts for two percent of
24
+ runtime cannot matter, however large the factor.
25
+
26
+ ## Prefer algorithmic wins
27
+
28
+ Removing repeated work, unnecessary round trips and quadratic behavior beats micro-optimization.
29
+ Caching is a last resort, not a first move: it adds invalidation as a new class of bug.
30
+
31
+ ## Verify and keep the number
32
+
33
+ Re-measure after the change and record the result. Track the metric so a regression is caught by the
34
+ build rather than by users.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: pull-requests
3
+ description: Size and present changes so they can actually be reviewed.
4
+ ---
5
+
6
+ # Pull requests
7
+
8
+ Review quality falls sharply with size. A pull request is a request for someone's attention, so make
9
+ that attention easy to give.
10
+
11
+ ## Keep them small
12
+
13
+ Prefer a few hundred changed lines over a thousand. Large pull requests receive approval rather than
14
+ review, which is the opposite of the intended effect.
15
+
16
+ ## Do one thing
17
+
18
+ Cover a single feature, fix or refactor. When a change touches many areas for different reasons,
19
+ split it into a sequence that each stand on their own.
20
+
21
+ ## Write the description for the reviewer
22
+
23
+ State what changes, why, and what to look at closely. Note what you are unsure about — that is where
24
+ review is most valuable and where reviewers most often stay silent.
25
+
26
+ ## Make it verifiable
27
+
28
+ Include the tests that prove the change and say how to exercise it manually where that applies. A
29
+ reviewer should not have to reconstruct how you convinced yourself.
30
+
31
+ ## Respond to every comment
32
+
33
+ Address or explicitly decline each point. Silently ignoring a comment wastes the reviewer's effort
34
+ and discourages careful review next time.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: query-performance
3
+ description: Diagnose slow database access with query plans, indexes and access patterns.
4
+ ---
5
+
6
+ # Query performance
7
+
8
+ Most application slowness is data access. Read the query plan before changing the query.
9
+
10
+ ## Read the plan
11
+
12
+ The execution plan shows what the database actually does: scans, joins, sorts and row estimates. A
13
+ large gap between estimated and actual rows usually means stale statistics or an unsuitable index.
14
+
15
+ ## Index for the access pattern
16
+
17
+ Index the columns used to filter, join and order, and put the most selective column first in a
18
+ composite index. Every index costs write throughput and storage, so add them for measured queries
19
+ rather than speculatively.
20
+
21
+ ## Eliminate N+1 access
22
+
23
+ Loading a collection and then querying once per element is the most common performance defect in
24
+ application code. Fetch related data in a single query or a batched load.
25
+
26
+ ## Fetch only what you need
27
+
28
+ Select the required columns and paginate large result sets with a stable key. Requesting entire rows
29
+ and filtering in application code moves the work to the slowest place.
30
+
31
+ ## Watch the pool and the transaction
32
+
33
+ Long transactions hold locks and connections, turning a slow query into a system-wide stall. Keep
34
+ transactions short and do external calls outside them.