@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: refactoring-safely
3
+ description: Change structure without changing behavior, in reversible steps.
4
+ ---
5
+
6
+ # Refactoring safely
7
+
8
+ Refactoring changes structure while behavior stays identical. The moment behavior changes it is no
9
+ longer refactoring, and it needs its own review and its own tests.
10
+
11
+ ## Secure the behavior first
12
+
13
+ Ensure tests cover the current behavior before restructuring. Without that net, a refactor is an
14
+ untested rewrite and any difference goes unnoticed.
15
+
16
+ ## Separate the commits
17
+
18
+ Never mix refactoring with a feature or a fix in one commit. Mixed changes make review hard and make
19
+ a clean revert impossible when something breaks.
20
+
21
+ ## Move in small steps
22
+
23
+ Take one transformation at a time and keep the suite green between steps. A long sequence of
24
+ unverified edits is where the untraceable regression enters.
25
+
26
+ ## Follow the pain
27
+
28
+ Refactor where change is actually difficult and where work is actually happening. Restructuring
29
+ stable code nobody touches spends risk with no return.
30
+
31
+ ## Know when to stop
32
+
33
+ Stop when the code is clear enough for the change you came to make. Refactoring is preparation for
34
+ work, not the work itself.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: schema-migrations
3
+ description: Evolve a live schema without downtime or data loss.
4
+ ---
5
+
6
+ # Schema migrations
7
+
8
+ A migration runs once against real data that cannot be recreated. Treat it with more care than the
9
+ code that prompted it.
10
+
11
+ ## Make migrations additive first
12
+
13
+ Add columns and tables before anything reads them, and remove old structures only after nothing
14
+ references them. During deployment both versions of the application run at once.
15
+
16
+ ## Expand, migrate, contract
17
+
18
+ Add the new shape, backfill it, switch reads and writes over, then drop the old shape in a later
19
+ release. Attempting all three at once forces downtime and leaves no safe point to stop.
20
+
21
+ ## Backfill in batches
22
+
23
+ Update large tables in bounded chunks with pauses between them. A single statement over millions of
24
+ rows holds locks and can stall the application entirely.
25
+
26
+ ## Keep them reversible
27
+
28
+ Provide a tested rollback, or design the change so the previous version still works against the new
29
+ schema. A migration you cannot undo turns a small mistake into an incident.
30
+
31
+ ## Test against production-like data
32
+
33
+ Verify on a realistic copy for both correctness and duration. Migrations that finish instantly in
34
+ development regularly run for hours in production.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: secrets-handling
3
+ description: Keep credentials out of source, logs and client bundles.
4
+ ---
5
+
6
+ # Secrets handling
7
+
8
+ A secret in version control is compromised the moment it is pushed, and rewriting history does not
9
+ undo it.
10
+
11
+ ## Keep secrets out of the repository
12
+
13
+ Load credentials from environment variables or a secret manager. Commit a documented example file
14
+ with placeholder values, never the real ones.
15
+
16
+ ## Rotate on exposure
17
+
18
+ Treat any secret that reached a repository, log, ticket or chat message as leaked. Rotate it before
19
+ removing it — deletion without rotation leaves the credential valid.
20
+
21
+ ## Never log or serialize them
22
+
23
+ Redact credentials, tokens and keys in logs, error messages and crash reports. Review debug output
24
+ and third-party error reporters, which capture more surrounding context than expected.
25
+
26
+ ## Understand the client boundary
27
+
28
+ Anything shipped to a browser or mobile app is public, regardless of build-time substitution. Only
29
+ publishable identifiers belong in client code; every real secret stays server side.
30
+
31
+ ## Scan continuously
32
+
33
+ Run secret scanning in pre-commit hooks and in CI. Detection after the fact is far cheaper than an
34
+ incident, and cheaper still before the push.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: secure-coding
3
+ description: Apply input validation, output encoding and least privilege by default.
4
+ ---
5
+
6
+ # Secure coding
7
+
8
+ Treat every input crossing a trust boundary as hostile, including input from your own other services.
9
+
10
+ ## Validate at the boundary
11
+
12
+ Validate structure, type, range and length where untrusted data enters, and reject what does not
13
+ conform. Allow-lists beat deny-lists: enumerate what is valid rather than guessing what is dangerous.
14
+
15
+ ## Never build queries or commands by concatenation
16
+
17
+ Use parameterized queries and argument arrays. String interpolation into SQL, shell commands,
18
+ templates or file paths is the root of injection.
19
+
20
+ ## Encode for the destination
21
+
22
+ Escaping depends on where the value lands: HTML body, attribute, URL, SQL, shell and JSON all differ.
23
+ Encode at the point of output, not on the way in.
24
+
25
+ ## Apply least privilege
26
+
27
+ Give every process, token and database role the narrowest permissions that let it work. Scope
28
+ credentials per environment so a leak in one does not compromise the others.
29
+
30
+ ## Fail closed
31
+
32
+ On error, deny access and log the reason. An exception path that falls through to permitted access is
33
+ a vulnerability, not a bug.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: semantic-html
3
+ description: Use native elements and structure so accessibility works by default.
4
+ ---
5
+
6
+ # Semantic markup
7
+
8
+ The accessible behavior of a native element is free and correct. Recreating it is expensive and
9
+ rarely complete.
10
+
11
+ ## Use the element that means it
12
+
13
+ Buttons, links, form controls, lists and headings carry role, keyboard behavior and state to
14
+ assistive technology. A styled container with a click handler carries none of it.
15
+
16
+ ## Distinguish links from buttons
17
+
18
+ A link navigates, a button performs an action. Choosing by appearance breaks expectations for
19
+ keyboard, screen reader and browser features such as opening in a new tab.
20
+
21
+ ## Structure with headings and landmarks
22
+
23
+ Use one descriptive page title, a logical heading order without skipped levels, and landmark regions
24
+ for navigation, main content and complements. Many users navigate by these alone.
25
+
26
+ ## Label every control
27
+
28
+ Associate a visible label with each input. Placeholders disappear on entry and are not labels;
29
+ icon-only controls need an accessible name.
30
+
31
+ ## Describe meaningful images
32
+
33
+ Give informative images alt text conveying their purpose, and mark decorative images as such. Alt
34
+ text should say what the image communicates, not what it depicts.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: structured-logging
3
+ description: Emit machine-readable logs with the context needed to diagnose incidents.
4
+ ---
5
+
6
+ # Structured logging
7
+
8
+ Logs exist to answer questions during an incident. Write them for the person querying at three in
9
+ the morning.
10
+
11
+ ## Log structured events, not sentences
12
+
13
+ Emit key-value fields rather than interpolated prose. Structured records can be filtered, aggregated
14
+ and correlated; free text can only be searched by substring.
15
+
16
+ ## Carry correlation identifiers
17
+
18
+ Propagate a request or trace identifier through every layer, including asynchronous work. Without
19
+ it, reconstructing one operation across services is guesswork.
20
+
21
+ ## Use levels with discipline
22
+
23
+ Error means someone must act, warn means a degraded path was taken, info records significant state
24
+ changes, and debug is for development. When everything is an error, the level conveys nothing.
25
+
26
+ ## Never log sensitive data
27
+
28
+ Credentials, tokens, personal data and payment details must not reach logs, which are widely
29
+ readable and long-lived. Redact at the logging boundary rather than trusting call sites.
30
+
31
+ ## Log decisions, not control flow
32
+
33
+ Record what was decided and why — inputs, chosen branch, outcome. Tracing every function entry
34
+ produces volume without insight and buries the events that matter.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: technical-writing
3
+ description: Write documentation that answers the reader's question quickly.
4
+ ---
5
+
6
+ # Technical writing
7
+
8
+ Documentation is read under pressure by someone trying to accomplish something. Optimize for their
9
+ task, not for completeness.
10
+
11
+ ## Lead with the answer
12
+
13
+ Put the conclusion, the command or the decision first, then the explanation. Readers stop as soon as
14
+ they have what they need, and background before the answer wastes that attention.
15
+
16
+ ## Write for a specific reader
17
+
18
+ Decide whether the audience is a newcomer, an integrator or a maintainer, and commit. Text that
19
+ serves everyone equally usually serves nobody.
20
+
21
+ ## Separate the kinds
22
+
23
+ A tutorial teaches, a how-to solves one problem, a reference describes the surface, an explanation
24
+ gives context. Mixing them in one document makes it useless for all four purposes.
25
+
26
+ ## Show the real thing
27
+
28
+ Include commands and examples that run as written. An example that has drifted from the code is
29
+ worse than no example, because it is trusted.
30
+
31
+ ## Prune on every change
32
+
33
+ Delete what is obsolete rather than appending corrections. Documentation loses value through
34
+ accumulation, and stale instructions cost more than missing ones.
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: test-doubles
3
+ description: Use fakes, stubs and mocks deliberately instead of mocking everything.
4
+ ---
5
+
6
+ # Test doubles
7
+
8
+ Replace a real dependency only when using it makes the test slow, non-deterministic, or impossible
9
+ to run.
10
+
11
+ ## Prefer the real thing
12
+
13
+ Use the real implementation when it is fast and deterministic. In-memory databases, temporary
14
+ directories and local fakes usually beat a mock, because they exercise the actual contract.
15
+
16
+ ## Match the double to the need
17
+
18
+ Use a stub to supply input, a fake for a working lightweight implementation, and a mock only when
19
+ the interaction itself is the behavior under test. Asserting on calls to a dependency that is not
20
+ the subject couples the test to implementation.
21
+
22
+ ## Double boundaries you own
23
+
24
+ Replace your own abstraction over a third-party client rather than the client internals. When the
25
+ library changes shape, one adapter moves instead of every test.
26
+
27
+ ## Keep doubles honest
28
+
29
+ A double that accepts calls the real dependency would reject turns a passing test into false
30
+ confidence. Verify the contract against the real implementation at least once.
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: test-strategy
3
+ description: Choose the right test level and scope before writing tests.
4
+ ---
5
+
6
+ # Test strategy
7
+
8
+ Decide what a test is for before writing it. Most wasted test effort comes from testing at the wrong
9
+ level, not from writing tests badly.
10
+
11
+ ## Choose the level
12
+
13
+ Cover business rules and edge cases with unit tests, module boundaries and wiring with integration
14
+ tests, and only critical user journeys end to end. Push detail down: if a case can be covered one
15
+ level lower, cover it there.
16
+
17
+ ## Test behavior, not structure
18
+
19
+ Assert on observable behavior through the public interface. A test that breaks when an
20
+ implementation detail changes, while behavior stays the same, is a liability.
21
+
22
+ ## Keep tests independent
23
+
24
+ Each test sets up the state it needs and passes in any order, alone or in parallel. Shared mutable
25
+ fixtures produce failures that depend on execution order.
26
+
27
+ ## Name for the case
28
+
29
+ State the scenario and the expected outcome. A failing test name should identify the broken behavior
30
+ without opening the file.
31
+
32
+ ## Cover the boundaries
33
+
34
+ Prioritize empty input, a single element, maximum size, null and undefined, concurrent access, and
35
+ failure of every external dependency.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: transactions-and-consistency
3
+ description: Choose transaction boundaries and handle concurrent writes correctly.
4
+ ---
5
+
6
+ # Transactions and consistency
7
+
8
+ Concurrency defects are rare in testing and constant in production. Decide the boundary and the
9
+ isolation deliberately.
10
+
11
+ ## Scope transactions tightly
12
+
13
+ A transaction should cover exactly the writes that must succeed or fail together. Long transactions
14
+ hold locks and connections, and turn one slow operation into a system-wide stall.
15
+
16
+ ## Keep external calls outside
17
+
18
+ Never hold a transaction open across a network request to another service. The remote call cannot be
19
+ rolled back, and its latency becomes lock duration.
20
+
21
+ ## Know your isolation level
22
+
23
+ The default isolation of your database determines which anomalies are possible. Read-modify-write
24
+ sequences need explicit locking or a compare-and-set, because reading and then writing is not atomic.
25
+
26
+ ## Make retries safe
27
+
28
+ Give operations an idempotency key so a retried request cannot apply twice. Clients, queues and
29
+ proxies all retry, and at-least-once delivery is the normal case.
30
+
31
+ ## Prefer atomic operations to read-then-write
32
+
33
+ Let the database compute the new value in one statement instead of reading it into the application
34
+ and writing it back. That closes the window where another writer intervenes.
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: web-vitals
3
+ description: Optimize loading, interactivity and layout stability for real users.
4
+ ---
5
+
6
+ # Web performance
7
+
8
+ Perceived speed is decided by what the user sees and can do, not by total bytes.
9
+
10
+ ## Protect the critical path
11
+
12
+ Identify what must load before the page is useful and defer everything else. Render-blocking scripts
13
+ and stylesheets delay first paint more than their size suggests.
14
+
15
+ ## Ship less JavaScript
16
+
17
+ Split by route, load heavy features on demand, and remove unused dependencies. JavaScript costs
18
+ twice: once to download and again to parse and execute, and the second cost dominates on low-end
19
+ devices.
20
+
21
+ ## Reserve space for content
22
+
23
+ Give images, embeds and injected banners explicit dimensions so later loads do not move what is
24
+ already visible. Layout shift is most damaging exactly when the user is about to act.
25
+
26
+ ## Keep interactions responsive
27
+
28
+ Break long tasks, move heavy work off the main thread, and give immediate feedback to input. A
29
+ response that is visibly acknowledged tolerates far more latency than one that appears frozen.
30
+
31
+ ## Measure real users
32
+
33
+ Field data from actual devices and networks decides whether the site is fast. Lab measurements are
34
+ for diagnosis, not for judging success.