All skills
siberiacancode avatar

/juniors-best-practice

@913a865

Juniors-focused React and TypeScript best practices. Use this skill when writing or reviewing code to enforce clear, consistent, and maintainable patterns across common scopes like React, TypeScript, styling, devtools, assets, and Git.

Use this Skill: https://skilld.dev/gh/siberiacancode/agent-skills/juniors-best-practice

This session only. Nothing lands on disk.

rulesstyling-classnames-function.md

≈358 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Classnames helper

When working with conditional CSS classes, building className strings by hand is hard to read and easy to break.

import type { ComponentProps, ReactNode } from "react";

import styles from "./Button.module.css";

interface ButtonProps extends ComponentProps<"button"> {
  children: ReactNode;
  selected?: boolean;
  variant?: "primary" | "secondary";
  ...
}

const Button = ({ variant = "primary", selected = false, children, ...props }: ButtonProps) => (
  <button className={`${styles.button} ${styles[variant]} ${selected ? styles.selected : ""}`} {...props}>
    {children}
  </button>
);

Use a helper like clsx instead. The utility is simple, and you can implement it yourself if needed:

import type { ComponentProps, ReactNode } from "react";
import clsx from "clsx";

import styles from "./Button.module.css";

interface ButtonProps extends ComponentProps<"button"> {
  children: ReactNode;
  selected?: boolean;
  variant?: "primary" | "secondary";
  ...
}

const Button = ({ variant = "primary", selected = false, children, ...props }: ButtonProps) => (
  <button className={clsx(styles.button, styles[variant], selected && styles.selected)} {...props}>
    {children}
  </button>
);

clsx ignores falsy values and handles spaces correctly, making the code declarative and easy to read.

Source: SKILL.md on GitHub

1 warning16d4 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    This skill provides a comprehensive set of best practices for junior React and TypeScript developers. It includes guidelines on coding style, state management, and tooling, referencing both well-known community packages and libraries maintained by the author. No security risks or malicious behaviors were identified.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    25/25 files flagged

Signed by skilld at 913a865. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 6 months ago
metadata
{
  "author": "siberiacancode",
  "version": "1.0.0"
}

README badge

README badge for siberiacancode/agent-skills/juniors-best-practice