Skip to content

Instantly share code, notes, and snippets.

@qpwo
Created December 11, 2025 13:45
Show Gist options
  • Select an option

  • Save qpwo/2c041157e8eeb6ee70aa865aebda3d37 to your computer and use it in GitHub Desktop.

Select an option

Save qpwo/2c041157e8eeb6ee70aa865aebda3d37 to your computer and use it in GitHub Desktop.
example_spec.txt
spec_app_patterns: implement four preact rendering patterns: client-only, csr-in-ssr, ssr-in-csr, and ssr-only.
spec_app_language: use typescript with jsx for all components and server logic.
spec_structure_flat: all source code files must live in the project root directory, not in subdirectories like 'src'.
spec_tooling_runner: a single `./run` bash script must be the entry point for all build and development tasks, replacing npm scripts.
spec_tooling_bundler: use esbuild to bundle both the client-side (to `public/client.js`) and server-side (to `server.js`) code.
spec_tooling_typechecker: use the typescript compiler (`tsc`) for static type checking, invoked via `./run tsc`.
spec_verification_self_test: the express server must perform a self-test on startup by fetching all its own routes.
spec_verification_fail_fast: if any self-test fetch fails, the server process must immediately exit with a non-zero status code.
spec_verification_complete: the task is done when `./run tsc` passes and `./run serve` starts and successfully completes its self-test.
spec_inline_style_string: always use style prop for styling. example: <input readonly value={count} style="border: 1px solid red;"/>
spec_minimize_parens: dont paren jsx. example: never `return (<div>...</div>)`. always `return <div>...</div>`
spec_name_all_multiline_func: if a function has more than one line, then you must do 'function someName(){}' instead of '()=>{}'. this also applies to immediately invoked functions etc. inline is ok but must be named. example: `app.get('/foo', function getFoo(req, res) => {...})`
spec_newspaper_principle: the most important functions should go at the top. helpers towards bottom.
spec_minimize_trycatch: you should almost never use try-catch. try-finally is ok.
spec_full_error: always do console.error(error) or whatever(error). never do something(error.message). use full error.
spec_readme: ./README must exist and it must have exactly one line per git-tracked file, with a short explanation of what each file does
spec_entry: the server entry must be named server_entry.tsx. the client entry must be named client_entry.tsx. probably rename app.tsx to something more descriptive.
spec_exact_version: after you install something, modify package.json to remove leading ^ symbol. so we have 1.2.3 instead of ^1.2.3
spec_oneline_jsdoc: all named functions should have /** jsdoc comment */ exactly one line briefly explaining it
spec_reduce_any: only use `any` type in typescript when you really need it
spec_think: always think very carefully before acting. every single time. every single turn. never rush. always think carefully before responding.
spec_samename: make sure if you build FILENAME.tsx then the target is named FILENAME.tsx
spec_always_tsx: for consistency, end all typescript source filenames with tsx, even if not using jsx inside
spec_file_jsdoc: every tsx file should start with /** jsdoc comment */ exactly one line briefly explaining it
spec_healthy_quit_arg: if server gets --quit-after-ok sys arg, then if routes all run ok, server should exit 0 after (and of course you should pass this arg during tests)
spec_avoid_markdown: the readme and the jsdoc comments should avoid markdown. no bold or backticks or italics or anything. just txt style.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment