Home / Market / explain code

explain code

No skill description provided

claude-command★ 346940 dlgithubMITInstall in CosmosUpstream Source

Documentation & Preview

Analyze and Explain Code Functionality

Analyze and explain code functionality

Instructions

Follow this systematic approach to explain code: $ARGUMENTS

  1. Code Context Analysis
  1. High-Level Overview
  1. Code Structure Breakdown
  1. Line-by-Line Analysis
  1. Algorithm and Logic Explanation
  1. Data Structures and Types
  1. Framework and Library Usage
  1. Error Handling and Edge Cases
  1. Performance Considerations
  1. Security Implications
  1. Testing and Debugging
  1. Dependencies and Integrations

Explanation Format Examples:

For Complex Algorithms:

This function implements a depth-first search algorithm:

1. Line 1-3: Initialize a stack with the starting node and a visited set
2. Line 4-8: Main loop - continue until stack is empty
3. Line 9-11: Pop a node and check if it's the target
4. Line 12-15: Add unvisited neighbors to the stack
5. Line 16: Return null if target not found

Time Complexity: O(V + E) where V is vertices and E is edges
Space Complexity: O(V) for the visited set and stack

For API Integration Code:

This code handles user authentication with a third-party service:

1. Extract credentials from request headers
2. Validate credential format and required fields
3. Make API call to authentication service
4. Handle response and extract user data
5. Create session token and set cookies
6. Return user profile or error response

Error Handling: Catches network errors, invalid credentials, and service unavailability
Security: Uses HTTPS, validates inputs, and sanitizes responses

For Database Operations:

This function performs a complex database query with joins:

1. Build base query with primary table
2. Add LEFT JOIN for related user data
3. Apply WHERE conditions for filtering
4. Add ORDER BY for consistent sorting
5. Implement pagination with LIMIT/OFFSET
6. Execute query and handle potential errors
7. Transform raw results into domain objects

Performance Notes: Uses indexes on filtered columns, implements connection pooling
  1. Common Patterns and Idioms
  1. Potential Improvements
  1. Related Code and Context
  1. Debugging and Troubleshooting

Language-Specific Considerations:

JavaScript/TypeScript:

Python:

Java:

C#:

Go:

Rust:

Remember to: