
Typescript
This is a strict TypeScript style guide that enforces two main patterns: const objects with type extraction instead of string unions, and flat interfaces with no inline nesting. It's opinionated about banning `any` entirely in favor of `unknown` and generics. The const types pattern is clever because you get both runtime values and type safety from a single source, which genuinely makes refactoring easier. The flat interface rule might feel restrictive if you're used to inline objects, but it does force cleaner separation. Also includes a solid reference for utility types and type guards. Use this if you want strict conventions on a team or you're tired of inconsistent TypeScript across a codebase.
- skills.sh installs
- 500
- GitHub stars
- 665
- last updated
- Aug 21, 2026
Install
$ npx -y skills add gentleman-programming/gentleman-skills --skill typescript --agent claude-codeInstalls into .claude/skills of the current project.
Files
Const Types Pattern (REQUIRED)
// ✅ ALWAYS: Create const object first, then extract type
const STATUS = {
ACTIVE: "active",
INACTIVE: "inactive",
PENDING: "pending",
} as const;
type Status = (typeof STATUS)[keyof typeof STATUS];
// ❌ NEVER: Direct union types
type Status = "active" | "inactive" | "pending";
Why? Single source of truth, runtime values, autocomplete, easier refactoring.
Flat Interfaces (REQUIRED)
// ✅ ALWAYS: One level depth, nested objects → dedicated interface
interface UserAddress {
street: string;
city: string;
}
interface User {
id: string;
name: string;
address: UserAddress; // Reference, not inline
}
interface Admin extends User {
permissions: string[];
}
// ❌ NEVER: Inline nested objects
interface User {
address: { street: string; city: string }; // NO!
}
Never Use any
// ✅ Use unknown for truly unknown types
function parse(input: unknown): User {
if (isUser(input)) return input;
throw new Error("Invalid input");
}
// ✅ Use generics for flexible types
function first<T>(arr: T[]): T | undefined {
return arr[0];
}
Sponsors
Details
- Repository
- github.com/gentleman-programming/gentleman-skills
- Category
- Documentation
- First seen
- Jun 3, 2026