AGENT SKILL

developing-applications

Guides language-agnostic application work: placing code in the right layer, deciding where each error is handled or propagated, what a log line carries, where input is validated, and building every behaviour test-first.

License 许可
MIT
最近更新
2026-11-15
Stars
★ 2
Forks
0

01 前言 Front Matter

name
developing-applications
description
Guides language-agnostic application work: placing code in the right layer, deciding where each error is handled or propagated, what a log line carries, where input is validated, and building every behaviour test-first.
when_to_use
Use when implementing or reviewing application or library code in any language, alongside that language's own skill or stack standard.
compatibility
Requires read access to the application source, its tests, and its dependency manifests.

03 SKILL.md 正文

Developing Applications

The standards own the rules. Hexagonal Architecture and Functional Core, Imperative Shell place code; Test-Driven Development and Quality Gates govern tests; Dependency Selection governs what is added; and Implementation Stages orders the work. A language's stack standard, such as TypeScript Standards, adds its own choices. This skill covers the judgement those rules leave to whoever writes the code.

Place Code Before Writing It

Ask of each new piece whether it decides or does. A decision belongs in the domain or functional core and receives everything it needs as a parameter. An effect belongs in an adapter or the shell. Coordinating a use case belongs in the application layer.

Misplacement shows early: a domain function that wants a clock, a connection, or a logger; an adapter holding a condition about a business rule; an application function choosing a transport status. Which layering fits a given application is decided in Application Shapes.

Give Every Error One Fate

At each call that can fail, choose exactly one:

Fate When
handle it here this code can do something meaningful: retry, fall back, or tell the user
propagate it the caller can decide, and this code adds context the caller lacks
fail loudly the failure means a broken invariant or a programming error

Discarding it is never a fate. Add context where the meaning changes, such as a storage failure becoming "could not load order <id>", not at every frame it crosses; the same message repeated at each layer buries the cause. Infrastructure error types stop at their adapter, and a failure becomes a transport response once, as Layers and the Dependency Rule requires. Whether expected failures travel as values or exceptions is the stack standard's decision, or, where no stack standard exists, the language skill states the language's idiom or records the choice as an adopter decision. Every error path gets its own test.

A Log Line Is Evidence for Someone Else

Log a failure once, where it is finally handled; lines at every layer make one incident look like several. Write fields rather than prose: the operation, the identifier acted on, the outcome, and the duration. Choose the level by who must act: failures needing attention, degraded service, lifecycle events, and diagnostics.

Never write a credential, token, session identifier, full request body, or personal value to a log. Write an identifier an authorized person can look up instead. Logging is an effect, so it stays in the shell or an adapter, and the core returns what happened.

Validate Once, Where Trust Ends

Validate input where it arrives from something the program does not control: a request, a file, a message, the environment, or another service's response. Turn it into a typed value there, and trust that type inward. Re-checking the same shape deep inside the domain signals an edge that let an unchecked value through.

Domain invariants are different: the domain enforces its own rules whatever the source. Check authorization on each operation that touches protected data, not once at sign-in, and build every query with parameters, never by joining input into its text.

Test First, at the Narrowest Layer

Start each behaviour with a failing test at the narrowest layer that can prove it: a decision with injected dependencies at unit, an adapter against a real local resource at integration, and a journey through the public boundary at end-to-end, kept few. Red, Green, Refactor owns the cycle.

Before Calling It Ready

  • every error path is tested and ends handled, propagated with context, or failing loudly;
  • no log line, fixture, or example holds a secret or a personal value;
  • every entry point the change adds validates its input;
  • no literal leaves a reader guessing its meaning, per Code Clarity; and
  • every new dependency is justified and locked, and any dependency the change left unused is removed.

04 同仓库更多 Skills

wahidyankf
wahidyankf/beaver-nest

writing-browser-e2e-tests

Guides writing browser end-to-end tests that find elements as users do, wait on what the action produced, keep page knowledge in page objects, organize one feature per file, and run scenario-backed suites from generated specs.

★ 2
wahidyankf
wahidyankf/beaver-nest

usability-heuristic-evaluation

Guides judging a running interface as a first-time user would, without its specifications: citing a named principle for every finding, walking each task step, reading labels and addresses for scent, and rating severity.

★ 2
wahidyankf
wahidyankf/beaver-nest

tooling-nx

Guides Nx workspace work under the Nx standard: selecting projects by the graph, adding a target only where a capability exists, tracing a stale cached pass to its missing input, and answering a module-boundary finding.

★ 2
wahidyankf
wahidyankf/beaver-nest

programming-typescript

Guides the procedure for writing or changing TypeScript: loading the TypeScript standard first, driving each increment test-first, finding which rule a decision falls under, and confirming the gates before handing off.

★ 2
wahidyankf
wahidyankf/beaver-nest

programming-shell

Guides shell work under the shell standards: checking the declared dialect first, deciding whether logic belongs in shell at all, tracing where exit-on-error does not reach, and testing the script as its callers run it.

★ 2
wahidyankf
wahidyankf/beaver-nest

programming-javascript

Guides JavaScript work under the JavaScript standard: confirming the file is type-checked, typing through JSDoc, validating input the checker cannot see, and noticing floating promises and swallowed errors before handing off.

★ 2