next-friday/nextfriday-skills
Overview
This skill codifies the Next Friday code style rules for formatting, structure, and readability. It provides concrete guidance for writing functions, control flow, async code, and formatting so code remains predictable and easy to review.
How this skill works
The skill inspects code patterns and recommends replacements that follow Next Friday conventions: prefer guard clauses, avoid nested ternaries, use async/await, prefer function declarations in TypeScript, and enforce simple formatting rules like when to use braces and blank lines. It suggests refactors that simplify returns, extract complex expressions, and keep destructuring sorted and predictable.
When to use it
- When writing or refactoring functions to improve clarity and testability.
- When converting promise chains into async/await flows.
- When reviewing pull requests to enforce consistent control flow and formatting.
- When organizing exports and declarations in TypeScript modules.
- When cleaning up complex return statements or nested conditionals.
Best practices
- Use early returns (guard clauses) instead of nested ifs to reduce indentation and cognitive load.
- Replace nested ternary operators with small helper functions that return early.
- Prefer async/await over .then() chains to keep async logic linear and readable.
- Declare functions (not arrow constants) in TypeScript files and export separately after declaration.
- Keep single-line statements without braces; require braces for multi-line blocks. Add blank lines after multi-line blocks and before returns.
- Extract complex expressions into named constants before using them in returns or parameters; sort destructured properties alphabetically with defaults first.
Example use cases
- Refactor a deeply nested if/else block into guard clauses for faster reasoning and fewer side effects.
- Convert chained Promise calls into an async function to simplify error handling and flow.
- Standardize module structure by declaring functions first and exporting them in one place.
- Clean up a long return statement by extracting intermediate values into clearly named variables.
- Reformat destructuring in a component to alphabetical order with defaults for consistent diffs and readability.
FAQ
Function declarations provide clearer stack traces, consistent hoisting behavior, and a recognizable pattern for public module APIs.
When is a ternary acceptable?
Use a ternary only for very short, single-expression choices. Replace nested or multi-branch ternaries with small functions and early returns.
3 skills
This skill enforces Next Friday code style rules for clean, readable TypeScript with guards, async/await, and proper exports.
This skill enforces TypeScript patterns from Next Friday to standardize props, params, and return types for safer, clearer React code.
This skill helps you write cleaner React and JSX code by applying Next Friday patterns for props, lazy loading, destructuring, and formatting.