AGENT SKILL
tachyon-development
Apply Tachyon MCP project rules when designing, implementing, reviewing, or testing Java and Kotlin server code, MCP protocol behaviour, E2E fixtures, concurrency, JSON, schemas, and documentation examples.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-15
- Stars
- ★ 39
- Forks
- 14
01 前言 Front Matter
- name
- tachyon-development
- metadata
- { "author": "Konstantin Pavlov", "version": 1.1 }
- description
- Apply Tachyon MCP project rules when designing, implementing, reviewing, or testing Java and Kotlin server code, MCP protocol behaviour, E2E fixtures, concurrency, JSON, schemas, and documentation examples.
03 SKILL.md 正文
Prime directives
- Apply SOLID. Model invalid states out of types/builders; validate remaining invariants at construction.
- Use TDD. Start observable protocol changes with an E2E acceptance test.
- Never serialize structured/wire content with generic
toString(); records/POJOs emit debug text, not JSON. UsePayloadSerializer, the correct codec, or domain mapping, including fallbacks.toString()is valid only for strings, scalar numbers/booleans, and specified formats such asInstantRFC-3339. - Prefer imports. Use an FQN only for a genuine name collision, and only on the non-domain type.
- Prefer
finalfields/locals andfinal varwhen the right-hand side makes the type obvious; use an explicit type when clearer. - Avoid
synchronizedon Java 21 virtual-thread paths. PreferReentrantLock; offload unavoidable pinning or native calls to a suitable executor. Virtual-thread contract and nullability:../../../specs/tech-stack.md. - Kotlin API refactors follow the adapter shapes in
../../../specs/guidance.md. The file is long: grep the heading and read only that section. - Java
ServerBuilderis the implementation source of truth. Kotlin adds only thin adaptation for suspend lambdas and Kotlin-specific types; never duplicate validation or registration logic. - Keep
weather-mcpandweather-mcp-kotlinfunctionally identical. - Keep files focused. Above 300 lines, consider splitting by responsibility; generated code is exempt.
- Write self-documenting code. Do not add docs or comments that repeat the code.
- A public API change (new/changed method, param, wire field, or behaviour contract like TTL/null
semantics) is not done until its docs are done: update the relevant file under
docs/, this skill, and/or../../../specs/guidance.md/../../../specs/tech-stack.mdin the same change. Don't defer it to a follow-up.
Performance 🏎️
- A change to a hot path or JSON utility is not done without a JMH before/after on the same machine.
Hot paths: dispatch, transport, SSE, sessions,
ts2java.pyoutput. JSON utilities:core.protocol.codec,core.server.json,core.transport.jsonrpc.- Run the covering
*Benchmarkon the base commit and on the change, with-prof gc. - If no benchmark covers the path, write one first and commit it, so later changes reuse it.
- Report ops/s and B/op deltas in the commit message or PR; explain every regression.
- Run the covering
- Run:
./mvnw -q -pl tachyon-core -am verify -Pjmh -DskipTests -Djmh.args='<BenchmarkRegex> -prof gc -rf json -rff <abs path>.json' > <abs path>.log 2>&1. Use-Djmh.args, not-Dexec.args:exec.argsalso rewrites the ts2javaexec:execruns. Read scores from the JSON result (primaryMetric.score,secondaryMetrics["gc.alloc.rate.norm"].score); open the log only when the run fails. Never let JMH print into the conversation. - Streaming Jackson only on wire paths:
JsonParser/JsonGeneratorviaCodecSupport, noObjectMapper/databind. Trees go throughCodecSupport#readTree/#readWireTree/#writeTree.
Test Rules 🧪
- Prefer E2E; use unit tests only for edge cases E2E cannot cover.
- Test intent, not line coverage. No tautologies or abstract-base-only tests; exercise shared behavior through concrete implementations or E2E.
- Java: JUnit 6 + Pioneer, AssertJ fluent, short spec-reference comments, parameterized tests when appropriate.
- For throwing handlers, throw a real checked exception directly from the lambda; do not hide the
throws ExceptionSAM contract behind try/catch or test only unchecked failures. - Optional parameters in fixtures (e.g.
@McpToolmethods): use JSpecify@Nullable, notOptional<T>—Optionalis for result types. Keep oneOptionalparameter per suite only to verify that binding path. - Test wire behavior through real codecs or clients; use concrete mapper tests for mapper-only edge cases. For omitted/null claims, serialize with the real codec and assert the JSON; a null model field is insufficient.
- E2E: use
McpTestClients/versioned testkit clients andJsonRpcResponseAssert(its staticassertThatcoexists with AssertJ). Narrow withisSuccess()/isJsonRpcError(), then use typed assertions (hasId, content/result assertions, or error code/message/data assertions). Prefer them overinPath, which can silently no-op. Assert full and minimal payloads; usehasResultorhasContentExactlyfor complete shapes, and targeted assertions only when exhaustive. Seedocs/testkit.mdandDiscoverResponseAssert. - Use JsonUnit + AssertJ only when testkit cannot model the shape (for example nested task results or
non-testkit clients). Assert the full
// language=JSONpayload; avoid path fragments and field getters. Confirm expected JSON against a real run. Ignore paths/order/extras/null only for genuine nondeterminism, never by default. // language=jsonbefore JSON strings.- Kotlin: use Kotest assertions and
kotest-assertions-json; assert full JSON.
Shared E2E servers
- Shared singleton servers are production-parity SUTs. Keep configuration/registries immutable after
startup; tests that mutate registration use isolated
startServer(...)instances. - Keep session mode explicit and invariant: stateful fixtures enable sessions; stateless fixtures do not.
- Parallel JUnit is background pressure, not concurrency proof. Coordinate simultaneous E2E clients with barriers/latches, virtual threads, and bounded timeouts; never fixed sleeps.
- Stateful concurrency must prove unique sessions, parallelism across/within sessions, isolation for repeated IDs, and independent termination. Stateless concurrency must prove no session ID and no response/client-data crossover.
- Test observable server behaviour through real clients. Don't add tests for test helpers.
Documentation examples
Rules for doc code blocks and manual-testing instructions live in the
doc-snippets skill. Load it only when editing docs/.
JSON/JSON Schemas
- Reuse
dev.tachyonmcp.api.json; do not add JSON/schema parsing helpers. - Static schema → parse text block.
ObjectMapper.readTree("""...""")or sharedparseJson(String)helper.// language=jsonfor IDE. - Imperative
JsonNodeFactoryonly for runtime-computed schemas.
Logging policy
| Level | Use |
|---|---|
| ERROR | Immediate action — ops enables Rollbar+PagerDuty alerting |
| WARN | Action needed, can wait to next business day |
| INFO (default on) | Normal-operation info |
| DEBUG (off on PROD, on DEV) | Trace business logic |
| TRACE (off by default) | Raw request/response dump — leaks confidential data and untrusted input if left on |
04 同仓库更多 Skills
greeting
Greet the user by name
★ 39
pdf-processing
Extract, fill, and assemble PDF documents
★ 39
read-file
How to read a file
★ 39
git-workflow
Follow this team's Git conventions for branching and commits
★ 39
elvish-magic
Compose gentle, fictional Elvish spells for light, water, and growing things
★ 39
elvish-healing
Create gentle, fictional Elvish remedies for fantasy stories and games
★ 39