{"data":{"slug":"github-aipoch-medical-research-skills-scientific-skills-protocol-design-randomization-gen-663a5258c387","title":"Randomization Sequence Generation for RCTs","summary":"Generates randomization sequences for randomized controlled trials (RCTs) with support for simple, blocked, and stratified allocation. Produces sealed randomization lists for allocation concealment.","url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-scientific-skills-protocol-design-randomization-gen-663a5258c387","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-aipoch-medical-research-skills-scientific-skills-protocol-design-randomization-gen-663a5258c387","markdown_url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-scientific-skills-protocol-design-randomization-gen-663a5258c387.md","download_url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-scientific-skills-protocol-design-randomization-gen-663a5258c387\/download","category":{"slug":"data-research","name":"Data & Research"},"editor_note":"Before generating the sequence, confirm the allocation plan summary (N per group, block structure, total blocks) with the user. Ensure that `n_subjects` is divisible by `block_size` and that `block_size` is a multiple of `n_groups`.","instructions":"---\nname: randomization-gen\ndescription: Generates randomization sequences for RCTs including simple, blocked, and stratified allocation. Produces sealed randomization lists ready for allocation concealment.\nlicense: MIT\nauthor: AIPOCH\n---\n> **Source**: [https:\/\/github.com\/aipoch\/medical-research-skills](https:\/\/github.com\/aipoch\/medical-research-skills)\n\n# Randomization Gen\n\nRCT randomization table generator.\n\n## Quick Check\n\nUse this command to verify that the packaged script entry point can be parsed before deeper execution.\n\n```bash\npython -m py_compile scripts\/main.py\n```\n\n## Audit-Ready Commands\n\nUse these concrete commands for validation. They are intentionally self-contained and avoid placeholder paths.\n\n```bash\npython -m py_compile scripts\/main.py\npython scripts\/main.py --help\n```\n\n## When to Use\n\n- Use this skill when designing trial randomization, generating allocation sequences, or creating block randomization tables.\n- Use this skill when the user says \"randomization\", \"random allocation\", \"block randomization\", \"stratified randomization\", or \"RCT design\".\n- Use this skill when you need sealed randomization lists ready for allocation concealment.\n\n## Workflow\n\n1. **Collect parameters**: Gather n_subjects (total sample size), n_groups (number of arms), block_size (must be multiple of n_groups), and optional stratification factors.\n2. **Validate inputs**: Verify n_subjects > 0, n_groups >= 2, block_size is a multiple of n_groups, and n_subjects is divisible by block_size. If invalid, report exact constraint violated and stop.\n3. **Checkpoint**: Display allocation plan summary (N per group, block structure, total blocks) to user for confirmation before generating sequence.\n4. **Generate sequence**: Create randomization list using blocked randomization. Shuffle block contents using a reproducible seed if provided.\n5. **Output**: Return sealed randomization list with block assignments and allocation concealment metadata.\n6. **Fallback**: If block_size is not a multiple of n_groups, suggest the nearest valid block sizes and proceed only after user confirmation.\n\n## Use Cases\n- Clinical trial design\n- Animal study randomization\n- Blocked randomization\n- Stratified allocation\n\n## Parameters\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `n_subjects` | int | Yes | Total sample size |\n| `n_groups` | int | Yes | Number of arms\/groups |\n| `block_size` | int | Yes | Block size (must be multiple of n_groups) |\n| `--output` | string | No | Output file path (default: randomization.txt) |\n\n## Returns\n- Randomization sequence\n- Block assignments\n- Allocation concealment ready\n\n## Example\nInput: n=120, 3 groups, block=6\nOutput: Sealed randomization list\n\n## References\n\n- [references\/audit-reference.md](references\/audit-reference.md) - Supported randomization modes, audit commands, and fallback boundaries\n\n## Risk Assessment\n\n| Risk Indicator | Assessment | Level |\n|----------------|------------|-------|\n| Code Execution | Python\/R scripts executed locally | Medium |\n| Network Access | No external API calls | Low |\n| File System Access | Read input files, write output files | Medium |\n| Instruction Tampering | Standard prompt guidelines | Low |\n| Data Exposure | Output files saved to workspace | Low |\n\n## Security Checklist\n\n- [ ] No hardcoded credentials or API keys\n- [ ] No unauthorized file system access (..\/)\n- [ ] Output does not expose sensitive information\n- [ ] Prompt injection protections in place\n- [ ] Input file paths validated (no ..\/ traversal)\n- [ ] Output directory restricted to workspace\n- [ ] Script execution in sandboxed environment\n- [ ] Error messages sanitized (no stack traces exposed)\n- [ ] Dependencies audited\n\n## Prerequisites\n\nNo additional Python packages required.\n\n## Evaluation Criteria\n\n### Success Metrics\n- [ ] Successfully executes main functionality\n- [ ] Output meets quality standards\n- [ ] Handles edge cases gracefully\n- [ ] Performance is acceptable\n\n### Test Cases\n1. **Basic Functionality**: Standard input \u2192 Expected output\n2. **Edge Case**: Invalid input \u2192 Graceful error handling\n3. **Performance**: Large dataset \u2192 Acceptable processing time\n\n## Lifecycle Status\n\n- **Current Stage**: Draft\n- **Next Review Date**: 2026-03-06\n- **Known Issues**: None\n- **Planned Improvements**: \n  - Performance optimization\n  - Additional feature support\n\n## Output Requirements\n\nEvery final response should make these items explicit when they are relevant:\n\n- Objective or requested deliverable\n- Inputs used and assumptions introduced\n- Workflow or decision path\n- Core result, recommendation, or artifact\n- Constraints, risks, caveats, or validation needs\n- Unresolved items and next-step checks\n\n## Error Handling\n\n- If required inputs are missing, state exactly which fields are missing and request only the minimum additional information.\n- If the task goes outside the documented scope, stop instead of guessing or silently widening the assignment.\n- If `scripts\/main.py` fails, report the failure point, summarize what still can be completed safely, and provide a manual fallback.\n- Do not fabricate files, citations, data, search results, or execution outcomes.\n\n## Input Validation\n\nThis skill accepts requests that match the documented purpose of `randomization-gen` and include enough context to complete the workflow safely.\n\nDo not continue the workflow when the request is out of scope, missing a critical input, or would require unsupported assumptions. Instead respond:\n\n> `randomization-gen` only handles its documented workflow. Please provide the missing required inputs or switch to a more suitable skill.\n\n## Response Template\n\nUse the following fixed structure for non-trivial requests:\n\n1. Objective\n2. Inputs Received\n3. Assumptions\n4. Workflow\n5. Deliverable\n6. Risks and Limits\n7. Next Checks\n\nIf the request is simple, you may compress the structure, but still keep assumptions and limits explicit when they affect correctness.\n","use_cases":["Clinical trial design","Animal study randomization","Blocked randomization","Stratified allocation"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/aipoch\/medical-research-skills\/blob\/686e09dfdb45d9fa1a08664f06bb93769b3c9d91\/scientific-skills\/Protocol%20Design\/randomization-gen\/SKILL.md","source_commit":"686e09dfdb45d9fa1a08664f06bb93769b3c9d91","license":"MIT","version":null,"listing_approved_at":"2026-11-26","created_at":"2026-11-24T16:47:49.000000Z","updated_at":"2026-11-26T09:25:15.000000Z","seo_title":"RCT Randomization Sequence Generator","seo_description":"Generate randomization sequences for RCTs with blocked, stratified, and simple allocation. Produces sealed lists for allocation concealment.","seo_keywords":["RCT randomization","blocked randomization","stratified allocation","randomization sequence","allocation concealment"]}}