Skip to content
cccskills
FreePublished on GitHub

cleanup

Review changed code after implementation for readability, repeated logic, inconsistent patterns, unsafe boundary handling, redundant casts, and dead code. The checklist guides cleanup and calls for a TypeScript type check after fixes.

OriginalShow the original description

MUST run after writing or modifying code — reviews changed files for verbose patterns, inconsistencies, and readability issues before considering work done

trycompai/comp2,058 stars(GitHub 2,058 + cccskills 0)

Run score Not tested

See how to install

Good for

  • Reviewing files after implementing a feature
  • Cleaning up code after a bug fix
  • Checking changed files before committing

Files included (1)

  • SKILL.md2.6 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

Post-Implementation Cleanup

This skill is mandatory. After writing or modifying code, you MUST review all changed files before reporting the task as complete. Code must be readable at a glance.

When to Run

  • After completing any implementation work
  • After fixing bugs
  • After refactoring
  • Before committing

Checklist

For every file you changed, verify:

1. No Verbose Defensive Checks

Extract repeated patterns into typed helpers.

// ❌ Verbose and repeated
const perms = typeof role.permissions === 'string'
  ? JSON.parse(role.permissions) : role.permissions;
if (perms && typeof perms === 'object' && Array.isArray(perms.portal) && perms.portal.length > 0) {

// ✅ Typed helper
const perms = parseRolePermissions(role.permissions);
if (perms?.portal?.length) {

2. Consistent Idioms Across Files

The same check must use the same pattern everywhere.

// ❌ Inconsistent
file1: perms?.portal?.length > 0
file2: perms?.portal?.length

// ✅ Pick one
perms?.portal?.length

3. No Redundant Type Casts

If you need a cast to satisfy TypeScript, extract a helper function instead.

// ❌ Verbose cast repeated in every file
const restrictedRoles: readonly string[] = RESTRICTED_ROLES;
restrictedRoles.includes(role);

// ✅ Helper in shared package
export function isRestrictedRole(role: string): boolean {
  return (RESTRICTED_ROLES as readonly string[]).includes(role);
}

4. Error Handling on Boundaries

JSON.parse, external API calls, and DB queries at system boundaries need error handling.

// ❌ Unguarded parse
const parsed = JSON.parse(value);

// ✅ Safe parse
try {
  return JSON.parse(value);
} catch {
  return null;
}

5. Shared Patterns Belong in Shared Packages

If the same logic appears in 2+ apps (api, app, portal), extract it to a shared package (packages/auth, packages/db, etc.).

6. No Dead Code

  • Remove unused imports
  • Remove unused variables
  • Remove unused function parameters
  • Remove props that are always null/false

7. Readable at a Glance

  • Function and variable names should convey intent without reading the implementation
  • One-liner expressions over multi-line when equally clear
  • No nested ternaries

How to Run

  1. List all files you modified: git diff --name-only
  2. Read each file and check against this checklist
  3. Fix any issues found
  4. Typecheck after fixes: npx tsc --noEmit

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

Guide API endpoint changes so request DTOs, runtime validation, OpenAPI documentation, and MCP tool metadata stay aligned. It covers discoverability, authentication, uploads, long-running tasks, and response types that MCP tools cannot handle.

  • Adding an API endpoint with a request body
  • Updating DTO validation and OpenAPI metadata
  • Making an endpoint available as an MCP tool
trycompai/comp2.1KUpdated Oct 24, 2026

Review specified files for design system usage, replace legacy @trycompai/ui components and lucide-react icons with available @trycompai/design-system equivalents, and run the app type check to verify the migration.

  • Migrating legacy UI components
  • Replacing lucide-react icons with Carbon icons
  • Checking specified files for design system compliance
trycompai/comp2.1KUpdated Oct 24, 2026

audit-hooks

FreeSummary

Review specified files for outdated hook and API patterns, then replace them with the prescribed SWR hooks, API clients, or server API calls. The guidance covers data fetching, mutations, cache updates, and response handling, followed by a typecheck command.

  • Auditing files for disallowed API and hook patterns
  • Replacing raw fetch calls with the API client
  • Migrating server actions and database mutations to API hooks
trycompai/comp2.1KUpdated Oct 24, 2026

audit-rbac

FreeSummary

Review NestJS API endpoints and frontend components for role-based access control and audit log compliance. The skill lists permission, guard, route, and UI gating rules, then directs the agent to fix violations and run type checks.

  • Auditing API routes for permission decorators
  • Checking UI actions against user permissions
  • Fixing access control inconsistencies
trycompai/comp2.1KUpdated Oct 24, 2026

audit-tests

FreeSummary

Audit unit tests for components that use permissions. Add missing tests and fix failures, checking that administrators can use mutation controls, auditors cannot, and read-only content remains visible to both.

  • Adding permission tests for a component
  • Checking admin and auditor behavior
  • Fixing failing permission-related tests
trycompai/comp2.1KUpdated Oct 24, 2026

Set up Better Auth for TypeScript applications, including server and client configuration, database adapters, sessions, email and social sign-in, and plugins. The guide also highlights environment variables, schema generation, and security settings to review.

  • Configuring Better Auth in a TypeScript app
  • Connecting an ORM or database adapter
  • Setting up sessions and cookie storage
trycompai/comp2.1KUpdated Oct 24, 2026

See all skills by trycompai

Report a problem with this skill