Whenever you are tasked to create a new project, you should default to using bun unless the user is explicitly requesting anohter rutime or language. Use biome on the most restrictive setting, and setup tsconfig to prevent any data type usage.
Unless otherwise promted, uset Tanstack-Start, Shad-cn, and target Cloudflare workers for deployment.
Never use .dev.vars* style environment files. This is out of date.
wrangler supports .env/.env.* files. Always go for this style.
Prefere to use typescript with bun over python. Unless otherwise prompted.
Whenever you're tasked to write software follow these principles.
- Single Responsibility: Each module, class, or function should have one reason to change. Split components that handle multiple concerns.
- Open/Closed: Code should be open for extension but closed for modification. Use composition and interfaces over direct modification.
- Liskov Substitution: Derived types must be substitutable for their base types without altering correctness.
- Interface Segregation: Prefer small, specific interfaces over large, general-purpose ones. Don't force implementations to depend on methods they don't use.
- Dependency Inversion: Depend on abstractions, not concretions. High-level modules should not depend on low-level modules directly.
- Extract repeated logic into reusable functions, hooks, or utilities
- Share common types and interfaces across the codebase
- Use constants for magic values that appear in multiple places
- Create shared components for repeated UI patterns
- If you copy-paste code more than twice, refactor it into a shared abstraction
- Only implement features that are currently required
- Do not add properties, parameters, or methods "just in case"
- Avoid premature abstractions - wait until patterns emerge
- Delete unused code rather than commenting it out
- Do not build for hypothetical future requirements
- Keep interfaces minimal - add fields only when they have a concrete use case
Design software as self-contained, portable modules that can be easily moved between projects.
- Each module should be a complete, standalone unit with its own types, utilities, and components
- Modules must not reach into other modules' internals - communicate only through public interfaces
- Keep module-specific assets (styles, constants, helpers) co-located within the module folder
- A module should be deletable by removing a single folder without breaking the rest of the app
- Depend only on the framework/runtime and explicitly declared shared libraries
- Avoid implicit dependencies on app-level state, global stores, or sibling modules
- If a module needs external data, accept it through props, parameters, or dependency injection
- Prefer passing callbacks over importing app-specific actions or services
- Define explicit public APIs for each module (e.g., an
index.tsbarrel file) - Hide implementation details - only export what consumers need
- Use feature folders: group by capability (e.g.,
modules/survey/) not by file type - Document what the module does and how to integrate it in a module-level README if non-trivial
Before considering a module complete, verify:
- Can be copied to a fresh project with only framework dependencies
- Has no imports from parent directories outside the module (no
../../app/paths) - All required types are defined within or imported from shared packages
- Configuration is passed in, not hardcoded to app-specific values
- Works with mock/stub dependencies for testing in isolation
Edit text to remove AI patterns and add human voice.
- Scan for the patterns below.
- Rewrite. Preserve meaning, match intended tone.
- Add soul (see next section).
- Self-audit: "What makes this obviously AI generated?" Fix remaining tells.
Removing patterns is half the job. Sterile, voiceless writing is just as obvious.
- Have opinions. React to facts instead of neutrally listing pros and cons.
- Vary rhythm. Short sentences. Then longer ones that take their time. Mix it up.
- Acknowledge complexity. "Impressive but also kind of unsettling" beats "impressive."
- Use "I" when it fits. First person isn't unprofessional.
- Let some mess in. Perfect structure looks machine-made.
- Be specific. Not "this is concerning" but "there's something unsettling about agents churning away at 3am."
- Puffery. "pivotal moment", "testament to", "evolving landscape", "setting the stage for", "indelible mark", "deeply rooted". Cut puffery, state what happened.
- Name-dropping. Listing media outlets without context. Pick one, say what was said.
- Superficial -ing phrases. "highlighting...", "ensuring...", "reflecting...", "showcasing...", "fostering...". Delete or expand with real sources.
- Promotional language. "nestled", "vibrant", "breathtaking", "groundbreaking", "renowned", "stunning", "must-visit". Use neutral descriptions.
- Vague attributions. "Experts believe", "Industry reports suggest", "Some critics argue". Name the source or delete.
- Formulaic challenges. "Despite challenges... continues to thrive." Replace with specific facts.
- AI vocabulary. Additionally, crucial, delve, enduring, enhance, fostering, garner, interplay, intricate, landscape (abstract), pivotal, showcase, tapestry (abstract), testament, underscore, vibrant. Replace with plain words.
- Fancy ways to say "is". "serves as", "stands as", "boasts", "features". Just say "is" or "has".
- "Not just X, but Y." State the point directly instead.
- Rule of three. Forcing ideas into groups of three. Use the natural number.
- Synonym cycling. Protagonist, main character, central figure, hero all in one paragraph. Pick one, repeat it.
- False ranges. "from X to Y" where X and Y aren't on a meaningful scale. List topics directly.
- Em dash overuse. Avoid em dashes entirely. Use periods or commas only (no parentheses, no en dashes, no hyphen-as-dash substitutes). Em dashes are an AI tell, and reaching for parentheses instead just trades one tell for another. If a thought needs separation, end the sentence or use a comma.
- Colon overuse. Colons are fine before a list or example. Not as mid-sentence connectors. "If you're coming from traditional automation: instead of registering event handlers, you describe conditions" adds nothing with the colon. Rewrite to let the point stand on its own without comparison framing. "Describing when the scheduler should fire works best as plain English." Same meaning, no crutch punctuation.
- Boldface overuse. Don't bold every proper noun or acronym.
- Inline-header lists. The tell is a bold label and colon that restates the line: "Performance: Performance improved...". Convert those to prose. A bold lead-in that ends in a period, names the item, and is followed by genuinely new detail ("Schema in TypeScript. Tables live in one file.") is fine, not a tell.
- Title case headings. Use sentence case.
- Decorative emojis. Remove from headings and bullets.
- Curly quotes. Replace with straight quotes.
- Chatbot phrases. "I hope this helps!", "Let me know if...", "Of course!", "Certainly!", "Found the smoking gun!" Remove.
- Cutoff disclaimers. "While specific details are limited..." Find sources or remove.
- Sycophantic tone. "Great question! You're absolutely right!" Respond directly.
- Filler phrases. "In order to" becomes "To". "Due to the fact that" becomes "Because". "It is important to note that" gets deleted.
- Excessive hedging. "could potentially possibly be argued that it might" becomes "may".
- Generic conclusions. "The future looks bright." State specific plans or facts.
- Abstract metaphor nouns. Substrate, wedge, vector, locus, vantage, nexus, primitive (as noun), harness (as metaphor), surface (as in "API surface"), bedrock, scaffolding (as metaphor), modality, paradigm, gold-plating, ratchet (as metaphor), evacuate (for moving code), endgame, north star, flywheel. These read as technical but usually have a plainer concrete word. "Substrate" becomes "base". "Wedge in" becomes "add". "Vector" becomes "way" or "method". "Gold-plating" becomes "more than the job needs". "Ratchet" becomes the mechanism's real name or "a limit that only tightens". "Evacuate" becomes "move out". "Endgame" becomes "the last phase". Pick the concrete word.
- Say what it does, not how it feels. "the database stays close at hand", "SQL you can read", "types that follow your schema" name a feeling. The fix names the mechanism or a number: "
.toSQL()returns the exact string sent to the database", "a column rename fails the build". Ask what the sentence tells the reader to do or know, then write that. If you can't restate it as a concrete instruction, fact, or number, cut it. One more check: if the sentence could appear unchanged in another project's docs, it says nothing about this one. Cut it. - Shorten or split dense sentences. If the reader has to backtrack to parse a sentence, break it in two or drop clauses. One idea per sentence.
- Active voice. Prefer it. Catch "is/are/was/were + past participle" and name the actor: "queries are validated" becomes "the compiler validates queries", "the file is parsed by the loader" becomes "the loader parses the file". Passive is fine only when the actor is unknown or genuinely doesn't matter.
- Cut adverbs, or use a stronger verb. "runs quickly" becomes "is fast" or the number. "significantly improves" becomes the measured delta. An adverb propping up a weak verb means the verb is wrong.
- Prefer the plain word. "utilize" becomes "use", "leverage" becomes "use", "facilitate" becomes "help", "numerous" becomes "many", "in the event that" becomes "if". The fancier synonym is rarely clearer.