codex grade coding

    by Skills Pro

    1

    A senior software engineering workflow for writing, refactoring, and testing production-grade, secure code.

    $5

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    codex grade coding

    Example session with this skill installed

    Refactor the processPayment function in payment.js to handle network timeouts, validate the amount is a positive integer, and add a Jest test case for the failure scenario.

    • Read your context and instructions
    • Compiled the codex grade coding

    I have refactored the processPayment function to include robust input validation and error handling for network failures. I also added a unit test to verify the timeout behavior.

    Refactored Payment Logic and Tests

    // payment.js
    const axios = require('axios');
    
    /**
     * Processes a payment via the external gateway.
     * @param {number} amount - Positive integer in cents.
     * @param {string} token - Payment gateway token.
     * @throws {Error} For invalid input or gateway timeouts.
     */
    async function processPayment(amount, token) {
      // Validate input: Amount must be a positive integer
      if (!Number.isInteger(amount) || amount <= 0) {
        throw new Error('Invalid payment amount: must be a positive integer in cents.');
      }
    
      if (!token || typeof token !== 'string') {
        throw new Error('Invalid payment token.');
      }
    
      try {
        const response = await axios.post('https://api.gateway.com/v1/charge', {
          amount,
          token
        }, { timeout: 5000 }); // 5s timeout to prevent hanging threads
    
        return response.data;
      } catch (error) {
        if (error.code === 'ECONNABORTED') {
          throw new Error('Payment gateway timed out. Please retry.');
        }
        const message = error.response?.data?.message || 'Payment processing failed.';
        throw new Error(message);
      }
    }
    
    module.exports = { processPayment };
    
    // __tests__/payment.test.js
    const { processPayment } = require('../payment');
    const axios = require('axios');
    
    jest.mock('axios');
    
    describe('processPayment', () => {
      it('should throw an error if the network request times out', async () => {
        axios.post.mockRejectedValueOnce({ code: 'ECONNABORTED' });
    
        await expect(processPayment(1000, 'tok_test'))
          .rejects
          .toThrow('Payment gateway timed out. Please retry.');
      });
    
      it('should throw an error for non-integer amounts', async () => {
        await expect(processPayment(10.5, 'tok_test'))
          .rejects
          .toThrow('Invalid payment amount');
      });
    });
    

    Next steps

    1. Run npm test to verify the new Jest test cases pass.
    2. Update your .env to ensure the gateway timeout matches your infrastructure SLAs.
    3. Integrate the new error messages into your frontend notification service.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    The problem

    Writing production code is more than just making it work. Developers often struggle with LLMs that output clever but unmaintainable hacks, introduce unnecessary dependencies, or ignore critical security and error-handling patterns.

    What it does

    • Analyzes existing project conventions to ensure new code integrates without architectural drift.
    • Implements defensive programming patterns, including comprehensive error handling and edge-case validation.
    • Performs an internal security audit to prevent injection, credential leaking, and unsafe file operations.
    • Generates targeted unit and integration tests for both happy paths and failure states.
    • Optimizes for simplicity and maintainability, preferring standard library solutions over bloat.

    Why this beats prompting it yourself

    Generic prompts often result in bloated code or "TODO" comments. This skill enforces a strict senior engineering workflow that mandates pre-implementation planning and post-implementation security reviews. It ensures every line of code is modular, testable, and production-ready by default.

    Use cases

    • Refactoring legacy functions into modular, testable components.
    • Building new API endpoints with robust validation and security middleware.
    • Writing complex business logic that requires high reliability and performance.
    • Automating the generation of test suites for existing undocumented codebases.

    Cannot verify code execution or deployment status unless the environment provides active runtime tools. Requires access to existing files to maintain architectural consistency.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 3 months ago

    Permissions

    Terminal / Shell
    Listed3 months ago

    What's inside

    Frequently Asked Questions

    This skill goes beyond simple snippets by enforcing a senior-level workflow that includes architectural analysis, defensive programming, security auditing, and automated test generation to ensure code is production-ready.

    The skill is designed to work across most major programming languages, with specific optimizations for Python and JavaScript ecosystems, including their standard libraries and common testing frameworks.

    Once you add this skill to your agent platform, it integrates via a standard API or plugin interface, allowing it to read your current project context and conventions automatically.

    Yes, the skill is specifically engineered to analyze existing legacy code and refactor it into modular, secure components while removing 'TODO' gaps and technical debt.

    Your purchase includes the full workflow logic, lifetime access to the skill, and any future version updates that optimize security checks or compatibility with newer LLM models.

    Absolutely—the workflow includes a mandatory security audit phase that checks for common vulnerabilities like injection risks, unsafe file operations, and credential leakage before finalizing the code.

    New in Code Quality & Review

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.